From dd7d5d91cadd21a9ba757870a2c1da3b04613410 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Fri, 7 Mar 2014 16:34:25 +0100 Subject: [PATCH] Fixed session revoke handling, fixed undefined location, IM styles --- app/css/app.css | 2 +- app/js/controllers.js | 4 +++- app/js/directives.js | 15 +++++++++++++-- app/js/lib/mtproto.js | 11 +++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/css/app.css b/app/css/app.css index bee99361..122f9185 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -2206,7 +2206,7 @@ a.contacts_modal_contact:hover .contacts_modal_contact_status { cursor: pointer; position: absolute; width: 112px; - height: 50px; + height: 52px; margin: -8px 0 0 -112px; } @media (min-width: 1024px) { diff --git a/app/js/controllers.js b/app/js/controllers.js index e1f43350..410f7812 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -300,7 +300,9 @@ angular.module('myApp.controllers', []) }, function (error) { if (error.code == 401) { - $location.url('/login'); + MtpApiManager.logOut()['finally'](function () { + $location.url('/login'); + }); } }); } diff --git a/app/js/directives.js b/app/js/directives.js index b3df94ef..41949e24 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -89,12 +89,16 @@ angular.module('myApp.directives', ['myApp.filters']) return; } - if (!headWrap) { + if (!headWrap || !headWrap.offsetHeight) { headWrap = $('.tg_page_head')[0]; } + if (!footer || !footer.offsetHeight) { + footer = $('.im_page_footer')[0]; + } $(element).css({ height: $($window).height() - footer.offsetHeight - (headWrap ? headWrap.offsetHeight : 44) - 72 }); + updateScroller(); } @@ -276,6 +280,12 @@ angular.module('myApp.directives', ['myApp.filters']) }); } + if (!headWrap || !headWrap.offsetHeight) { + headWrap = $('.tg_page_head')[0]; + } + if (!footer || !footer.offsetHeight) { + footer = $('.im_page_footer')[0]; + } var historyH = $($window).height() - panelWrap.offsetHeight - bottomPanelWrap.offsetHeight - (headWrap ? headWrap.offsetHeight : 44) - footer.offsetHeight; $(historyWrap).css({ height: historyH @@ -496,7 +506,8 @@ angular.module('myApp.directives', ['myApp.filters']) var cachedSrc = MtpApiFileManager.getCachedFile( scope.thumb && scope.thumb.location && - !scope.thumb.location.empty + !scope.thumb.location.empty && + scope.thumb.location ); if (cachedSrc) { diff --git a/app/js/lib/mtproto.js b/app/js/lib/mtproto.js index 0de0af51..699ad3de 100644 --- a/app/js/lib/mtproto.js +++ b/app/js/lib/mtproto.js @@ -2333,6 +2333,12 @@ factory('MtpApiManager', function (AppConfigManager, MtpAuthorizer, MtpNetworker return mtpInvokeApi('auth.logOut').then(function () { AppConfigManager.remove('dc', 'user_auth'); + baseDcID = false; + }, function (error) { + AppConfigManager.remove('dc', 'user_auth'); + if (error && error.code != 401) { + AppConfigManager.remove('dc' + baseDcID + '_auth_key'); + } baseDcID = false; }); } @@ -2597,6 +2603,11 @@ factory('MtpApiFileManager', function (MtpApiManager, $q, $window) { case 'inputAudioFileLocation': return 'audio' + location.id; } + + if (!location.volume_id) { + console.trace('Empty location', location); + } + return location.volume_id + '_' + location.local_id + '_' + location.secret + '.jpg'; };