change call messages and data extraction notification to be DaR if needed

pull/731/head
Ryan ZHAO 6 months ago
parent 9231f57636
commit 084586e6ba

@ -477,6 +477,16 @@ public extension Interaction {
)
}
func withDisappearAfterReadIfNeeded(_ db: Database) -> Interaction {
if let config = try? DisappearingMessagesConfiguration.fetchOne(db, id: self.threadId) {
return self.withDisappearingMessagesConfiguration(
config: config.with(type: .disappearAfterRead)
)
}
return self
}
func withDisappearingMessagesConfiguration(_ db: Database) -> Interaction {
if let config = try? DisappearingMessagesConfiguration.fetchOne(db, id: self.threadId) {
return self.withDisappearingMessagesConfiguration(config: config)

@ -230,7 +230,7 @@ extension MessageReceiver {
openGroup: nil
)
)
.withDisappearingMessagesConfiguration(db) // Should follow local setting
.withDisappearAfterReadIfNeeded(db) // Should follow local timer with disappear after read
.inserted(db)
MessageSender.sendImmediate(
@ -304,7 +304,7 @@ extension MessageReceiver {
openGroup: nil
)
)
.withDisappearingMessagesConfiguration(db) // Should follow local setting
.withDisappearAfterReadIfNeeded(db) // Should follow local timer with disappear after read
.inserted(db)
}
}

@ -41,7 +41,7 @@ extension MessageReceiver {
openGroup: nil
)
)
.withDisappearingMessagesConfiguration(db) // Should follow local setting
.withDisappearAfterReadIfNeeded(db) // Should follow local timer with disappear after read
.inserted(db)
}
}

@ -200,7 +200,15 @@ extension MessageReceiver {
switch threadVariant {
case .legacyGroup:
if localConfig != remoteConfig {
// Only change the config when it is changed from the admin
if localConfig != remoteConfig &&
(try? GroupMember
.filter(GroupMember.Columns.groupId == threadId)
.filter(GroupMember.Columns.profileId == sender)
.select(GroupMember.Columns.role)
.asRequest(of: GroupMember.Role.self)
.fetchOne(db)) == .admin
{
_ = try remoteConfig.save(db)
try SessionUtil

Loading…
Cancel
Save