mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
Fix open group display name handling
This commit is contained in:
parent
d7afcd07f8
commit
38f50a6dda
@ -49,6 +49,8 @@ import androidx.annotation.DimenRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.session.libsession.messaging.contacts.Contact;
|
||||
import org.session.libsession.messaging.jobs.AttachmentDownloadJob;
|
||||
import org.session.libsession.messaging.jobs.JobQueue;
|
||||
import org.session.libsession.messaging.open_groups.OpenGroupAPIV2;
|
||||
@ -889,7 +891,15 @@ public class ConversationItem extends LinearLayout
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void setGroupMessageStatus(MessageRecord messageRecord, Recipient recipient) {
|
||||
if (groupThread && !messageRecord.isOutgoing()) {
|
||||
String displayName = recipient.toShortString();
|
||||
String sessionID = recipient.getAddress().serialize();
|
||||
Contact contact = DatabaseFactory.getSessionContactDatabase(context).getContactWithSessionID(sessionID);
|
||||
String displayName;
|
||||
if (contact != null) {
|
||||
Contact.ContactContext context = (this.conversationRecipient.isOpenGroupRecipient()) ? Contact.ContactContext.OPEN_GROUP : Contact.ContactContext.REGULAR;
|
||||
displayName = contact.displayName(context);
|
||||
} else {
|
||||
displayName = sessionID;
|
||||
}
|
||||
|
||||
this.groupSender.setText(displayName);
|
||||
|
||||
|
@ -44,7 +44,7 @@ class Contact(val sessionID: String) {
|
||||
// In open groups, where it's more likely that multiple users have the same name,
|
||||
// we display a bit of the Session ID after a user's display name for added context.
|
||||
this.name?.let {
|
||||
return "${this.name}${this.sessionID.takeLast(8)}"
|
||||
return "${this.name} (...${this.sessionID.takeLast(8)})"
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user