mirror of
https://github.com/oxen-io/session-android.git
synced 2025-03-27 07:42:13 +00:00
Remove erroneous disappearing message validations
This commit is contained in:
parent
008bbd8c38
commit
c24741af62
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user