element-meta icon indicating copy to clipboard operation
element-meta copied to clipboard

Don't send push notifications to users who are clearly active on a device

Open dbkr opened this issue 9 years ago • 41 comments

This is a bug to track the various different bugs related to aspects of tracking what we've seen/read between clients:

High priority:

  • [x] accurate synchronised unread state per-room (ie. number of regular messages unread or in vector, room boldness) (critical);
  • [x] accurate highlight state per-room (subset of notif counts) (hopefully we have it already);
  • [x] accurate badge counts on the favicon of the client

Lower priority:

  • [x] accurate notification counts per-room (not that we show them in the UI currently, so it could be skipped)
  • [x] self-read-up-to-marker
  • [x] jumping to arbitrary message offsets (unrelated, basically)
  • [x] push notification badge counts (not a blocker for v0)
  • [ ] synchronising whether you push a user with whether they are currently active on a device, or have sent a read receipt, or whatever (not a blocker for v0)

Also need to show highlights somehow for rooms that are scrolled out of view on the RoomList or in a collapsed RoomSubList.

Immediate priorities: Tracking unread per room, tracking highlights per room, ensuring they are synchronised between clients, and maintaining a favicon badge

App specific issues

  • [ ] https://github.com/vector-im/element-android/issues/3855

dbkr avatar Dec 03 '15 17:12 dbkr

What we need now for the unread / bing counts:

  • Unread notification count per room in event stream
  • Notification actions attached to each event in event stream

dbkr avatar Dec 04 '15 11:12 dbkr

One other aspect here could be only setting reset pushes for messages that you know the user has actually read. E.g. if I read messages in one room, I expect them to disappear from my list of mobile pushes. But it's unintuitive if other messages I haven't read yet then disappear from my mobile push list.

ara4n avatar Dec 09 '15 13:12 ara4n

Note that APNS has no concept of a reset push for a message: you can set the badge count to zero which causes all the notifications to disappear, otherwise they all stay.

dbkr avatar Dec 09 '15 13:12 dbkr

https://matrix.org/jira/browse/SPEC-303 tracks how we decide whether a given room is unread

dbkr avatar Dec 14 '15 13:12 dbkr

[Matthew] so: suggestion is that we handle 3 different custom room states in vector-web: unread, notify and highlight unread is calculated on the client, and would make the room title go black & bold. the rules for what message types count as unread are hardcoded for now (everything except for: membership changes, call candidates/hangup, and m.notify?) but in future could be defined as part of the pushrules. notify == event you would be pushed for. these make room title go green and bold. highlight == event you would be highlighted for. these make the room title go red and bold by default highlighting are messages which reference you by name, or are 1:1 you can also configure custom things to cause a 'highlight' in push rules, as we do already today. finally, we either track 'badge counts' for notify or highlight events. and this is done serverside to avoid having to shove loads of explicit notify/highlight events down the eventstream by default 1:1 convos would be highlit already. so additional highlights within that convo would do nothing, unless you somehow turn off highlighting for your 1:1s, which presumably could be a configuration option via push rules. so the only open question, assuming Amandine agrees with this, is whether badge counts should show highlights (aka mentions) or notifies. for now, i suggest badge counts show the number of pending notifies, but we perhaps make it configurable in future depending on how it feels. as intuitively I really think that I expect the badge count on an app to show me the number of pushes i've missed rather than the number of i've missed. "missed pushes" is basically how FB and Twitter do it, aiui.

[Amandine] ok, and let's see because I suspect it can really become useless at some point [Matthew] quite possibly. but it should be trivial to change [Dave] what amandine's suggesting is essentially a count of things which are directed at you personally, or individual events you've asked to be called out [Amandine] but agreed athat "number of pushes I missed" is a clear explanation

ara4n avatar Dec 15 '15 14:12 ara4n

deprioritising from p1 to p2 as the 'jump to old read receipt' behaviour isn't a hard hard blocker on v0

ara4n avatar Jan 13 '16 15:01 ara4n

Badge counts are fixed on https://github.com/matrix-org/synapse/tree/push_badge_counts but requires the new notification code which is currently disabled.

dbkr avatar Jan 14 '16 16:01 dbkr

Should this still be v0?

dbkr avatar Mar 07 '16 17:03 dbkr

vector-im/element-web#3432 has some discussion also

t3chguy avatar May 27 '17 18:05 t3chguy

What are the current rules regarding active users and notifications?

I seem to have issue where a recently active user does not get a notification even though their app is closed.

oliverjanik avatar Jun 04 '19 02:06 oliverjanik

what is the current status of how push notifications are synced across devices? From December 2018 to around March 2019, my company hosted its own matrix servers (my apologies for not knowing the version numbers) and this was how I was introduced to matrix for the first time. I absolutely loved that when I read a private message on any of the desktop clients (including the web one), the push notification pop-up on my iOS lockscreen would vanish. Ever since we updated servers, and then eventually moved to modular.im hosting, this awesome feature has been missing. If I chat with someone on my desktop, I'll later find my phone has 10s to 100s of unread push notifications from our conversation (not in the client, but the OS-level push notification queue).

Logicwax avatar May 13 '20 05:05 Logicwax

A few friends of mine are trying the matrix stack to evaluate if we move to it or not... and notifications not being cleared when read on another client is a huge problem. This will get annoing very fast. Currently we are using synapse 1.17.0, riot web 1.7.2 and riot android 1.0.4.

What @Logicwax described as the former behavior would be the "we want that" state. Similar to how telegram behaves. :)

Faldrian avatar Aug 10 '20 11:08 Faldrian

Just like @Faldrian commented - I am in the same boat. I'm trying to move over to the matrix stack, but having to mute riot android every time I'm communicating on the desktop app is a severe regression over Signal, which I'm currently using.

jesanfafon avatar Aug 30 '20 15:08 jesanfafon

Re @Faldrian

and notifications not being cleared when read on another client is a huge problem.

I filed issue vector-im/element-web#16026, notifications just never get cleared by element web (either when you read in the same client or another client), It was a 1 liner fix.

amstan avatar Dec 26 '20 05:12 amstan

There seems to be a constant tickle of dup bugs to this one, despite being quite an old bug. As a new user I found this behavior quite jarring, to the point where i might not want to use matrix. I don't want all my other devices to keep beeping while i'm actively chatting on one of them.

BTW: I would rename this bug, there's no "push notifications" going on in element, they're just normal notifications. See https://github.com/vector-im/element-web/issues/604 on why

As far as I can tell, the easiest way to fix this would just be to delay(maybe 30s) notifications on all inactive devices, then:

  • If such devices see a read reciept from the active device, they'll cancel their timeout and not notify.
  • If the active device didn't read the message, the timeouts will expire and they'll all beep.

The active device should do notifications regardless (as long as the user is not obviously paying attention). That's what https://github.com/amstan/matrix-react-sdk/commit/cdb4ce42fec9c7cf0e660a987d23682f814cdf10 is supposed to address.

I discussed this with @turt2live and @teknikaldomain the other day on matrix, it seemed pretty straight forward.

But I'm quite stuck (near the end ironically), what I think of active and non-active are quite different than what the code considers them.

@dbkr Essentially the moment the window is unfocused, no matter how much time elapsed since user activity, userActiveRecently will return false. Which I feel like it's wrong philosophically. So I tried changing it, blur should not make userActiveRecently false.

But then notifications get ignored if the user was actively recently, which is also wrong. What if i do have the browser minimized? So that needs another change, we should only ignore the notification if we know the user is actively staring, not 3 min gone.

After my changes, it kind of works, but ever since i changed userActiveRecently behavoir, i see signs of https://github.com/vector-im/element-web/issues/9023 again. No idea why that happens, I feel like there's another bug there that got hidden by https://github.com/matrix-org/matrix-react-sdk/pull/2770. I also can't get userActiveNow to ever turn False after my small changes.

What i'm essentially saying is that element and/or matrix-react-sdk needs to diambiguate between a device the user is nowhere near (eg, a laptop in another room) and a device in front of the user (let's say he's watching a youtube video) but with element minimized. This is what I feel userActiveRecently should represent.

amstan avatar Dec 26 '20 06:12 amstan

BTW: I would rename this bug, there's no "push notifications" going on in element, they're just normal notifications.

@amstan I think this is a tracking issue for not showing notifications on other devices (including mobile) if a user is active. Please correct me if I'm wrong (and point me to a relevant issue).

Relatedly though it'd be good for element-web to not show notifications for the currently focused room, but I seem to recall another tracking issue or a pull request to fix that behaviour already.

auscompgeek avatar Dec 26 '20 10:12 auscompgeek

BTW: I would rename this bug, there's no "push notifications" going on in element, they're just normal notifications.

This sentence is mostly concerned with the word "push". Element doesn't implement push notifications, so to say there's a bug about them doesn't make sense.

@amstan I think this is a tracking issue for not showing notifications on other devices (including mobile) if a user is active. Please correct me if I'm wrong (and point me to a relevant issue).

Correct, that's what my commit is attempting to fix. But one element instance knowing the other's active status in order to decide to notifify is not compulsory, one can fix the same problem by just adding delays if the one electron instance thinks it's inactive.

Relatedly though it'd be good for element-web to not show notifications for the currently focused room, but I seem to recall another tracking issue or a pull request to fix that behaviour already.

I don't know much about that (besides my commit having to tackle some of it, but i mostly copied the rest of the code). I'd be happy if the double notifications from other devices stopped first.

amstan avatar Dec 26 '20 20:12 amstan

I agree with @amstan - this is a real blocker to use as a corporate grade messenger. Slack, Teams and Skype can do it, dumb Telegram - do not.

alexei-g-aloteq avatar Jan 21 '21 09:01 alexei-g-aloteq

+1 for @amstan's feature. Whether they are called "push notifications" or not is just semantics. When you're sitting at a PC having an active conversation in Element, it would be great not to have the phone buzzing off the hook every time a message is received. It would be ideal for the mobile client to be aware of the activity on the desktop client and suppress its alerts when the desktop client is active and engaged in a conversation. I have at least 3 users on my network who have asked about this kind of feature.

ufgkirk avatar Apr 13 '21 20:04 ufgkirk

I tried to migrate couple of users to the matrix im. The ones who actually use it, and install it on the phone and laptop are very bothered that the notifications goes on for every message they receive on the phone, while typing on the pc. This problem is even worse when a user have an apple watch.

I'm trying to provide a workaround for them, or they will simply leave matrix. The only thing I can come up with, is to turn off the notifications on mobile/watch. But is sounds like a disaster when they will miss something important.

Is there a better way to handle that?

pszypowicz avatar Oct 18 '21 09:10 pszypowicz

I wanted to leave my 5 cents additionally here :)

https://www.bountysource.com/issues/28824980-don-t-send-push-notifications-to-users-who-are-clearly-active-on-a-device

There is a bountysource available from now on!

pszypowicz avatar Oct 27 '21 18:10 pszypowicz

This is the most problematic issue for me at the moment. I have to keep silencing my phone because otherwise it just drives me crazy. Really wondering how difficult it would be to resolve this?

aethralis avatar Nov 05 '21 16:11 aethralis

Doubled the bounty myself as this is the most problematic issue for most users. Thanks in advance

rbuddy101 avatar Dec 09 '21 04:12 rbuddy101

Any updates on this? I'm confident it is possible to resolve this if enough energy is directed towards the issue. We're literally being chased by 7 year old bug, as if it were a ghost!

rwjack avatar Jun 18 '22 13:06 rwjack

Yeah this is a big problem for me, extremely annoying to a sound sensitive person like myself to be chatting on the computer with someone and their responses are making my phone beep at me.

(also I think there should be a short delay + roll up period, so if someone types many short messages in quick succession, you only get one sound for notification instead of 5 or 6 or whatever... but that's another issue)

kellyclowers avatar Jul 20 '22 23:07 kellyclowers

We're at $230 USD.

https://app.bountysource.com/issues/28824980-don-t-send-push-notifications-to-users-who-are-clearly-active-on-a-device

image

Cyberes avatar Mar 07 '23 19:03 Cyberes

image

rwjack avatar Mar 26 '23 17:03 rwjack

Wow.. the issue is nearly 8 Years old and still unresolved...

And it still makes the user experience awful..

ghost avatar Apr 19 '23 21:04 ghost

Why is this S-Minor? You are a messenger, getting notifications right is an important requirement don't you think? Teams and Slack do this right.

dtheodor avatar May 04 '23 21:05 dtheodor

After convincing my upper management, to try out matrix, to replace our current messenger, I got most of the things working as people expected. (well after convincing everyone that gif's were not business critical feature )

But this here is a deal breaker. Given everyone has at least phone and laptop, where they want to access such messages, constant notifications drives everyone insane. And I haven't even integrated ticketing system into matrix jet.

Will have to put migration on hold until this is fixed, or better client for matrix comes along.

marinkol avatar May 08 '23 13:05 marinkol