Skip to content
Snippets Groups Projects
Commit f4693f1d authored by Sean McCambridge's avatar Sean McCambridge Committed by Gabriel Engel
Browse files

Faster desktop notifications (#2955)

* timeout to close desktop notification after 5 seconds

* added option to set duration in seconds for desktop notifications. implemented setTimeout to close notification after that duration.

* removed accidentally added trailing space

* modified desktop notification settings to accept 0 as value meaning do not set a timeout
parent 1db30efe
No related branches found
No related tags found
No related merge requests found
......@@ -246,6 +246,7 @@
"Desktop_Notification_Test" : "Desktop Notification Test",
"Desktop_Notifications" : "Desktop Notifications",
"Desktop_Notifications_Disabled" : "Desktop Notifications are Disabled. Change your browser preferences if you need Notifications enabled.",
"Desktop_Notifications_Duration_Description" : "Seconds to display desktop notification. This may affect OS X Notification Center. Enter 0 to use default browser settings and not affect OS X Notification Center.",
"Desktop_Notifications_Enabled" : "Desktop Notifications are Enabled",
"Direct_message_someone" : "Direct message someone",
"Direct_Messages" : "Direct Messages",
......
......@@ -100,6 +100,9 @@ RocketChat.settings.addGroup 'General', ->
@section 'Reporting', ->
@add 'Statistics_reporting', false, { type: 'boolean' }
@section 'Notifications', ->
@add 'Desktop_Notifications_Duration', 0, { type: 'int', public: true, i18nDescription: 'Desktop_Notification_Durations_Description' }
RocketChat.settings.addGroup 'SMTP', ->
@add 'SMTP_Host', '', { type: 'string', env: true }
......
......@@ -19,6 +19,10 @@
body: _.stripTags(message.msg)
silent: true
notificationDuration = RocketChat.settings.get('Desktop_Notifications_Duration') * 1000
if notificationDuration > 0
setTimeout ( -> n.close() ), notificationDuration
if notification.payload?.rid?
n.onclick = ->
window.focus()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment