Browse Source

fixed global search

master
Igor Zhukov 9 years ago
parent
commit
a9e95c38ab
  1. 6
      app/js/controllers.js
  2. 8
      app/js/messages_manager.js

6
app/js/controllers.js

@ -826,7 +826,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -826,7 +826,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
if (searchMessages) {
searchTimeoutPromise = (force || maxID) ? $q.when() : $timeout(angular.noop, 500);
return searchTimeoutPromise.then(function () {
return AppMessagesManager.getSearch({_: 'inputPeerEmpty'}, $scope.search.query, {_: 'inputMessagesFilterEmpty'}, maxID).then(function (result) {
return AppMessagesManager.getSearch(false, $scope.search.query, {_: 'inputMessagesFilterEmpty'}, maxID).then(function (result) {
if (curJump != jump) {
return $q.reject();
}
@ -2614,7 +2614,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -2614,7 +2614,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
return;
}
AppMessagesManager.getSearch(inputPeer, inputQuery, inputFilter, 0, 1000).then(function (searchCachedResult) {
AppMessagesManager.getSearch(peerID, inputQuery, inputFilter, 0, 1000).then(function (searchCachedResult) {
if (searchCachedResult.history.indexOf($scope.messageID) >= 0) {
list = searchCachedResult.history;
maxID = list[list.length - 1];
@ -2666,7 +2666,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -2666,7 +2666,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
function loadMore () {
if (loadingPromise) return loadingPromise;
return loadingPromise = AppMessagesManager.getSearch(inputPeer, inputQuery, inputFilter, maxID).then(function (searchResult) {
return loadingPromise = AppMessagesManager.getSearch(peerID, inputQuery, inputFilter, maxID).then(function (searchResult) {
if (searchResult.history.length) {
maxID = searchResult.history[searchResult.history.length - 1];
list = list.concat(searchResult.history);

8
app/js/messages_manager.js

@ -197,7 +197,7 @@ angular.module('myApp.services') @@ -197,7 +197,7 @@ angular.module('myApp.services')
var dialog = dialogs[len - 1];
var index = dialog.index;
if (index) {
offsetDate = Math.ceil(index / 0x10000);
offsetDate = Math.ceil(index / 0x10000) + serverTimeOffset;
offsetID = dialog.top_message;
offsetPeerID = dialog.peerID;
}
@ -863,8 +863,9 @@ angular.module('myApp.services') @@ -863,8 +863,9 @@ angular.module('myApp.services')
var offsetPeerID = 0;
var offsetID = 0;
var offsetMessage = maxID && getMessage(maxID);
if (offsetMessage && offsetMessage.date) {
offsetDate = offsetMessage.date;
offsetDate = offsetMessage.date + serverTimeOffset;
offsetID = offsetMessage.id;
offsetPeerID = getMessagePeer(offsetMessage);
}
@ -2524,8 +2525,9 @@ angular.module('myApp.services') @@ -2524,8 +2525,9 @@ angular.module('myApp.services')
historyStorage = historiesStorage[peerID];
if (update._ == 'updateNewChannelMessage' &&
!AppChatsManager.isMegagroup(-peerID) &&
!(message.flags & 16 || message.flags & 2 || (message.flags & 256) == 0)) {
// we don't support not important messages yet
// we don't support not important messages in channels yet
break;
}

Loading…
Cancel
Save