fix an issue for legacy groups disappearing message update control message
This commit is contained in:
parent
8c2491712e
commit
74efe8cc72
|
@ -482,10 +482,12 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel, Naviga
|
|||
_ = try Interaction
|
||||
.filter(Interaction.Columns.threadId == threadId)
|
||||
.filter(Interaction.Columns.variant == Interaction.Variant.infoDisappearingMessagesUpdate)
|
||||
.filter(Interaction.Columns.authorId == userPublicKey)
|
||||
.filter(Interaction.Columns.authorId == userPublicKey) // FIXME: Remove all in legacy groups
|
||||
.deleteAll(db)
|
||||
}
|
||||
|
||||
let currentTimestampMs: Int64 = SnodeAPI.currentOffsetTimestampMs()
|
||||
|
||||
let interaction: Interaction = try Interaction(
|
||||
threadId: threadId,
|
||||
authorId: userPublicKey,
|
||||
|
@ -495,7 +497,9 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel, Naviga
|
|||
senderName: nil,
|
||||
isPreviousOff: !self.config.isEnabled
|
||||
),
|
||||
timestampMs: SnodeAPI.currentOffsetTimestampMs()
|
||||
timestampMs: currentTimestampMs,
|
||||
expiresInSeconds: updatedConfig.durationSeconds,
|
||||
expiresStartedAtMs: (updatedConfig.type == .disappearAfterSend ? Double(currentTimestampMs) : nil)
|
||||
)
|
||||
.inserted(db)
|
||||
|
||||
|
|
|
@ -373,22 +373,6 @@ public struct Interaction: Codable, Identifiable, Equatable, FetchableRecord, Mu
|
|||
// Automatically mark interactions which can't be unread as read so the unread count
|
||||
// isn't impacted
|
||||
self.wasRead = (self.wasRead || !self.variant.canBeUnread)
|
||||
|
||||
// Automatically add disapeparing messages configuration
|
||||
if self.variant.shouldFollowDisappearingMessagesConfiguration,
|
||||
self.expiresInSeconds == nil,
|
||||
self.expiresStartedAtMs == nil
|
||||
{
|
||||
guard
|
||||
let disappearingMessagesConfiguration = try? DisappearingMessagesConfiguration.fetchOne(db, id: self.threadId),
|
||||
disappearingMessagesConfiguration.isEnabled
|
||||
else {
|
||||
self.expiresInSeconds = 0
|
||||
return
|
||||
}
|
||||
|
||||
self.expiresInSeconds = disappearingMessagesConfiguration.durationSeconds
|
||||
}
|
||||
}
|
||||
|
||||
public func aroundInsert(_ db: Database, insert: () throws -> InsertionSuccess) throws {
|
||||
|
|
|
@ -208,7 +208,6 @@ extension MessageReceiver {
|
|||
localConfig: localConfig,
|
||||
remoteConfig: remoteConfig
|
||||
)
|
||||
|
||||
default:
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue