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

More consistent HTML notifications and sounds #1116

Merged
merged 5 commits into from
Oct 23, 2015
Merged

More consistent HTML notifications and sounds #1116

merged 5 commits into from
Oct 23, 2015

Conversation

teetrinkers
Copy link
Contributor

First steps for #1068.

  • HTML notifications are shown when the user has selected the room of the message but the chat window does not have the focus.
  • HTML notification and new message sound use the same conditions.
  • The unread count is updated (and a dock icon badge shown) if the chat window does not have the focus.
  • For room messages with "@ALL", notifications are sent to all online users of the room except for the sender.

There is some duplicate code in /client/startup/unread.coffee (unread count) and /client/notifications/notification.coffee (notifications) for finding out whether the user has immediately read the new message. This could possibly be unified, but I need to get a better feel of the code first, I think.

- HTML notifications are shown when the user has selected the room of the message but the chat window does not have the focus.
- HTML notification and new message sound use the same condition.
- The unread count is always updated if the chat window does not have the focus.
@gmsecrieru
Copy link
Contributor

Thanks for your contribution, it's very much appreciated! Will test here but I suggest more people to jump in.

@gmsecrieru
Copy link
Contributor

I'm not sure this is working as expected, specially for Direct Messages. If my browser window is not active and I receive a new DM I just don't get any kind of notification I could be aware (i.e. only icon badge, which is currently hidden).

@teetrinkers
Copy link
Contributor Author

Hm, it works for me. I tested on OS X with Chrome, Firefox and Safari. What browser do you use? When you expected a notification but didn't get one, did you get a sound? Is it consistently not working or only intermittently?

I've once had no notifications at all in Safari, but when I restarted my local Rocket-Chat server and opened the Safari devtools to investigate, the notifications suddenly worked. Also some coworkers told me that desktop notifications weren't working for them at all using our local Rocket-Chat server running the vanilla version, i.e. without my modifications. I haven't had the time to investigate this yet but maybe there are some circumstances which make notifications fail that are independent from my changes.

@gmsecrieru
Copy link
Contributor

I might had something wrong here, my bad, it do work :)

👍 LGTM, any other reviews @RocketChat/owners ?

@@ -116,9 +119,20 @@ RocketChat.sendMessage = (user, message, room, options) ->
query._id =
$in: mentionIds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that this query isn't used anymore

@teetrinkers
Copy link
Contributor Author

Push notifications are now sent to offline users of the room as well.

@rodrigok
Copy link
Member

@teetrinkers looks very nice 😃

rodrigok added a commit that referenced this pull request Oct 23, 2015
More consistent HTML notifications and sounds
@rodrigok rodrigok merged commit 40578c6 into RocketChat:master Oct 23, 2015
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 this pull request may close these issues.

4 participants