Commit f9d281a8 by Sixong.Zhu

u

parent b8db0839
......@@ -56,15 +56,9 @@
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_ID)
private readonly chatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_ID;
@chatStore.Mutation(ChatStore.MUTATION_CLEAR_CURRENT_CHAT_MEMBERS)
private readonly clearChatMembers!: ChatStore.MUTATION_CLEAR_CURRENT_CHAT_MEMBERS;
@chatStore.State(ChatStore.STATE_CURRENT_CHAT_INPUTING)
private readonly currentInputPeople!: ChatStore.STATE_CURRENT_CHAT_INPUTING;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID)
private readonly currentChatUniplatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER)
private readonly isChatMember!: ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER;
......@@ -82,12 +76,6 @@
@Provide() showReadSummary = true;
@Watch("currentChatUniplatId")
private whenCurrentChatIdChanged(newValue: string, oldValue: string) {
if (Number(oldValue) === Number(newValue)) return;
this.clearChatMembers();
}
private get getCurrentInputingPeople() {
return this.currentInputPeople
.map(() => "" /* this.userInfo[k].name */)
......@@ -174,6 +162,7 @@
),
300
);
this.$emit("send");
}
}
</script>
......@@ -184,7 +173,7 @@
width: 46px;
height: 20px;
line-height: 20px;
background: #22bd7a;
background-color: #22bd7a;
font-size: 13px;
border-radius: 2px;
color: #ffffff;
......
......@@ -108,14 +108,16 @@ const chatType = "group";
const allowedChatTypes = [chatType, "notify"];
export const filterActiveChats = (items: RawChatItem[]) => {
return items.filter(
(i) =>
!i.is_finish &&
!i.is_exited &&
!i.is_remove &&
!i.is_deleted &&
allowedChatTypes.includes(i.type)
);
return items
.filter(
(i) =>
!i.is_finish &&
!i.is_exited &&
!i.is_remove &&
!i.is_deleted &&
allowedChatTypes.includes(i.type)
)
.sort((x, y) => (x.update_time - y.update_time ? 1 : -1));
};
export function getLastMessageId(msgs: Message[] | any) {
......@@ -471,26 +473,6 @@ export default {
return await execute().then((d) => clearAction(d));
},
async [ChatStore.ACTION_FORCE_RELOAD_CHAT_LIST]({ commit }) {
return new Promise<ChatType[]>((resolve) => {
Chat.onReady(() => {
xim.fetchChatList().then((data) => {
if (!data) {
return resolve([]);
}
const chatList = filterActiveChats(
data.args[0] as RawChatItem[]
);
const items = chatList.map((chat) =>
buildChatItem(chat)
);
dbController.saveChatList(items);
commit(ChatStore.MUTATION_SAVE_CHAT_LIST, items);
resolve(items);
});
});
});
},
async [ChatStore.ACTION_REBUILD_UNREAD_MESSAGE_COUNT]({ state }) {
let items = await dbController.getChatList();
let sum = 0;
......
......@@ -252,9 +252,6 @@ export namespace ChatStore {
keyword?: string
) => Promise<ChatType[]>;
export const ACTION_FORCE_RELOAD_CHAT_LIST = "重新获取我的会话列表";
export type ACTION_FORCE_RELOAD_CHAT_LIST = () => Promise<ChatType[]>;
export const ACTION_REBUILD_UNREAD_MESSAGE_COUNT = "重新计算未读消息数";
export type ACTION_REBUILD_UNREAD_MESSAGE_COUNT = () => void;
......
......@@ -151,7 +151,7 @@ class Chat {
.finally(() => {
this.registerXimEvent();
if (xim.isConnected()) {
resolve();
setTimeout(resolve, 0);
} else {
reject(new Error(`xim is not connected`));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment