mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Fix edit messages showing as new notifications bug.
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -160,9 +160,11 @@ object NotificationFactory {
|
||||
val threadsThatNewlyAlerted: MutableSet<ConversationId> = mutableSetOf()
|
||||
|
||||
state.conversations.forEach { conversation ->
|
||||
if (conversation.thread == visibleThread && conversation.hasNewNotifications()) {
|
||||
Log.internal().i(TAG, "Thread is visible, notifying in thread. notificationId: ${conversation.notificationId}")
|
||||
notifyInThread(context, conversation.recipient, lastAudibleNotification)
|
||||
if (conversation.thread == visibleThread) {
|
||||
if (conversation.hasNewNotifications()) {
|
||||
Log.internal().i(TAG, "Thread is visible, notifying in thread. notificationId: ${conversation.notificationId}")
|
||||
notifyInThread(context, conversation.recipient, lastAudibleNotification)
|
||||
}
|
||||
} else if (notificationConfigurationChanged || conversation.hasNewNotifications() || alertOverrides.contains(conversation.thread) || !conversation.hasSameContent(previousState.getConversation(conversation.thread))) {
|
||||
if (conversation.hasNewNotifications()) {
|
||||
threadsThatNewlyAlerted += conversation.thread
|
||||
|
||||
Reference in New Issue
Block a user