diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/model/ThreadRecord.java b/app/src/main/java/org/thoughtcrime/securesms/database/model/ThreadRecord.java index 08b375781d..90bba49d28 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/model/ThreadRecord.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/model/ThreadRecord.java @@ -126,17 +126,9 @@ public class ThreadRecord extends DisplayRecord { @Override public CharSequence getDisplayBody(@NonNull Context context) { if (isGroupUpdateMessage()) { - String body = getBody(); - if (!body.isEmpty()) { - UpdateMessageData updateMessageData = UpdateMessageData.fromJSON(body); - if (updateMessageData != null) { - return UpdateMessageBuilder.buildGroupUpdateMessage(context, updateMessageData, null, isOutgoing(), false) - .toString(); - } else { - return null; - } - } - return context.getString(R.string.groupUpdated); + return lastMessage != null + ? lastMessage.getDisplayBody(context).toString() + : context.getString(R.string.groupUpdated); } else if (isOpenGroupInvitation()) { return context.getString(R.string.communityInvitation); } else if (MmsSmsColumns.Types.isLegacyType(type)) { @@ -159,22 +151,8 @@ public class ThreadRecord extends DisplayRecord { .put(NAME_KEY, getName()) .format().toString(); } else if (SmsDatabase.Types.isExpirationTimerUpdate(type)) { - int seconds = (int) (getExpiresIn() / 1000); - if (seconds <= 0) { - return Phrase.from(context, R.string.disappearingMessagesTurnedOff) - .put(NAME_KEY, getName()) - .format().toString(); - } - - // Implied that disappearing messages is enabled.. - String time = ExpirationUtil.getExpirationDisplayValue(context, seconds); - String disappearAfterWhat = getDisappearingMsgExpiryTypeString(context); // Disappear after send or read? - return Phrase.from(context, R.string.disappearingMessagesSet) - .put(NAME_KEY, getName()) - .put(TIME_KEY, time) - .put(DISAPPEARING_MESSAGES_TYPE_KEY, disappearAfterWhat) - .format().toString(); - + // Remove formatting on the message by calling .getString() on the SpannableString + return lastMessage != null ? lastMessage.getDisplayBody(context).toString() : null; } else if (MmsSmsColumns.Types.isMediaSavedExtraction(type)) { return Phrase.from(context, R.string.attachmentsMediaSaved) .put(NAME_KEY, getName()) diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/ExpiringMessageManager.kt b/app/src/main/java/org/thoughtcrime/securesms/service/ExpiringMessageManager.kt index c1795f8f0c..ce9638db44 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/ExpiringMessageManager.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/service/ExpiringMessageManager.kt @@ -126,9 +126,11 @@ class ExpiringMessageManager(context: Context) : MessageExpirationManagerProtoco val groupId = message.groupPublicKey val duration = message.expiryMode.expiryMillis try { - val serializedAddress = groupId?.let(::doubleEncodeGroupID) - ?: message.syncTarget?.takeIf { it.isNotEmpty() } - ?: message.recipient!! + val serializedAddress = when { + groupId == null -> message.syncTarget ?: message.recipient!! + groupId.startsWith(IdPrefix.GROUP.value) -> groupId + else -> doubleEncodeGroupID(groupId) + } val address = fromSerialized(serializedAddress) val recipient = Recipient.from(context, address, false)