Browse Source

Unread history bugfixes

master
Igor Zhukov 10 years ago
parent
commit
8131aae279
  1. 6
      app/js/controllers.js
  2. 8
      app/js/directives.js
  3. 3
      app/js/services.js

6
app/js/controllers.js

@ -1018,9 +1018,6 @@ angular.module('myApp.controllers', [])
else if (forceRecent) { else if (forceRecent) {
limit = 10; limit = 10;
} }
else if (Config.Mobile) {
limit = 20;
}
moreActive = false; moreActive = false;
morePending = false; morePending = false;
@ -1064,6 +1061,9 @@ angular.module('myApp.controllers', [])
if ($scope.skippedHistory) { if ($scope.skippedHistory) {
delete message.unread; delete message.unread;
} }
if (historyResult.unreadOffset) {
message.unreadAfter = true;
}
peerHistory.messages.push(message); peerHistory.messages.push(message);
}); });
peerHistory.messages.reverse(); peerHistory.messages.reverse();

8
app/js/directives.js

@ -101,10 +101,13 @@ angular.module('myApp.directives', ['myApp.filters'])
} }
}); });
if ($scope.historyMessage.unread) {
var deregisterUnreadAfter; var deregisterUnreadAfter;
if (!$scope.historyMessage.out) { if (!$scope.historyMessage.out &&
($scope.historyMessage.unread || $scope.historyMessage.unreadAfter)) {
var applyUnreadAfter = function () { var applyUnreadAfter = function () {
if ($scope.peerHistory.peerID != $scope.historyPeer.id) {
return;
}
if (unreadAfter != ($scope.historyUnreadAfter == $scope.historyMessage.id)) { if (unreadAfter != ($scope.historyUnreadAfter == $scope.historyMessage.id)) {
unreadAfter = !unreadAfter; unreadAfter = !unreadAfter;
if (unreadAfter) { if (unreadAfter) {
@ -124,6 +127,7 @@ angular.module('myApp.directives', ['myApp.filters'])
applyUnreadAfter(); applyUnreadAfter();
deregisterUnreadAfter = $scope.$on('messages_unread_after', applyUnreadAfter); deregisterUnreadAfter = $scope.$on('messages_unread_after', applyUnreadAfter);
} }
if ($scope.historyMessage.unread) {
element.addClass(unreadClass); element.addClass(unreadClass);
var deregisterUnread = $scope.$on('messages_read', function () { var deregisterUnread = $scope.$on('messages_read', function () {
if (!$scope.historyMessage.unread) { if (!$scope.historyMessage.unread) {

3
app/js/services.js

@ -929,6 +929,9 @@ angular.module('myApp.services', [])
unreadOffset = unreadCount; unreadOffset = unreadCount;
} }
} }
else if (Config.Mobile) {
limit = 20;
}
} }
else if (maxID > 0) { else if (maxID > 0) {
offsetNotFound = true; offsetNotFound = true;

Loading…
Cancel
Save