mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 05:05:05 -04:00
Move the notification logic out of an individual room controller and into the general event handler, so we can notify for >1 room.
This commit is contained in:
parent
b170fe921e
commit
660364d6a7
2 changed files with 19 additions and 17 deletions
|
@ -139,22 +139,6 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
|
|||
if (isLive && event.room_id === $scope.room_id) {
|
||||
|
||||
scrollToBottom();
|
||||
|
||||
if (window.Notification) {
|
||||
// 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
|
||||
{
|
||||
"body": event.content.body,
|
||||
"icon": $scope.members[event.user_id].avatar_url
|
||||
});
|
||||
$timeout(function() {
|
||||
notification.close();
|
||||
}, 5 * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue