diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt index 39363b88e1..ebba761979 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt @@ -159,12 +159,14 @@ class EventNotificationConsumer( // the same way). // // One LocalCache lookup per event regardless of account count — - // the note is the same for every saved account. + // the note is the same for every saved account. Use the Event + // overload so AddressableEvent kinds resolve to their replaceable + // note (id-keyed version has empty replyTo after insertion). val matchingNote: Note? = if (event is WakeUpEvent) { null } else { - LocalCache.getNoteIfExists(event.id) ?: return@withWakeLock + LocalCache.getNoteIfExists(event) ?: return@withWakeLock } LocalPreferences.allSavedAccounts().forEach { savedAccount -> @@ -230,7 +232,7 @@ class EventNotificationConsumer( // RepostEvent / GenericRepostEvent aren't routed below — push doesn't // notify on reposts at all today.) if (event is ReactionEvent || event is LnZapEvent) { - val target = LocalCache.getNoteIfExists(event.id)?.replyTo?.lastOrNull() + val target = LocalCache.getNoteIfExists(event)?.replyTo?.lastOrNull() if (target != null && account.isThreadMuted(account.resolveThreadRoot(target))) return } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationDispatcher.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationDispatcher.kt index 3cc6db9d16..67407a0907 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationDispatcher.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationDispatcher.kt @@ -193,7 +193,15 @@ class NotificationDispatcher( if (event.createdAt < TimeUtils.fifteenMinutesAgo()) return@predicate false if (event is WakeUpEvent) return@predicate true - val note = LocalCache.getNoteIfExists(event.id) ?: return@predicate false + // getNoteIfExists(event) — not (event.id) — so + // AddressableEvent kinds (LongTextNote, WikiNote, + // LiveChess*, VideoHorizontal/Vertical) resolve to + // their address-keyed replaceable note. The id-keyed + // version note has its replyTo moved away during + // insertion (LocalCache.consumeBaseReplaceable), so + // tagsAnEventByUser's replyTo check would otherwise + // always miss for replies into addressable posts. + val note = LocalCache.getNoteIfExists(event) ?: return@predicate false pubkeys.any { pubkey -> event.isTaggedUser(pubkey) && NotificationFeedFilter.tagsAnEventByUser(note, pubkey)