Commit d7ef878e by Sixong.Zhu

update

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