diff --git a/app/js/controllers.js b/app/js/controllers.js index 1ddb0a89..2dcd3a9d 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -4034,6 +4034,12 @@ angular.module('myApp.controllers', ['myApp.i18n']) function onChatUpdated (updates) { ApiUpdatesManager.processUpdateMessage(updates) $rootScope.$broadcast('history_focus', {peerString: $scope.chatFull.peerString}) + if (updates && + updates.updates && + updates.updates.length && + AppChatsManager.isChannel($scope.chatID)) { + AppProfileManager.invalidateChannelParticipants($scope.chatID) + } } $scope.leaveChannel = function () { @@ -4085,10 +4091,10 @@ angular.module('myApp.controllers', ['myApp.i18n']) } $scope.kickFromChannel = function (userID) { - MtpApiManager.invokeApi('channels.kickFromChannel', { + MtpApiManager.invokeApi('channels.editBanned', { channel: AppChatsManager.getChannelInput($scope.chatID), user_id: AppUsersManager.getUserInput(userID), - kicked: true + banned_rights: {_: 'channelBannedRights', flags: 1, until_date: 0} }).then(onChatUpdated) } diff --git a/app/js/services.js b/app/js/services.js index c1d3f99d..e4a58fac 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -1340,6 +1340,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) }) } + function invalidateChannelParticipants(id) { + delete chatsFull[id] + delete chatFullPromises[id] + angular.forEach(chatParticipantsPromises, function (val, key) { + if (key.split('_')[0] == id) { + delete chatParticipantsPromises[key] + } + }) + $rootScope.$broadcast('chat_full_update', id) + } + function getChannelPinnedMessage(id) { return getChannelFull(id).then(function (fullChannel) { var pinnedMessageID = fullChannel && fullChannel.pinned_msg_id @@ -1451,6 +1462,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) getChatFull: getChatFull, getChannelFull: getChannelFull, getChannelParticipants: getChannelParticipants, + invalidateChannelParticipants: invalidateChannelParticipants, getChannelPinnedMessage: getChannelPinnedMessage, hideChannelPinnedMessage: hideChannelPinnedMessage }