summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2014-09-06 10:26:30 -0700
committerEmmanuel ROHEE <manu@Emmanuels-MacBook-Pro.local>2014-09-08 11:28:51 +0200
commitdc1f202eca5e58eae243f5a1214d1acda5cbccd5 (patch)
tree9a3368b419fdd0f553d779b2330ed4c4b894d1ad
parentCenter recaptcha dialog. (diff)
downloadsynapse-dc1f202eca5e58eae243f5a1214d1acda5cbccd5.tar.xz
fix desktop notifs, which were broken in eab463fd
-rw-r--r--webclient/components/matrix/presence-service.js2
-rw-r--r--webclient/room/room-controller.js4
2 files changed, 3 insertions, 3 deletions
diff --git a/webclient/components/matrix/presence-service.js b/webclient/components/matrix/presence-service.js
index 952c8ec8a9..b487e3d3bd 100644
--- a/webclient/components/matrix/presence-service.js
+++ b/webclient/components/matrix/presence-service.js
@@ -24,7 +24,7 @@ angular.module('mPresence', [])
 .service('mPresence', ['$timeout', 'matrixService', function ($timeout, matrixService) {
 
     // Time in ms after that a user is considered as unavailable/away
-    var UNAVAILABLE_TIME = 5 * 60000; // 5 mins
+    var UNAVAILABLE_TIME = 3 * 60000; // 3 mins
    
     // The current presence state
     var state = undefined;
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index e69adb9b46..c702917fef 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -62,8 +62,8 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
             scrollToBottom();
 
             if (window.Notification) {
-                // Show notification when the user is idle
-                if (matrixService.presence.offline === mPresence.getState()) {
+                // Show notification when the window is hidden, or the user is idle
+                if (document.hidden || matrixService.presence.unavailable === mPresence.getState()) {
                     var notification = new window.Notification(
                         ($scope.members[event.user_id].displayname || event.user_id) +
                         " (" + ($scope.room_alias || $scope.room_id) + ")", // FIXME: don't leak room_ids here