Remove erroneous disappearing message validations

This commit is contained in:
andrew 2023-10-16 09:16:44 +10:30
parent 008bbd8c38
commit c24741af62
1 changed files with 0 additions and 16 deletions

View File

@ -308,28 +308,12 @@ fun MessageReceiver.updateExpiryIfNeeded(
// don't update any values for open groups
if (recipient.isOpenGroupRecipient && type != null) throw MessageReceiver.Error.InvalidMessage
if ((recipient.isGroupRecipient || recipient.isLocalNumber)
&& type == ExpirationType.DELETE_AFTER_READ) {
// don't allow deleteAfterRead if we are sending to note to self or a group, treat the entire message as invalid
throw MessageReceiver.Error.InvalidMessage
}
if (!recipient.isGroupRecipient && !recipient.isLocalNumber) {
val disappearingState = if (proto.hasExpirationType()) Recipient.DisappearingState.UPDATED else Recipient.DisappearingState.LEGACY
storage.updateDisappearingState(threadID, disappearingState)
}
// handle a delete after send expired fetch
if (type == ExpirationType.DELETE_AFTER_SEND
&& sentTime + configToUse.expiryMode.expiryMillis <= SnodeAPI.nowWithOffset) {
throw MessageReceiver.Error.ExpiredMessage
}
// handle a delete after read last known config value
if (type == ExpirationType.DELETE_AFTER_READ
&& sentTime + configToUse.expiryMode.expiryMillis <= storage.getLastSeen(threadID)) {
throw MessageReceiver.Error.ExpiredMessage
}
if (shouldUpdateConfig) {
storage.setExpirationConfiguration(configToUse)
}