damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit c10ce4b1ba98e7a802a0a7c8d4f025b6fe25b571
parent 88801c276269411416ddd6c9d0165d43fc9fb006
Author: Daniel D’Aquino <daniel@daquino.me>
Date:   Fri,  1 Dec 2023 21:26:41 +0000

Do not show notifications from muted users

Muted users + unfollowed users test
------------------------------------

PASS

Device: iPhone 15 Pro simulator
iOS: 17.0.1
Damus: This commit
Setup:
- Two phones running Damus on different accounts
- Local relay with strfry-push-notify test setup
- Apple push notification test tool

Steps:
1. Unfollow the user who is the author of the saved notifications
2. Disable notifications for people you don't follow
3. Trigger a push notification (Resend push notification from test tool)
4. Ensure that the notification is not received on the other device
5. Enable notifications for people you don't follow
6. Trigger a push notification (Resend push notification from test tool)
7. Ensure that the notification is received on the other device
8. Mute the user who is the author of the saved notifications
9. Trigger a push notification (Resend push notification from test tool)
10. Ensure that the notification is not received on the other device
11. Unmute the user who is the author of the saved notifications
12. Trigger a push notification (Resend push notification from test tool)
13. Ensure that the notification is received on the other device

Result: PASS

Closes: https://github.com/damus-io/damus/issues/1705
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus/Models/NotificationsManager.swift | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/damus/Models/NotificationsManager.swift b/damus/Models/NotificationsManager.swift @@ -40,6 +40,11 @@ func should_display_notification(state: HeadlessDamusState, event ev: NostrEvent return false } + // Don't show notifications from muted users + if state.contacts.is_muted(ev.pubkey) { + return false + } + // Don't show notifications for old events guard ev.age < EVENT_MAX_AGE_FOR_NOTIFICATION else { return false