Commit d7ef878e by Sixong.Zhu

update

parent ccd1ce05
Showing with 18 additions and 6 deletions
......@@ -88,7 +88,12 @@ function buildChatItem(chat: RawChatItem) {
const filterActiveChats = (items: RawChatItem[]) => {
return items.filter(
(i) => !i.is_finish && !i.is_exited && !i.is_remove && !i.is_deleted
(i) =>
!i.is_finish &&
!i.is_exited &&
!i.is_remove &&
!i.is_deleted &&
i.type === "group"
);
};
......@@ -376,10 +381,10 @@ export default {
list: cache,
total: 9999,
});
const ts = cache.map((i) => i.last_msg_ts).sort();
const ts = cache
.map((i) => Math.max(i.last_msg_ts, i.update_time))
.sort();
const last = ts[ts.length - 1];
await xim.fetchChatListAfter(last)!.then((r) => {
const list = filterActiveChats(r.args[0] as RawChatItem[]);
const items = list.map((i) => buildChatItem(i));
......@@ -387,7 +392,6 @@ export default {
cache = dbController.mergeChatList(cache, items);
}
});
return buildUnreadMessage(cache);
}
......@@ -616,7 +620,15 @@ export default {
if (!data) {
return;
}
const chat = data.args[0];
const chat = data.args[0] as RawChatItem;
if (!chat.model_name && chat.business_data) {
const b = JSON.parse(chat.business_data) as {
model_name: string;
obj_id: string;
};
chat.model_name = b.model_name;
chat.obj_id = b.obj_id;
}
wantedChatRoom = {
...chat,
chat_id: chat.id,
......
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