diff --git a/app/js/controllers.js b/app/js/controllers.js index 87c9b511..0e899c11 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1507,7 +1507,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) }, 2800); } - AppMessagesManager.readHistory($scope.curDialog.peerID); + if (!$rootScope.idle.isIDLE) { + AppMessagesManager.readHistory($scope.curDialog.peerID); + } updateBotActions(); updateChannelActions(); @@ -2074,7 +2076,8 @@ angular.module('myApp.controllers', ['myApp.i18n']) } if (!newVal) { unreadAfterIdle = false; - if (loadAfterSync == $scope.curDialog.peerID) { + if (loadAfterSync && + loadAfterSync == $scope.curDialog.peerID) { loadHistory(); loadAfterSync = false; } diff --git a/app/js/directives.js b/app/js/directives.js index 68853789..cc1991be 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -2064,8 +2064,11 @@ angular.module('myApp.directives', ['myApp.filters']) height: $scope.document.thumb.height }); - var smallLocation = angular.copy($scope.document.thumb.location); - smallLocation.sticker = true; + var smallLocation = false; + if ($scope.document.thumb.location) { + smallLocation = angular.copy($scope.document.thumb.location); + smallLocation.sticker = true; + } var fullLocation = { _: 'inputDocumentFileLocation', @@ -2094,7 +2097,7 @@ angular.module('myApp.directives', ['myApp.filters']) imgElement.attr('src', emptySrc).appendTo(element); } - if (attrs.thumb) { + if (attrs.thumb && smallLocation) { MtpApiFileManager.downloadSmallFile(smallLocation).then(function (blob) { setSrc(blob); }, function (e) { diff --git a/app/js/lib/mtproto_wrapper.js b/app/js/lib/mtproto_wrapper.js index ecd1633d..5e8847e1 100644 --- a/app/js/lib/mtproto_wrapper.js +++ b/app/js/lib/mtproto_wrapper.js @@ -228,7 +228,7 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto']) performRequest(cachedNetworker); }, waitTime * 1000); } - else if (!options.rawError && error.code == 500) { + else if (!options.rawError && (error.code == 500 || error.type == 'MSG_WAIT_FAILED')) { var now = tsNow(); if (options.stopTime) { if (now >= options.stopTime) { diff --git a/app/js/services.js b/app/js/services.js index 439a0949..45484d36 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -152,11 +152,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) var timeNow = tsNow(true) + serverTimeOffset; switch (status._) { case 'userStatusRecently': - return tsNow(true) + serverTimeOffset - 86400 * 3; + return timeNow - 86400 * 3; case 'userStatusLastWeek': - return tsNow(true) + serverTimeOffset - 86400 * 7; + return timeNow - 86400 * 7; case 'userStatusLastMonth': - return tsNow(true) + serverTimeOffset - 86400 * 30; + return timeNow - 86400 * 30; } } @@ -1064,6 +1064,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) if (chatFullPromises[id] !== undefined) { return chatFullPromises[id]; } + // console.trace('get chat full'); return chatFullPromises[id] = MtpApiManager.invokeApi('messages.getFullChat', { chat_id: AppChatsManager.getChatInput(id) }).then(function (result) { @@ -1257,7 +1258,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) if (!chat.photo || !fullChat) { return; } - var emptyPhoto = chat.photo == 'chatPhotoEmpty'; + var emptyPhoto = chat.photo._ == 'chatPhotoEmpty'; if (emptyPhoto != (fullChat.chat_photo._ == 'photoEmpty')) { delete chatsFull[chatID]; $rootScope.$broadcast('chat_full_update', chatID);