Skip to content

Conversation

@alltheseas
Copy link
Collaborator

@alltheseas alltheseas commented Dec 18, 2025

Summary

Fixes repost notifications not appearing in the notifications tab. The root cause was that the home feed deduplication logic for reposts was incorrectly placed before the context switch in handle_text_event(), causing notification events to be filtered out when the same note had already been reposted in the home feed.

This fix moves the dedup logic inside the .home case where it belongs. Notifications should always show reposts of YOUR posts, even if the same note was already reposted by someone else in your home feed.

Changes

  1. HomeModel.swift: Moved repost dedup logic inside .home switch case with guard clause (nevernesting pattern)
  2. RepostNotificationTests.swift: Added 4 regression tests to prevent this bug from recurring

Checklist

Standard PR Checklist

  • I have read (or I am familiar with) the Contribution Guidelines
  • I have tested the changes in this PR
  • I have profiled the changes to ensure there are no performance regressions, or I do not need to profile the changes.
    • Not needed: This is a control flow fix moving existing code inside a switch case - no new computations added
  • I have opened or referred to an existing github issue related to this change: repost notifications broken #3165
  • My PR is either small, or I have split it into smaller logical commits that are easier to review
  • I have added the signoff line to all my commits. See Signing off your work
  • I have added appropriate changelog entries for the changes in this PR. See Adding changelog entries
  • I have added appropriate Closes: or Fixes: tags in the commit messages wherever applicable, or made sure those are not needed. See Submitting patches

Test report

Device: iPhone 17 Pro Simulator

iOS: iOS 26.0

Damus: Commit 3ac9e1b (this PR)

Setup: Test account with reposts of authored notes

Steps:

  1. Created test notes from test account
  2. Had another account repost the test notes
  3. Verified reposts appear in Home feed (dedup working)
  4. Verified same reposts appear in Notifications tab (fix working)
  5. Ran all 4 new unit tests - all pass

Results:

  • PASS

screenshot

Screenshot 2025-12-17 at 10 10 20 PM

Other notes

  • Root cause: commit bed4e00 added home feed dedup but placed the logic before the context switch, affecting all contexts instead of just home
  • Quote post notifications are a separate issue tracked in a follow-up quote notifications are broken #3447 (different root cause - requires #q filter implementation)
  • The fix uses guard clause (nevernesting pattern) for cleaner control flow
  • Added comprehensive code comments explaining why dedup must remain inside .home case

Closes #3165

The repost deduplication logic was incorrectly placed before the context
switch in handle_text_event(), causing notification events to be filtered
out when the same note had already been reposted in the home feed.

This fix moves the dedup logic inside the .home case where it belongs.
Notifications should always show reposts of YOUR posts, even if the same
note was already reposted by someone else in your home feed.

Root cause: commit bed4e00 added home feed dedup but placed the logic
before the context switch, affecting all contexts instead of just home.

Note on nostrdb: This bug is purely in application routing logic and
does not require database-level changes. The existing nostrdb TODO
(about inner event validation) is unrelated to this notification issue.

Changelog-Fixed: Fixed repost notifications not appearing in notifications tab

Closes damus-io#3165

Signed-off-by: alltheseas
Adds comprehensive tests to prevent regression of issue damus-io#3165 where
repost notifications were incorrectly blocked by home feed deduplication.

Tests cover:
- Regression test: notifications not blocked by home dedup (main fix)
- Home feed deduplication still works correctly
- Dedup tracks inner event ID, not repost event ID
- Context isolation (.other context doesn't affect dedup)

Each test documents the expected behavior and provides clear failure
messages to aid debugging if the bug reoccurs.

Signed-off-by: alltheseas
@alltheseas alltheseas added bug Something is not working, or not working as intended notifications reposts Quote reposts, reposts, etc labels Dec 18, 2025
@danieldaquino danieldaquino added the pr-in-queue This PR is waiting in a queue behind their other PRs marked with the label `pr-active-review`. label Dec 20, 2025
Copy link
Collaborator

jb55 commented Jan 6, 2026

thanks! i merged this into my staging branch

jb55 added a commit that referenced this pull request Jan 6, 2026
@jb55 jb55 closed this in d27d4e6 Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is not working, or not working as intended notifications pr-in-queue This PR is waiting in a queue behind their other PRs marked with the label `pr-active-review`. reposts Quote reposts, reposts, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repost notifications broken

3 participants