From c1560a682841ab2c3676927158f9ac3f68b84f59 Mon Sep 17 00:00:00 2001 From: imndx Date: Wed, 16 Dec 2020 09:38:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BF=AE=E6=94=B9=E7=BE=A4?= =?UTF-8?q?=E6=98=B5=E7=A7=B0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ModifyGroupAliasNotificationContent.java | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/client/src/main/java/cn/wildfirechat/message/notification/ModifyGroupAliasNotificationContent.java b/client/src/main/java/cn/wildfirechat/message/notification/ModifyGroupAliasNotificationContent.java index 350b7ef2f..51f9b203b 100644 --- a/client/src/main/java/cn/wildfirechat/message/notification/ModifyGroupAliasNotificationContent.java +++ b/client/src/main/java/cn/wildfirechat/message/notification/ModifyGroupAliasNotificationContent.java @@ -14,6 +14,7 @@ import cn.wildfirechat.message.core.ContentTag; import cn.wildfirechat.message.core.MessagePayload; import cn.wildfirechat.message.core.PersistFlag; +import cn.wildfirechat.model.UserInfo; import cn.wildfirechat.remote.ChatManager; import static cn.wildfirechat.message.core.MessageContentType.ContentType_MODIFY_GROUP_ALIAS; @@ -35,16 +36,32 @@ public ModifyGroupAliasNotificationContent() { public String formatNotification(Message message) { StringBuilder sb = new StringBuilder(); if (fromSelf) { - sb.append("您"); + sb.append("你"); } else { - sb.append(ChatManager.Instance().getUserDisplayName(operateUser)); + UserInfo userInfo = ChatManager.Instance().getUserInfo(operateUser, groupId, false); + if (!TextUtils.isEmpty(memberId) && !TextUtils.isEmpty(userInfo.groupAlias)) { + sb.append(userInfo.groupAlias); + } else if (!TextUtils.isEmpty(userInfo.friendAlias)) { + sb.append(userInfo.friendAlias); + } else if (!TextUtils.isEmpty(userInfo.displayName)) { + sb.append(userInfo.displayName); + } else { + sb.append(operateUser); + } } sb.append("修改"); - if(!TextUtils.isEmpty(memberId) && !memberId.equals(operateUser)) { - sb.append(ChatManager.Instance().getUserDisplayName(memberId)); + if (!TextUtils.isEmpty(memberId)) { + UserInfo userInfo = ChatManager.Instance().getUserInfo(memberId, false); + if (!TextUtils.isEmpty(userInfo.friendAlias)) { + sb.append(userInfo.friendAlias); + } else if (!TextUtils.isEmpty(userInfo.displayName)) { + sb.append(userInfo.displayName); + } else { + sb.append(memberId); + } sb.append("的"); } - sb.append("群名片为"); + sb.append("群昵称为"); sb.append(alias); return sb.toString(); @@ -59,7 +76,7 @@ public MessagePayload encode() { objWrite.put("g", groupId); objWrite.put("o", operateUser); objWrite.put("n", alias); - if(!TextUtils.isEmpty(memberId)) { + if (!TextUtils.isEmpty(memberId)) { objWrite.put("m", memberId); }