fix(im):同步群昵称静默更新逻辑

- 群聊侧栏从当前群成员的 displayUserName 回填「我在本群的昵称」
- WebSocket 收到 GROUP_MEMBER_NICKNAME_UPDATE 时只同步 groupStore,不再插入消息列表
- 保持与 Vue3 + EP 群昵称修改交互一致
pull/367/head
YunaiV 2026-06-18 06:57:24 -07:00
parent 2cbec901e1
commit 2ee25c8821
2 changed files with 18 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import { IconifyIcon as Icon } from '@vben/icons'
import { message, Popover, Tooltip } from 'ant-design-vue'
import { createCall } from '#/api/im/rtc'
import { getCurrentUserId } from '#/views/im/utils/auth'
import { ImConversationType, ImRtcCallMediaType, ImRtcCallStatus } from '#/views/im/utils/constants'
import { getClientConversationId } from '#/views/im/utils/db'
import { resolveCallEndReasonText } from '#/views/im/utils/message'
@ -183,12 +184,14 @@ const groupInfo = computed<
return undefined
}
const group = groupStore.getGroup(conversation.targetId)
const selfMember = group?.members?.find((member) => member.userId === getCurrentUserId())
return {
id: conversation.targetId,
name: group?.name || conversation.name,
showGroupName: group?.name || conversation.name,
showImage: group?.avatar || conversation.avatar,
notice: group?.notice,
remarkNickName: selfMember?.displayUserName,
groupRemark: group?.groupRemark,
ownerId: group?.ownerUserId,
memberCount: group?.memberCount,

View File

@ -204,6 +204,7 @@ const convertGroupMessage = (
* - / READ / RECEIPT
* - FRIEND_* friendStore + FRIEND_ADD / FRIEND_DELETE
* - GROUP_MEMBER_SETTING_UPDATE groupStore +
* - GROUP_MEMBER_NICKNAME_UPDATE groupStore
* - 广GROUP_* handleGroupMessage + applyGroupNotification DISSOLVE / QUIT / KICK
*/
export const useImWebSocketStore = defineStore('imWebSocketStore', {
@ -538,11 +539,15 @@ export const useImWebSocketStore = defineStore('imWebSocketStore', {
/**
* payload.typeImContentType / / /
*
* 1530 GROUP_MEMBER_SETTING_UPDATE + 1501-1520 广 handleGroupMessage + applyGroupNotification
* GROUP_MEMBER_SETTING_UPDATE / GROUP_MEMBER_NICKNAME_UPDATE 广 handleGroupMessage + applyGroupNotification
*/
dispatchGroupFrame(websocketMessage: ImGroupMessageNotification) {
try {
switch (websocketMessage.type) {
case ImContentType.GROUP_MEMBER_NICKNAME_UPDATE: {
this.handleGroupMemberNicknameUpdate(websocketMessage)
break
}
case ImContentType.GROUP_MEMBER_SETTING_UPDATE: {
this.handleGroupMemberSettingUpdate(websocketMessage)
break
@ -984,6 +989,15 @@ export const useImWebSocketStore = defineStore('imWebSocketStore', {
}
},
/** GROUP_MEMBER_NICKNAME_UPDATE同步成员在群里的昵称 */
handleGroupMemberNicknameUpdate(websocketMessage: ImGroupMessageNotification) {
useGroupStore().applyGroupNotification(
websocketMessage.groupId,
websocketMessage.type,
websocketMessage.content
)
},
// ==================== 心跳 / 重连 ====================
/** 心跳包:纯文本 'ping',对应服务端 'pong'(后端这层用纯字符串约定,避免 JSON 解析开销) */