Implemented PR feedback

This commit is contained in:
Al Lansley 2024-04-19 07:43:15 +10:00
parent 3b3935f9be
commit a7e255091b

View File

@ -1378,27 +1378,24 @@ open class Storage(
return return
} }
when { // There is nothing further we need to do if this is a 1-on-1 conversation, and it's not
// Note: We don't do anything if the thread is a 1-on-1 and the recipient is a contact // possible to delete communities in this manner so bail.
// of ours (i.e., when recipient.isContactRecipient) if (recipient.isContactRecipient || recipient.isCommunityRecipient) return
recipient.isClosedGroupRecipient -> { // If we get here then this is a closed group conversation (i.e., recipient.isClosedGroupRecipient)
// TODO: handle closed group
val volatile = configFactory.convoVolatile ?: return val volatile = configFactory.convoVolatile ?: return
val groups = configFactory.userGroups ?: return val groups = configFactory.userGroups ?: return
val groupID = recipient.address.toGroupString() val groupID = recipient.address.toGroupString()
val closedGroup = getGroup(groupID) val closedGroup = getGroup(groupID)
val groupPublicKey = GroupUtil.doubleDecodeGroupId(recipient.address.serialize()) val groupPublicKey = GroupUtil.doubleDecodeGroupId(recipient.address.serialize())
if (closedGroup != null) { if (closedGroup != null) {
groupDB.delete(groupID) // TODO: Should we delete the group? (seems odd to leave it) groupDB.delete(groupID)
volatile.eraseLegacyClosedGroup(groupPublicKey) volatile.eraseLegacyClosedGroup(groupPublicKey)
groups.eraseLegacyGroup(groupPublicKey) groups.eraseLegacyGroup(groupPublicKey)
} else { } else {
Log.w("Loki-DBG", "Failed to find a closed group for ${groupPublicKey.take(4)}") Log.w("Loki-DBG", "Failed to find a closed group for ${groupPublicKey.take(4)}")
} }
} }
}
}
override fun getAttachmentDataUri(attachmentId: AttachmentId): Uri { override fun getAttachmentDataUri(attachmentId: AttachmentId): Uri {
return PartAuthority.getAttachmentDataUri(attachmentId) return PartAuthority.getAttachmentDataUri(attachmentId)