Revert "put current locale in consideration for various caches in filters/services"
This reverts commit37bb69a409
. Since we moved i18n into the init phase inf1db5e1c96
and don't switch locale at runtime we don't need this anymore
This commit is contained in:
parent
47f963cbbf
commit
c2656c1b29
@ -51,17 +51,14 @@ angular.module('myApp.filters', ['myApp.i18n'])
|
||||
}
|
||||
}])
|
||||
|
||||
.filter('dateOrTime', ['$filter', '_', function($filter, _) {
|
||||
.filter('dateOrTime', ['$filter', function($filter) {
|
||||
var cachedDates = {},
|
||||
dateFilter = $filter('date');
|
||||
|
||||
return function (timestamp) {
|
||||
if (!cachedDates.hasOwnProperty(_.locale())) {
|
||||
cachedDates[_.locale()] = {};
|
||||
}
|
||||
|
||||
if (cachedDates[_.locale()][timestamp]) {
|
||||
return cachedDates[_.locale()][timestamp];
|
||||
if (cachedDates[timestamp]) {
|
||||
return cachedDates[timestamp];
|
||||
}
|
||||
|
||||
var ticks = timestamp * 1000,
|
||||
@ -74,42 +71,34 @@ angular.module('myApp.filters', ['myApp.i18n'])
|
||||
else if (diff > 43200000) { // 12 hours
|
||||
format = 'EEE';
|
||||
}
|
||||
return cachedDates[_.locale()][timestamp] = dateFilter(ticks, format);
|
||||
return cachedDates[timestamp] = dateFilter(ticks, format);
|
||||
}
|
||||
}])
|
||||
|
||||
.filter('time', ['$filter', '_', function($filter, _) {
|
||||
.filter('time', ['$filter', function($filter) {
|
||||
var cachedDates = {},
|
||||
dateFilter = $filter('date'),
|
||||
format = Config.Mobile ? 'HH:mm' : 'HH:mm:ss';
|
||||
|
||||
return function (timestamp) {
|
||||
if (!cachedDates.hasOwnProperty(_.locale())) {
|
||||
cachedDates[_.locale()] = {};
|
||||
if (cachedDates[timestamp]) {
|
||||
return cachedDates[timestamp];
|
||||
}
|
||||
|
||||
if (cachedDates[_.locale()][timestamp]) {
|
||||
return cachedDates[_.locale()][timestamp];
|
||||
}
|
||||
|
||||
return cachedDates[_.locale()][timestamp] = dateFilter(timestamp * 1000, format);
|
||||
return cachedDates[timestamp] = dateFilter(timestamp * 1000, format);
|
||||
}
|
||||
}])
|
||||
|
||||
.filter('myDate', ['$filter', '_', function($filter, _) {
|
||||
.filter('myDate', ['$filter', function($filter) {
|
||||
var cachedDates = {},
|
||||
dateFilter = $filter('date');
|
||||
|
||||
return function (timestamp) {
|
||||
if (!cachedDates.hasOwnProperty(_.locale())) {
|
||||
cachedDates[_.locale()] = {};
|
||||
if (cachedDates[timestamp]) {
|
||||
return cachedDates[timestamp];
|
||||
}
|
||||
|
||||
if (cachedDates[_.locale()][timestamp]) {
|
||||
return cachedDates[_.locale()][timestamp];
|
||||
}
|
||||
|
||||
return cachedDates[_.locale()][timestamp] = dateFilter(timestamp * 1000, 'fullDate');
|
||||
return cachedDates[timestamp] = dateFilter(timestamp * 1000, 'fullDate');
|
||||
}
|
||||
}])
|
||||
|
||||
|
@ -718,7 +718,7 @@ angular.module('myApp.services', ['myApp.i18n'])
|
||||
|
||||
var messagesStorage = {};
|
||||
var messagesForHistory = {};
|
||||
var messagesForDialogs = {locale: _.locale()};
|
||||
var messagesForDialogs = {};
|
||||
var historiesStorage = {};
|
||||
var dialogsStorage = {count: null, dialogs: []};
|
||||
var pendingByRandomID = {};
|
||||
@ -1736,10 +1736,6 @@ angular.module('myApp.services', ['myApp.i18n'])
|
||||
function wrapForDialog (msgID, unreadCount) {
|
||||
var useCache = unreadCount != -1;
|
||||
|
||||
if (messagesForDialogs.locale != _.locale()) {
|
||||
messagesForDialogs = {locale: _.locale()};
|
||||
}
|
||||
|
||||
if (useCache && messagesForDialogs[msgID] !== undefined) {
|
||||
return messagesForDialogs[msgID];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user