Start disappearing after sent for closed groups

This commit is contained in:
charles 2022-12-21 14:40:48 +11:00
parent 2ed271271a
commit 8f99b5aa11
2 changed files with 3 additions and 1 deletions

View File

@ -18,6 +18,7 @@ import org.session.libsession.messaging.sending_receiving.MessageReceiver
import org.session.libsession.messaging.sending_receiving.handle
import org.session.libsession.messaging.sending_receiving.handleOpenGroupReactions
import org.session.libsession.messaging.sending_receiving.handleVisibleMessage
import org.session.libsession.messaging.sending_receiving.updateExpirationConfigurationIfNeeded
import org.session.libsession.messaging.utilities.Data
import org.session.libsession.messaging.utilities.SessionId
import org.session.libsession.messaging.utilities.SodiumUtilities
@ -112,6 +113,7 @@ class BatchMessageReceiveJob(
messages.forEach { (parameters, message, proto) ->
try {
if (message is VisibleMessage) {
MessageReceiver.updateExpirationConfigurationIfNeeded(message, proto, openGroupID)
val messageId = MessageReceiver.handleVisibleMessage(message, proto, openGroupID,
runIncrement = false,
runThreadUpdate = false,

View File

@ -86,7 +86,7 @@ fun MessageReceiver.handle(message: Message, proto: SignalServiceProtos.Content,
JobQueue.shared.add(DisappearingMessagesJob())
}
fun updateExpirationConfigurationIfNeeded(message: Message, proto: SignalServiceProtos.Content, openGroupID: String?) {
fun MessageReceiver.updateExpirationConfigurationIfNeeded(message: Message, proto: SignalServiceProtos.Content, openGroupID: String?) {
val storage = MessagingModuleConfiguration.shared.storage
val disappearingState = if (proto.hasExpirationTimer()) DisappearingState.UPDATED else DisappearingState.LEGACY
storage.updateDisappearingState(message.sender!!, disappearingState)