Browse Source

Added chat full photo cache reset

Closes #959
master
Igor Zhukov 9 years ago
parent
commit
0859be8ab7
  1. 23
      app/js/services.js

23
app/js/services.js

@ -1251,6 +1251,29 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -1251,6 +1251,29 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}
});
$rootScope.$on('chat_update', function (e, chatID) {
var fullChat = chatsFull[chatID];
var chat = AppChatsManager.getChat(chatID);
if (!chat.photo || !fullChat) {
return;
}
var emptyPhoto = chat.photo == 'chatPhotoEmpty';
if (emptyPhoto != (fullChat.chat_photo._ == 'photoEmpty')) {
delete chatsFull[chatID];
$rootScope.$broadcast('chat_full_update', chatID);
return;
}
if (emptyPhoto) {
return;
}
var smallUserpic = chat.photo.photo_small;
var smallPhotoSize = AppPhotosManager.choosePhotoSize(fullChat.chat_photo, 0, 0);
if (!angular.equals(smallUserpic, smallPhotoSize.location)) {
delete chatsFull[chatID];
$rootScope.$broadcast('chat_full_update', chatID);
}
});
return {
getPeerBots: getPeerBots,
getProfile: getProfile,

Loading…
Cancel
Save