fix: clear on updated legacy message from existing legacy thread recipient

pull/1313/head
0x330a 8 months ago
parent 56878dbd35
commit 565c92f45e
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C

@ -1774,12 +1774,17 @@ open class Storage(
disappearingState: Recipient.DisappearingState
) {
val threadDb = DatabaseComponent.get(context).threadDatabase()
val lokiDb = DatabaseComponent.get(context).lokiAPIDatabase()
val recipient = threadDb.getRecipientForThreadId(threadID) ?: return
val recipientAddress = recipient.address.serialize()
val recipientDb = DatabaseComponent.get(context).recipientDatabase()
recipientDb.setDisappearingState(recipient, disappearingState);
if (disappearingState == DisappearingState.LEGACY) {
DatabaseComponent.get(context).lokiAPIDatabase()
.setLastLegacySenderAddress(recipient.address.serialize(), messageSender)
val currentLegacyRecipient = lokiDb.getLastLegacySenderAddress(recipientAddress)
if (disappearingState == DisappearingState.LEGACY
&& ExpirationConfiguration.isNewConfigEnabled) { // only set "this person is legacy" if new config enabled
lokiDb.setLastLegacySenderAddress(recipientAddress, messageSender)
} else if (messageSender == currentLegacyRecipient) {
lokiDb.setLastLegacySenderAddress(recipientAddress, null)
}
}
}
Loading…
Cancel
Save