mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-08 03:54:29 +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
|
// don't update any values for open groups
|
||||||
if (recipient.isOpenGroupRecipient && type != null) throw MessageReceiver.Error.InvalidMessage
|
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) {
|
if (!recipient.isGroupRecipient && !recipient.isLocalNumber) {
|
||||||
val disappearingState = if (proto.hasExpirationType()) Recipient.DisappearingState.UPDATED else Recipient.DisappearingState.LEGACY
|
val disappearingState = if (proto.hasExpirationType()) Recipient.DisappearingState.UPDATED else Recipient.DisappearingState.LEGACY
|
||||||
storage.updateDisappearingState(threadID, disappearingState)
|
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) {
|
if (shouldUpdateConfig) {
|
||||||
storage.setExpirationConfiguration(configToUse)
|
storage.setExpirationConfiguration(configToUse)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user