SYWEB-57: Highlight rooms which have had their bingers go off in blue.

Priority is the same as xchat so selected > blue > red.
This commit is contained in:
Kegan Dougal 2014-11-12 15:31:06 +00:00
parent 99c445a6d6
commit 960b28c90a
5 changed files with 50 additions and 7 deletions

View file

@ -95,14 +95,22 @@ function(matrixService, $rootScope, $q, $timeout, $filter, mPresence, notificati
modelService.createRoomIdToAliasMapping(event.room_id, event.content.aliases[0]);
};
var containsBingWord = function(event) {
if (!event.content || !event.content.body) {
return false;
}
return notificationService.containsBingWord(
matrixService.config().user_id,
matrixService.config().display_name,
matrixService.config().bingWords,
event.content.body
);
};
var displayNotification = function(event) {
if (window.Notification && event.user_id != matrixService.config().user_id) {
var shouldBing = notificationService.containsBingWord(
matrixService.config().user_id,
matrixService.config().display_name,
matrixService.config().bingWords,
event.content.body
);
var shouldBing = containsBingWord(event);
// Ideally we would notify only when the window is hidden (i.e. document.hidden = true).
//
@ -529,6 +537,10 @@ function(matrixService, $rootScope, $q, $timeout, $filter, mPresence, notificati
resetRoomMessages(room_id);
},
eventContainsBingWord: function(event) {
return containsBingWord(event);
},
/**
* Return the last message event of a room
* @param {String} room_id the room id