Skip to content
This repository was archived by the owner on Oct 25, 2023. It is now read-only.

Commit a7eaf37

Browse files
committed
Fixes in stickersets
1 parent 8c72653 commit a7eaf37

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

app/js/services.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
18161816
return docs[docID] || {_: 'documentEmpty'};
18171817
}
18181818

1819+
function hasDoc (docID) {
1820+
return docs[docID] !== undefined;
1821+
}
1822+
18191823
function wrapForHistory (docID) {
18201824
if (docsForHistory[docID] !== undefined) {
18211825
return docsForHistory[docID];
@@ -1984,6 +1988,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
19841988
return {
19851989
saveDoc: saveDoc,
19861990
getDoc: getDoc,
1991+
hasDoc: hasDoc,
19871992
wrapForHistory: wrapForHistory,
19881993
updateDocDownloaded: updateDocDownloaded,
19891994
downloadDoc: downloadDoc,
@@ -2134,9 +2139,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
21342139
function getPopularStickers () {
21352140
return Storage.get('stickers_popular').then(function (popStickers) {
21362141
var result = [];
2142+
var i, len, docID;
21372143
if (popStickers && popStickers.length) {
2138-
for (var i = 0, len = popStickers.length; i < len; i++) {
2139-
result.push({id: popStickers[i][0], rate: popStickers[i][1]});
2144+
for (i = 0, len = popStickers.length; i < len; i++) {
2145+
docID = popStickers[i][0];
2146+
if (AppDocsManager.hasDoc(docID)) {
2147+
result.push({id: docID, rate: popStickers[i][1]});
2148+
}
21402149
}
21412150
};
21422151
return result;
@@ -2212,7 +2221,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
22122221
}
22132222
resultStickersets.unshift({
22142223
id: 0,
2215-
title: _('im_stickers_tab_recent'),
2224+
title: _('im_stickers_tab_recent_raw'),
22162225
short_name: '',
22172226
installed: true,
22182227
disabled: false,
@@ -2333,7 +2342,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
23332342
} else {
23342343
installedStickersets[set.id] = true;
23352344
}
2336-
getStickers(true);
2345+
Storage.remove('all_stickers').then(function () {
2346+
getStickers(true);
2347+
});
23372348
});
23382349
}
23392350

0 commit comments

Comments
 (0)