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,7 +188,9 @@ function(matrixService, $rootScope, $q, $timeout, $filter, mPresence, notificati
if (event.user_id !== matrixService.config().user_id) {
room.addMessageEvent(event, !isLiveEvent);
displayNotification(event);
if (isLiveEvent) {
displayNotification(event);
}
}
else {
// we may have locally echoed this, so we should replace the event

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() {
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;
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);
}
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_alias = modelService.getRoomIdToAliasMapping($scope.room_id);
onInit2();
}
else {
// No. The URL contains the room alias. Get this alias.
if (room_id_or_alias) {
// The room alias was passed urlencoded, use it as is
if (room_id_or_alias && '#' === room_id_or_alias[0]) {
$scope.room_alias = room_id_or_alias;
}
else {
@ -392,7 +391,6 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a
};
var onInit2 = function() {
console.log("onInit2");
$scope.room = modelService.getRoom($scope.room_id);
// 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
eventHandlerService.waitForInitialSyncCompletion().then(
function() {
console.log("initialSync is complete.");
var needsToJoin = true;
// The room members is available in the data fetched by initialSync