fix(im): 修复历史退群群未读和成员加载问题

- 已读上报使用会话末条消息编号兜底
- 历史退群群不再请求群成员列表
- 群聊 read 放开当前成员校验,保留可见性校验
- Vben 群详情补齐 joinStatus
- 补充退群群已读边界测试
pull/884/MERGE
YunaiV 2026-06-17 01:38:52 +08:00
parent cb625d11bb
commit ddafacf64d
2 changed files with 10 additions and 4 deletions

View File

@ -437,12 +437,15 @@ const groupMembers = computed<GroupMemberLite[]>(() => {
}) })
}) })
/** 切换到群会话时同步群信息 + 成员;各自 fire-and-forget + catch任何一项失败不牵连其它 */ /** 切换到群会话时同步群信息 + 成员 */
async function ensureGroupData(groupId: number) { async function ensureGroupData(groupId: number) {
// / / // / /
groupStore.fetchGroupInfo(groupId).catch((error) => { await groupStore.fetchGroupInfo(groupId).catch((error) => {
console.warn('[IM MessagePanel] fetchGroupInfo 失败', { groupId }, error) console.warn('[IM MessagePanel] fetchGroupInfo 失败', { groupId }, error)
}) })
if (isGroupQuit(groupStore.getGroup(groupId))) {
return
}
// IDB / // IDB /
await groupStore.loadGroupMemberList(groupId).catch((error) => { await groupStore.loadGroupMemberList(groupId).catch((error) => {

View File

@ -27,7 +27,7 @@ import {
} from '../../utils/message' } from '../../utils/message'
import { resolveConversationLastContent } from '../../utils/conversation' import { resolveConversationLastContent } from '../../utils/conversation'
import { getCurrentUserId } from '@/utils/auth' import { getCurrentUserId } from '@/utils/auth'
import { tryGetSenderDisplayName } from '../../utils/user' import { isGroupQuit, tryGetSenderDisplayName } from '../../utils/user'
import { useGroupStore } from './groupStore' import { useGroupStore } from './groupStore'
import { useConversationStore } from './conversationStore' import { useConversationStore } from './conversationStore'
import type { ImConversationReadRespVO } from '@/api/im/conversation/read' import type { ImConversationReadRespVO } from '@/api/im/conversation/read'
@ -137,6 +137,9 @@ function deriveLastSenderDisplayName(
if (conversation.type === ImConversationType.GROUP) { if (conversation.type === ImConversationType.GROUP) {
const groupStore = useGroupStore() const groupStore = useGroupStore()
const group = groupStore.getGroup(conversation.targetId) const group = groupStore.getGroup(conversation.targetId)
if (isGroupQuit(group)) {
return conversation.lastSenderId === senderId ? conversation.lastSenderDisplayName : undefined
}
const fetchPromise = const fetchPromise =
group?.membersLoaded && !group.membersExpired group?.membersLoaded && !group.membersExpired
? groupStore.fetchGroupMember(conversation.targetId, senderId) ? groupStore.fetchGroupMember(conversation.targetId, senderId)