From f3dc4f51e1697857605c5e54581dbc93912b2028 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Wed, 11 Sep 2019 16:36:02 +1000 Subject: [PATCH] Fix group chat quote display name --- .../thoughtcrime/securesms/components/QuoteView.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/components/QuoteView.java b/src/org/thoughtcrime/securesms/components/QuoteView.java index 63f66cfa7b..ef9dccff24 100644 --- a/src/org/thoughtcrime/securesms/components/QuoteView.java +++ b/src/org/thoughtcrime/securesms/components/QuoteView.java @@ -20,8 +20,8 @@ import android.widget.TextView; import com.annimon.stream.Stream; import com.bumptech.glide.load.engine.DiskCacheStrategy; -import network.loki.messenger.R; import org.thoughtcrime.securesms.attachments.Attachment; +import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri; import org.thoughtcrime.securesms.mms.GlideRequests; import org.thoughtcrime.securesms.mms.Slide; @@ -30,9 +30,12 @@ import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.RecipientModifiedListener; import org.thoughtcrime.securesms.util.ThemeUtil; import org.thoughtcrime.securesms.util.Util; +import org.whispersystems.signalservice.loki.api.LokiGroupChatAPI; import java.util.List; +import network.loki.messenger.R; + public class QuoteView extends FrameLayout implements RecipientModifiedListener { private static final String TAG = QuoteView.class.getSimpleName(); @@ -186,8 +189,11 @@ public class QuoteView extends FrameLayout implements RecipientModifiedListener boolean outgoing = messageType != MESSAGE_TYPE_INCOMING; boolean isOwnNumber = Util.isOwnNumber(getContext(), author.getAddress()); - authorView.setText(isOwnNumber ? getContext().getString(R.string.QuoteView_you) - : author.toShortString()); + String quoteeDisplayName = author.toShortString(); + if (quoteeDisplayName.equals(author.getAddress().toString())) { + quoteeDisplayName = DatabaseFactory.getLokiUserDatabase(getContext()).getServerDisplayName(LokiGroupChatAPI.getPublicChatServer() + "." + LokiGroupChatAPI.getPublicChatServerID(), author.getAddress().toString()); + } + authorView.setText(isOwnNumber ? getContext().getString(R.string.QuoteView_you) : quoteeDisplayName); // We use the raw color resource because Android 4.x was struggling with tints here quoteBarView.setImageResource(author.getColor().toQuoteBarColorResource(getContext(), outgoing));