Currently, the only way you will ever get a push notification is if your connection is considered "away". (This is different from your status. Basically, it's controlled by how long it's been since you last interacted with anything.)
My suggestion is to make the logic instead work like this:
We may also want an option for the current behavior: "Do not send a notification if I have been active in the last X minutes."
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Until this feature gets added, I found a workaround to get notifications regardless of your status.
Change the following lines in Rocket.Chat/programs/server/packages/rocketchat_lib.js
1373 if (Push.enabled === true && userOfMention.statusConnection !== 'online') {
to
1373 if (Push.enabled === true) {
1490 if (user.statusConnection !== 'online' && (ref4 = user._id, indexOf.call(settings.dontNotifyMobileUsers, ref4) < 0)) {
to
1490 if ((ref4 = user._id, indexOf.call(settings.dontNotifyMobileUsers, ref4) < 0)) {
The line numbers may change by version. Those line numbers are from 0.34.0.
Thank you, we have also applied this patch.
Our users were confused, when they get notifications in groups. The current logic is "too intelligent".
Ideally we have an option for getting push notifications, even when online with another device.
The drawback of this patch is, that you get even notifications of your own messages.
Great, I assume this should make the patch obsolete, which some have applied: https://github.com/RocketChat/Rocket.Chat/issues/1602#issuecomment-226559485?
Our users want to be able to get notifications always on the mobile device, even if also notified on the desktop.
We need to turn this into a setting
Thank you very much for this patch. Here are the updated line numbers for version 0.48.2:
1611 and 1732.
I agree that this should be configurable. In our case users will frequently leave their desk to visit clients without logging out and they will want to get push notifications anyway.
Push patch for RC 0.56 in /var/lib/rocket.chat/bundle/programs/server/packages/rocketchat_lib.js line 1821:
```
if (userOfMention != null && canBeNotified(userOfMentionId, 'desktop')) { // 149
// if (Push.enabled === true && userOfMention.statusConnection !== 'online') { // 150
// Push patch - pushes always ucom issue #115
line 2000:
userIdsToPushNotify = _.pluck(_.filter(usersOfMobileMentions, function (user) { // 291
// return user.statusConnection !== 'online'; // 292
// always send push
return true;
}), '_id'); // 293
}
```
We should have a setting for
UserPresence.awayTime = 300000;
which is a Meteor.startup(function() in client/startup/startup.js
and reduce it to 10 seconds as default = 10000;
@rodrigok In the end, you just decided not to implement this improvement?
Because it is very uncomfortable to receive push on the phone when you have read the messages on the desktop.
I looked for the described functionality about "If a message .. has not been read in X minutes, send a push notification.", but I could not find it, although the problem is closed.
Most helpful comment
Until this feature gets added, I found a workaround to get notifications regardless of your status.
Change the following lines in Rocket.Chat/programs/server/packages/rocketchat_lib.js
1373 if (Push.enabled === true && userOfMention.statusConnection !== 'online') {to
1373 if (Push.enabled === true) {1490 if (user.statusConnection !== 'online' && (ref4 = user._id, indexOf.call(settings.dontNotifyMobileUsers, ref4) < 0)) {to
1490 if ((ref4 = user._id, indexOf.call(settings.dontNotifyMobileUsers, ref4) < 0)) {The line numbers may change by version. Those line numbers are from 0.34.0.