Fix #3468 - Timed Mute (#3544)

This commit is contained in:
Dane Evans 2025-10-30 16:48:06 +11:00 committed by GitHub
parent c482bd0aaf
commit 54104b00ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 77 additions and 4 deletions

View file

@ -230,8 +230,18 @@ interface PacketDao {
suspend fun setMuteUntil(contacts: List<String>, until: Long) {
val contactList =
contacts.map { contact ->
getContactSettings(contact)?.copy(muteUntil = until)
?: ContactSettings(contact_key = contact, muteUntil = until)
// Always mute
val absoluteMuteUntil =
if (until == Long.MAX_VALUE) {
Long.MAX_VALUE
} else if (until == 0L) { // unmute
0L
} else {
System.currentTimeMillis() + until
}
getContactSettings(contact)?.copy(muteUntil = absoluteMuteUntil)
?: ContactSettings(contact_key = contact, muteUntil = absoluteMuteUntil)
}
upsertContactSettings(contactList)
}