Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not show notifications if already seen #3625

Closed
1 task done
Lakoja opened this issue May 5, 2023 · 2 comments · Fixed by #3626
Closed
1 task done

Do not show notifications if already seen #3625

Lakoja opened this issue May 5, 2023 · 2 comments · Fixed by #3626
Assignees

Comments

@Lakoja
Copy link
Collaborator

Lakoja commented May 5, 2023

Notifications that were already seen in the notifications tab should not be shown as system notifications again.


@Lakoja
Copy link
Collaborator Author

Lakoja commented May 5, 2023

Technical analysis from Nik from the chat:

looking at NotificationFetcher.fetchNotifications(), that uses the marker from the API (/api/v1/markers), and account.lastNotificationId.

account.lastNotificationId will be the ID of the top-most notification the user could see when NotificationsFragment pauses (see NotificationsFragment.onPause(), and the code in the view model that handles the SaveVisiblelId action.

But the marker is never updated to reflect the ID of the most recent notification (i.e., using https://docs.joinmastodon.org/methods/markers/#create).

I think there's three bugs in NotificationFetcher.fetchNotifications().

  1. The only use of account.lastNotificationId in that code should be if fetchMarker(...) returns null. Then it's reasonable to set marker = account.lastNotificationId. This code should never set account.lastNotificationId.
  2. When it calls mastodonApi.notificationsWithAuth, the underlying API call uses since_id. That will result in missed notifications. The API call should use min_id.
  3. When the notifications have been fetched the marker should be updated (using a new API call) to reflect the ID of the newest notification. That will ensure that subsequent fetches don't fetch notifications the user has already seen.

Note that using the marker API like this means that if the user uses two clients that use the marker API then the user seeing a notification in one client will mean it won't show up as an Android notification in Tusky (it will still show up on the Notifications tab).

@nikclayton nikclayton self-assigned this May 5, 2023
@Lakoja
Copy link
Collaborator Author

Lakoja commented May 5, 2023

Notifications that were already seen in the notifications tab should not be shown as system notifications again.

One could argue that this should also be done for status shown in any other timeline. Especially replies are actually "seen" there and do not need to be reported again as system notifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants