Fix edit messages showing as new notifications bug.

This commit is contained in:
Cody Henthorne
2025-07-01 12:57:44 -04:00
committed by GitHub
parent 939f2f82b1
commit 6aab622c96
2 changed files with 18 additions and 5 deletions

View File

@@ -2232,7 +2232,7 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
NOTIFIED to 1,
REACTIONS_LAST_SEEN to System.currentTimeMillis()
)
.where("$ID = ?", id)
.where("$ID = ? OR $ORIGINAL_MESSAGE_ID = ? OR $LATEST_REVISION_ID = ?", id, id, id)
.run()
}
@@ -2710,6 +2710,17 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
contentValues.put(QUOTE_AUTHOR, 0)
}
if (editedMessage != null) {
val notified = readableDatabase
.select(NOTIFIED)
.from(TABLE_NAME)
.where(ID_WHERE, editedMessage.id)
.run()
.readToSingleInt(0)
contentValues.put(NOTIFIED, notified.toInt())
}
val (messageId, insertedAttachments) = insertMediaMessage(
threadId = threadId,
body = retrieved.body,
@@ -4876,7 +4887,7 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
AND $STORY_TYPE = 0
AND $LATEST_REVISION_ID IS NULL
AND (
$READ = 0
($READ = 0 AND ($ORIGINAL_MESSAGE_ID IS NULL OR EXISTS (SELECT 1 FROM $TABLE_NAME AS m WHERE m.$ID = $TABLE_NAME.$ORIGINAL_MESSAGE_ID AND m.$READ = 0)))
OR $REACTIONS_UNREAD = 1
${if (stickyQuery.isNotEmpty()) "OR ($stickyQuery)" else ""}
OR ($IS_MISSED_CALL_TYPE_CLAUSE AND EXISTS (SELECT 1 FROM ${CallTable.TABLE_NAME} WHERE ${CallTable.MESSAGE_ID} = $TABLE_NAME.$ID AND ${CallTable.EVENT} = ${CallTable.Event.serialize(CallTable.Event.MISSED)} AND ${CallTable.READ} = 0))