Fix scheduled message changing disappearing messages bug.

main
Cody Henthorne 2023-03-06 09:47:12 -05:00 zatwierdzone przez GitHub
rodzic 33ab25a557
commit 6e8f3d1e71
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 15 dodań i 1 usunięć

Wyświetl plik

@ -42,6 +42,9 @@
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value />
</option>
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
</JetCodeStyleSettings>

Wyświetl plik

@ -24,6 +24,7 @@ import org.signal.core.util.optionalString
import org.signal.core.util.or
import org.signal.core.util.readToSet
import org.signal.core.util.readToSingleBoolean
import org.signal.core.util.readToSingleLong
import org.signal.core.util.requireBlob
import org.signal.core.util.requireBoolean
import org.signal.core.util.requireInt
@ -3625,6 +3626,15 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
}
}
fun getExpiresInSeconds(id: RecipientId): Long {
return readableDatabase
.select(MESSAGE_EXPIRATION_TIME)
.from(TABLE_NAME)
.where(ID_WHERE, id)
.run()
.readToSingleLong(0L)
}
/**
* Will update the database with the content values you specified. It will make an intelligent
* query such that this will only return true if a row was *actually* updated.

Wyświetl plik

@ -54,7 +54,8 @@ class ScheduledMessageManager(
override fun executeEvent(event: Event) {
val scheduledMessagesToSend = messagesTable.getScheduledMessagesBefore(System.currentTimeMillis())
for (record in scheduledMessagesToSend) {
if (messagesTable.clearScheduledStatus(record.threadId, record.id, record.recipient.expiresInSeconds.seconds.inWholeMilliseconds)) {
val expiresIn = SignalDatabase.recipients.getExpiresInSeconds(record.recipient.id)
if (messagesTable.clearScheduledStatus(record.threadId, record.id, expiresIn.seconds.inWholeMilliseconds)) {
if (record.recipient.isPushGroup) {
PushGroupSendJob.enqueue(application, ApplicationDependencies.getJobManager(), record.id, record.recipient.id, emptySet(), true)
} else {