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

Duplicate/similar web notifications sent #7902

Closed
2 tasks done
trwnh opened this issue Jun 27, 2018 · 5 comments
Closed
2 tasks done

Duplicate/similar web notifications sent #7902

trwnh opened this issue Jun 27, 2018 · 5 comments

Comments

@trwnh
Copy link
Member

trwnh commented Jun 27, 2018

image

Follow and mention notifications are being sent twice, with slightly different text:

Mentions:

  • "x mentioned you"
  • "you were mentioned by x"

Follows:

  • "x followed you"
  • "x is now following you"

  • I searched or browsed the repo’s other issues to ensure this is not a duplicate.
  • This bug happens on v2.4.2 and not on master (If you're a user, don't worry about this).
@renatolond
Copy link
Contributor

I have the same, also in v2.4.2.

@ClearlyClaire
Copy link
Contributor

ClearlyClaire commented Aug 23, 2018

This has been bugging me for a long time, but I finally understand what's going on.
When the Service Worker receives a push event, it generates a notification.
However, that notification may have sub-par formatting, incomplete information, etc., so the code fetches the missing bits to craft a better notification.

This behavior was introduced in 4b94e9c.

So I guess we have to replace the notification without triggering a new one, if that's possible at all.

EDIT: That's what the tag attribute, already used, should do. So either there is a bug in the browser, or something else is going on.
EDIT2: Well, the tag attribute replaces the notification if it's still there, but will show a new notification if the previous one was discarded!

@renatolond
Copy link
Contributor

renatolond commented Aug 23, 2018

Hm, this discarded situation is weird, I have a pebble and what I see is this:

A first notification arrives, in the format of notification_mailer.favourite.subject. Then, almost immediately, I get a second one in the format of notification.favourite. If I turn on the phone, I indeed see only the second one. But it seems to get weird when the notifications collapse, at that point I start to see both.

@ClearlyClaire
Copy link
Contributor

That looks like a bug in the browser, the first notification should be entirely discarded. And it should also not re-notify… I wonder if some properties changing between the two versions cause that…

Alternatively, we could postpone displaying a notification to when the subsequent API call returns…

@renatolond
Copy link
Contributor

It seems the push example by google postpones until the API answers:
https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web#a_more_complete_push_event_example

ClearlyClaire added a commit to ClearlyClaire/mastodon that referenced this issue Aug 23, 2018
kyori19 pushed a commit to kyori19/mastodon that referenced this issue Sep 20, 2018
…) (mastodon#8396)

* Only display web push notifications after API call (fixes mastodon#7902)

* Decode then truncate instead of truncating then decoding in webpush serializer
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

No branches or pull requests

3 participants