summary refs log tree commit diff
path: root/webclient/components
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-09-16 16:23:20 +0100
committerKegan Dougal <kegan@matrix.org>2014-09-16 16:23:20 +0100
commit95e171e19a323bd92da5f20d651a52517b47ce03 (patch)
tree69fb72c85dcf8a47870b93e2ff2887640bff5cb7 /webclient/components
parentAdded basic RegExp support. (diff)
downloadsynapse-95e171e19a323bd92da5f20d651a52517b47ce03.tar.xz
Don't bing for sent messages. Handle cases where the member is unknown rather than erroring out.
Diffstat (limited to 'webclient/components')
-rw-r--r--webclient/components/matrix/event-handler-service.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js

index 0c7c0d1696..55e8480a19 100644 --- a/webclient/components/matrix/event-handler-service.js +++ b/webclient/components/matrix/event-handler-service.js
@@ -177,7 +177,7 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) { $rootScope.events.rooms[event.room_id].messages.push(event); } - if (window.Notification) { + if (window.Notification && event.user_id != matrixService.config().user_id) { var shouldBing = $rootScope.containsBingWord(event.content.body); // TODO: Binging every message when idle doesn't make much sense. Can we use this more sensibly? @@ -195,12 +195,17 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) { if (shouldBing) { console.log("Displaying notification for "+JSON.stringify(event)); + var member = $rootScope.events.rooms[event.room_id].members[event.user_id]; + var displayname = undefined; + if (member) { + displayname = member.displayname; + } var notification = new window.Notification( - ($rootScope.events.rooms[event.room_id].members[event.user_id].displayname || event.user_id) + + (displayname || event.user_id) + " (" + (matrixService.getRoomIdToAliasMapping(event.room_id) || event.room_id) + ")", // FIXME: don't leak room_ids here { "body": event.content.body, - "icon": $rootScope.events.rooms[event.room_id].members[event.user_id].avatar_url + "icon": member ? member.avatar_url : undefined }); $timeout(function() { notification.close();