0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-13 23:43:45 +01:00

Fix bug which caused notifications to appear for old messages.

This commit is contained in:
Kegan Dougal 2014-11-14 15:57:18 +00:00
parent c3278a8262
commit 78bf5648e7
2 changed files with 9 additions and 9 deletions

View file

@ -188,8 +188,10 @@ function(matrixService, $rootScope, $q, $timeout, $filter, mPresence, notificati
if (event.user_id !== matrixService.config().user_id) { if (event.user_id !== matrixService.config().user_id) {
room.addMessageEvent(event, !isLiveEvent); room.addMessageEvent(event, !isLiveEvent);
if (isLiveEvent) {
displayNotification(event); displayNotification(event);
} }
}
else { else {
// we may have locally echoed this, so we should replace the event // we may have locally echoed this, so we should replace the event
// instead of just adding. // instead of just adding.

View file

@ -339,25 +339,24 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a
} }
}; };
// Tries to find a suitable room ID for this room.
$scope.onInit = function() { $scope.onInit = function() {
console.log("onInit"); console.log("onInit");
// Does the room ID provided in the URL? // Try to find out the room ID to load.
var room_id_or_alias; var room_id_or_alias;
if ($routeParams.room_id_or_alias) { if ($routeParams.room_id_or_alias) { // provided in the url
room_id_or_alias = decodeURIComponent($routeParams.room_id_or_alias); room_id_or_alias = decodeURIComponent($routeParams.room_id_or_alias);
} }
if (room_id_or_alias && '!' === room_id_or_alias[0]) { if (room_id_or_alias && '!' === room_id_or_alias[0]) {
// Yes. We can go on right now // it's a room ID since they start with !
$scope.room_id = room_id_or_alias; $scope.room_id = room_id_or_alias;
$scope.room_alias = modelService.getRoomIdToAliasMapping($scope.room_id); $scope.room_alias = modelService.getRoomIdToAliasMapping($scope.room_id);
onInit2(); onInit2();
} }
else { else {
// No. The URL contains the room alias. Get this alias. if (room_id_or_alias && '#' === room_id_or_alias[0]) {
if (room_id_or_alias) {
// The room alias was passed urlencoded, use it as is
$scope.room_alias = room_id_or_alias; $scope.room_alias = room_id_or_alias;
} }
else { else {
@ -392,7 +391,6 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a
}; };
var onInit2 = function() { var onInit2 = function() {
console.log("onInit2");
$scope.room = modelService.getRoom($scope.room_id); $scope.room = modelService.getRoom($scope.room_id);
// Scroll down as soon as possible so that we point to the last message // Scroll down as soon as possible so that we point to the last message
@ -402,7 +400,7 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a
// Make sure the initialSync has been before going further // Make sure the initialSync has been before going further
eventHandlerService.waitForInitialSyncCompletion().then( eventHandlerService.waitForInitialSyncCompletion().then(
function() { function() {
console.log("initialSync is complete.");
var needsToJoin = true; var needsToJoin = true;
// The room members is available in the data fetched by initialSync // The room members is available in the data fetched by initialSync