Improved channel updates
This commit is contained in:
parent
d30e779808
commit
6d9aa03695
@ -616,7 +616,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
AppStickersManager.start();
|
AppStickersManager.start();
|
||||||
})
|
})
|
||||||
|
|
||||||
.controller('AppImDialogsController', function ($scope, $location, $q, $timeout, $routeParams, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, PhonebookContactsService, ErrorService, AppRuntimeManager) {
|
.controller('AppImDialogsController', function ($scope, $location, $q, $timeout, $routeParams, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppProfileManager, AppPeersManager, PhonebookContactsService, ErrorService, AppRuntimeManager) {
|
||||||
|
|
||||||
$scope.dialogs = [];
|
$scope.dialogs = [];
|
||||||
$scope.contacts = [];
|
$scope.contacts = [];
|
||||||
@ -732,7 +732,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
case 'updateChatUserTyping':
|
case 'updateChatUserTyping':
|
||||||
if (!AppUsersManager.hasUser(update.user_id)) {
|
if (!AppUsersManager.hasUser(update.user_id)) {
|
||||||
if (update.chat_id) {
|
if (update.chat_id) {
|
||||||
AppChatsManager.getChatFull(update.chat_id);
|
AppProfileManager.getChatFull(update.chat_id);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1724,9 +1724,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
|
|
||||||
$scope.$on('history_forbidden', function (e, updPeerID) {
|
$scope.$on('history_forbidden', function (e, updPeerID) {
|
||||||
if (updPeerID == $scope.curDialog.peerID) {
|
if (updPeerID == $scope.curDialog.peerID) {
|
||||||
$rootScope.$apply(function () {
|
$location.url('/im');
|
||||||
$location.url('/im');
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2075,7 +2073,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
$scope.$broadcast('mentions_update');
|
$scope.$broadcast('mentions_update');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AppChatsManager.getChatFull(-peerID).then(function (chatFull) {
|
AppProfileManager.getChatFull(-peerID).then(function (chatFull) {
|
||||||
var participantsVector = (chatFull.participants || {}).participants || [];
|
var participantsVector = (chatFull.participants || {}).participants || [];
|
||||||
|
|
||||||
var mentionUsers = [];
|
var mentionUsers = [];
|
||||||
@ -3026,12 +3024,12 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
.controller('ChatModalController', function ($scope, $timeout, $rootScope, $modal, AppUsersManager, AppChatsManager, AppPhotosManager, MtpApiManager, MtpApiFileManager, NotificationsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, ContactsSelectService, ErrorService) {
|
.controller('ChatModalController', function ($scope, $timeout, $rootScope, $modal, AppUsersManager, AppChatsManager, AppProfileManager, AppPhotosManager, MtpApiManager, MtpApiFileManager, NotificationsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, ContactsSelectService, ErrorService) {
|
||||||
|
|
||||||
$scope.chatFull = AppChatsManager.wrapForFull($scope.chatID, {});
|
$scope.chatFull = AppChatsManager.wrapForFull($scope.chatID, {});
|
||||||
$scope.settings = {notifications: true};
|
$scope.settings = {notifications: true};
|
||||||
|
|
||||||
AppChatsManager.getChatFull($scope.chatID).then(function (chatFull) {
|
AppProfileManager.getChatFull($scope.chatID).then(function (chatFull) {
|
||||||
$scope.chatFull = AppChatsManager.wrapForFull($scope.chatID, chatFull);
|
$scope.chatFull = AppChatsManager.wrapForFull($scope.chatID, chatFull);
|
||||||
$scope.$broadcast('ui_height');
|
$scope.$broadcast('ui_height');
|
||||||
|
|
||||||
@ -3176,12 +3174,12 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
.controller('ChannelModalController', function ($scope, $timeout, $rootScope, $modal, AppUsersManager, AppChatsManager, AppPhotosManager, MtpApiManager, MtpApiFileManager, NotificationsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, ContactsSelectService, ErrorService) {
|
.controller('ChannelModalController', function ($scope, $timeout, $rootScope, $modal, AppUsersManager, AppChatsManager, AppProfileManager, AppPhotosManager, MtpApiManager, MtpApiFileManager, NotificationsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, ContactsSelectService, ErrorService) {
|
||||||
|
|
||||||
$scope.chatFull = AppChatsManager.wrapForFull($scope.chatID, {});
|
$scope.chatFull = AppChatsManager.wrapForFull($scope.chatID, {});
|
||||||
$scope.settings = {notifications: true};
|
$scope.settings = {notifications: true};
|
||||||
|
|
||||||
AppChatsManager.getChannelFull($scope.chatID, true).then(function (chatFull) {
|
AppProfileManager.getChannelFull($scope.chatID, true).then(function (chatFull) {
|
||||||
$scope.chatFull = AppChatsManager.wrapForFull($scope.chatID, chatFull);
|
$scope.chatFull = AppChatsManager.wrapForFull($scope.chatID, chatFull);
|
||||||
$scope.$broadcast('ui_height');
|
$scope.$broadcast('ui_height');
|
||||||
|
|
||||||
@ -3318,6 +3316,10 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.goToHistory = function () {
|
||||||
|
$rootScope.$broadcast('history_focus', {peerString: $scope.chatFull.peerString});
|
||||||
|
};
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
.controller('SettingsModalController', function ($rootScope, $scope, $timeout, $modal, AppUsersManager, AppChatsManager, AppPhotosManager, MtpApiManager, Storage, NotificationsManager, MtpApiFileManager, PasswordManager, ApiUpdatesManager, ChangelogNotifyService, LayoutSwitchService, AppRuntimeManager, ErrorService, _) {
|
.controller('SettingsModalController', function ($rootScope, $scope, $timeout, $modal, AppUsersManager, AppChatsManager, AppPhotosManager, MtpApiManager, Storage, NotificationsManager, MtpApiFileManager, PasswordManager, ApiUpdatesManager, ChangelogNotifyService, LayoutSwitchService, AppRuntimeManager, ErrorService, _) {
|
||||||
@ -3694,7 +3696,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
$scope.$watch('profile.username', function (newVal) {
|
$scope.$watch('profile.username', function (newVal) {
|
||||||
if (!newVal.length) {
|
if (!newVal || !newVal.length) {
|
||||||
$scope.checked = {};
|
$scope.checked = {};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4185,13 +4187,13 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
.controller('ChannelEditModalController', function ($q, $scope, $modalInstance, $rootScope, MtpApiManager, AppUsersManager, AppChatsManager, ApiUpdatesManager) {
|
.controller('ChannelEditModalController', function ($q, $scope, $modalInstance, $rootScope, MtpApiManager, AppUsersManager, AppChatsManager, AppProfileManager, ApiUpdatesManager) {
|
||||||
|
|
||||||
var channel = AppChatsManager.getChat($scope.chatID);
|
var channel = AppChatsManager.getChat($scope.chatID);
|
||||||
var initial = {title: channel.title};
|
var initial = {title: channel.title};
|
||||||
$scope.channel = {title: channel.title};
|
$scope.channel = {title: channel.title};
|
||||||
|
|
||||||
AppChatsManager.getChannelFull($scope.chatID).then(function (channelFull) {
|
AppProfileManager.getChannelFull($scope.chatID).then(function (channelFull) {
|
||||||
initial.about = channelFull.about;
|
initial.about = channelFull.about;
|
||||||
$scope.channel.about = channelFull.about;
|
$scope.channel.about = channelFull.about;
|
||||||
});
|
});
|
||||||
|
@ -2512,7 +2512,7 @@ angular.module('myApp.directives', ['myApp.filters'])
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.directive('myChatStatus', function ($rootScope, _, MtpApiManager, AppChatsManager, AppUsersManager) {
|
.directive('myChatStatus', function ($rootScope, _, MtpApiManager, AppChatsManager, AppUsersManager, AppProfileManager) {
|
||||||
|
|
||||||
var ind = 0;
|
var ind = 0;
|
||||||
var statuses = {};
|
var statuses = {};
|
||||||
@ -2549,7 +2549,7 @@ angular.module('myApp.directives', ['myApp.filters'])
|
|||||||
if (!chatID) {
|
if (!chatID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AppChatsManager.getChatFull(chatID).then(function (chatFull) {
|
AppProfileManager.getChatFull(chatID).then(function (chatFull) {
|
||||||
var participantsVector = (chatFull.participants || {}).participants || [];
|
var participantsVector = (chatFull.participants || {}).participants || [];
|
||||||
participantsCount = participantsVector.length;
|
participantsCount = participantsVector.length;
|
||||||
angular.forEach(participantsVector, function (participant) {
|
angular.forEach(participantsVector, function (participant) {
|
||||||
|
@ -1274,6 +1274,9 @@ angular.module('myApp.services')
|
|||||||
if (replyToMsgID) {
|
if (replyToMsgID) {
|
||||||
flags |= 1;
|
flags |= 1;
|
||||||
}
|
}
|
||||||
|
if (asChannel) {
|
||||||
|
flags |= 16;
|
||||||
|
}
|
||||||
MtpApiManager.invokeApi('messages.sendMedia', {
|
MtpApiManager.invokeApi('messages.sendMedia', {
|
||||||
flags: flags,
|
flags: flags,
|
||||||
peer: inputPeer,
|
peer: inputPeer,
|
||||||
@ -1417,6 +1420,9 @@ angular.module('myApp.services')
|
|||||||
if (replyToMsgID) {
|
if (replyToMsgID) {
|
||||||
flags |= 1;
|
flags |= 1;
|
||||||
}
|
}
|
||||||
|
if (asChannel) {
|
||||||
|
flags |= 16;
|
||||||
|
}
|
||||||
MtpApiManager.invokeApi('messages.sendMedia', {
|
MtpApiManager.invokeApi('messages.sendMedia', {
|
||||||
flags: flags,
|
flags: flags,
|
||||||
peer: inputPeer,
|
peer: inputPeer,
|
||||||
@ -1601,7 +1607,11 @@ angular.module('myApp.services')
|
|||||||
}).then(function (updates) {
|
}).then(function (updates) {
|
||||||
ApiUpdatesManager.processUpdateMessage(updates);
|
ApiUpdatesManager.processUpdateMessage(updates);
|
||||||
|
|
||||||
if (updates.updates && updates.updates.length) {
|
if (updates.chats && updates.chats.length == 1) {
|
||||||
|
$rootScope.$broadcast('history_focus', {peerString: AppChatsManager.getChatString(updates.chats[0].id)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (updates.updates && updates.updates.length) {
|
||||||
for (var i = 0, len = updates.updates.length, update; i < len; i++) {
|
for (var i = 0, len = updates.updates.length, update; i < len; i++) {
|
||||||
update = updates.updates[i];
|
update = updates.updates[i];
|
||||||
if (update._ == 'updateNewMessage') {
|
if (update._ == 'updateNewMessage') {
|
||||||
@ -2457,7 +2467,7 @@ angular.module('myApp.services')
|
|||||||
var foundDialog = getDialogByPeerID(peerID);
|
var foundDialog = getDialogByPeerID(peerID);
|
||||||
var hasDialog = foundDialog.length > 0;
|
var hasDialog = foundDialog.length > 0;
|
||||||
|
|
||||||
var canViewHistory = channel._ == 'channel' && (channel.username || !channel.pFlags.left && !channel.pFlags.kicked);
|
var canViewHistory = channel._ == 'channel' && (channel.username || !channel.pFlags.left && !channel.pFlags.kicked) && true || false;
|
||||||
var hasHistory = historiesStorage[peerID] !== undefined;
|
var hasHistory = historiesStorage[peerID] !== undefined;
|
||||||
|
|
||||||
if (canViewHistory != hasHistory) {
|
if (canViewHistory != hasHistory) {
|
||||||
@ -2495,7 +2505,7 @@ angular.module('myApp.services')
|
|||||||
var peerID = -channelID;
|
var peerID = -channelID;
|
||||||
var inputPeer = AppPeersManager.getInputPeerByID(peerID);
|
var inputPeer = AppPeersManager.getInputPeerByID(peerID);
|
||||||
return $q.all([
|
return $q.all([
|
||||||
AppChatsManager.getChannelFull(channelID, true),
|
AppProfileManager.getChannelFull(channelID, true),
|
||||||
getHistory(inputPeer, 0)
|
getHistory(inputPeer, 0)
|
||||||
]).then(function (results) {
|
]).then(function (results) {
|
||||||
var channelResult = results[0];
|
var channelResult = results[0];
|
||||||
@ -2508,7 +2518,8 @@ angular.module('myApp.services')
|
|||||||
top_important_message: topMsgID,
|
top_important_message: topMsgID,
|
||||||
read_inbox_max_id: channelResult.read_inbox_max_id,
|
read_inbox_max_id: channelResult.read_inbox_max_id,
|
||||||
unread_count: channelResult.unread_count,
|
unread_count: channelResult.unread_count,
|
||||||
unread_important_count: channelResult.unread_important_count
|
unread_important_count: channelResult.unread_important_count,
|
||||||
|
notify_settings: channelResult.notify_settings
|
||||||
};
|
};
|
||||||
saveChannelDialog(channelID, dialog);
|
saveChannelDialog(channelID, dialog);
|
||||||
|
|
||||||
|
@ -551,8 +551,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
.service('AppChatsManager', function ($q, $rootScope, $modal, _, MtpApiFileManager, MtpApiManager, AppUsersManager, AppPhotosManager, RichTextProcessor) {
|
.service('AppChatsManager', function ($q, $rootScope, $modal, _, MtpApiFileManager, MtpApiManager, AppUsersManager, AppPhotosManager, RichTextProcessor) {
|
||||||
var chats = {},
|
var chats = {},
|
||||||
usernames = {},
|
usernames = {},
|
||||||
chatsFull = {},
|
|
||||||
chatFullPromises = {},
|
|
||||||
channelAccess = {},
|
channelAccess = {},
|
||||||
cachedPhotoLocations = {};
|
cachedPhotoLocations = {};
|
||||||
|
|
||||||
@ -643,93 +641,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChatFull(id) {
|
|
||||||
if (isChannel(id)) {
|
|
||||||
return getChannelFull(id);
|
|
||||||
}
|
|
||||||
if (chatsFull[id] !== undefined) {
|
|
||||||
if (chats[id].version == chatsFull[id].participants.version ||
|
|
||||||
chats[id].left) {
|
|
||||||
return $q.when(chatsFull[id]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (chatFullPromises[id] !== undefined) {
|
|
||||||
return chatFullPromises[id];
|
|
||||||
}
|
|
||||||
return chatFullPromises[id] = MtpApiManager.invokeApi('messages.getFullChat', {
|
|
||||||
chat_id: getChatInput(id)
|
|
||||||
}).then(function (result) {
|
|
||||||
saveApiChats(result.chats);
|
|
||||||
AppUsersManager.saveApiUsers(result.users);
|
|
||||||
var fullChat = result.full_chat;
|
|
||||||
if (fullChat && fullChat.chat_photo.id) {
|
|
||||||
AppPhotosManager.savePhoto(fullChat.chat_photo);
|
|
||||||
}
|
|
||||||
delete chatFullPromises[id];
|
|
||||||
chatsFull[id] = fullChat;
|
|
||||||
$rootScope.$broadcast('chat_full_update', id);
|
|
||||||
|
|
||||||
return fullChat;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getChannelFull (id, force) {
|
|
||||||
if (chatsFull[id] !== undefined && !force) {
|
|
||||||
return $q.when(chatsFull[id]);
|
|
||||||
}
|
|
||||||
if (chatFullPromises[id] !== undefined) {
|
|
||||||
return chatFullPromises[id];
|
|
||||||
}
|
|
||||||
|
|
||||||
return chatFullPromises[id] = MtpApiManager.invokeApi('channels.getFullChannel', {
|
|
||||||
channel: getChannelInput(id)
|
|
||||||
}).then(function (result) {
|
|
||||||
saveApiChats(result.chats);
|
|
||||||
AppUsersManager.saveApiUsers(result.users);
|
|
||||||
var fullChannel = result.full_chat;
|
|
||||||
var chat = getChat(id);
|
|
||||||
if (fullChannel && fullChannel.chat_photo.id) {
|
|
||||||
AppPhotosManager.savePhoto(fullChannel.chat_photo);
|
|
||||||
}
|
|
||||||
var participantsPromise;
|
|
||||||
if ((fullChannel.flags & 8) ||
|
|
||||||
chat.pFlags.creator ||
|
|
||||||
chat.pFlags.editor ||
|
|
||||||
chat.pFlags.moderator) {
|
|
||||||
participantsPromise = getChannelParticipants(id).then(function (participants) {
|
|
||||||
delete chatFullPromises[id];
|
|
||||||
fullChannel.participants = {
|
|
||||||
_: 'channelParticipants',
|
|
||||||
participants: participants
|
|
||||||
};
|
|
||||||
}, function (error) {
|
|
||||||
error.handled = true;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
participantsPromise = $q.when();
|
|
||||||
}
|
|
||||||
return participantsPromise.then(function () {
|
|
||||||
delete chatFullPromises[id];
|
|
||||||
chatsFull[id] = fullChannel;
|
|
||||||
$rootScope.$broadcast('chat_full_update', id);
|
|
||||||
|
|
||||||
return fullChannel;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getChannelParticipants (id) {
|
|
||||||
return MtpApiManager.invokeApi('channels.getParticipants', {
|
|
||||||
channel: getChannelInput(id),
|
|
||||||
filter: {_: 'channelParticipantsRecent'},
|
|
||||||
offset: 0,
|
|
||||||
limit: 200
|
|
||||||
}).then(function (result) {
|
|
||||||
AppUsersManager.saveApiUsers(result.users);
|
|
||||||
return result.participants;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getChatInviteLink (id, force) {
|
function getChatInviteLink (id, force) {
|
||||||
return getChatFull(id).then(function (chatFull) {
|
return getChatFull(id).then(function (chatFull) {
|
||||||
if (!force &&
|
if (!force &&
|
||||||
@ -893,8 +804,6 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
saveChannelAccess: saveChannelAccess,
|
saveChannelAccess: saveChannelAccess,
|
||||||
getChatInput: getChatInput,
|
getChatInput: getChatInput,
|
||||||
getChannelInput: getChannelInput,
|
getChannelInput: getChannelInput,
|
||||||
getChatFull: getChatFull,
|
|
||||||
getChannelFull: getChannelFull,
|
|
||||||
getChatPhoto: getChatPhoto,
|
getChatPhoto: getChatPhoto,
|
||||||
getChatString: getChatString,
|
getChatString: getChatString,
|
||||||
getChatInviteLink: getChatInviteLink,
|
getChatInviteLink: getChatInviteLink,
|
||||||
@ -1056,9 +965,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.service('AppProfileManager', function ($q, AppUsersManager, AppChatsManager, AppPhotosManager, NotificationsManager, MtpApiManager, RichTextProcessor) {
|
.service('AppProfileManager', function ($q, $rootScope, AppUsersManager, AppChatsManager, AppPeersManager, AppPhotosManager, NotificationsManager, MtpApiManager, RichTextProcessor) {
|
||||||
|
|
||||||
var botInfos = {};
|
var botInfos = {};
|
||||||
|
var chatsFull = {};
|
||||||
|
var chatFullPromises = {};
|
||||||
|
|
||||||
function saveBotInfo (botInfo) {
|
function saveBotInfo (botInfo) {
|
||||||
var botID = botInfo && botInfo.user_id;
|
var botID = botInfo && botInfo.user_id;
|
||||||
@ -1108,10 +1019,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
|
|
||||||
function getPeerBots (peerID) {
|
function getPeerBots (peerID) {
|
||||||
var peerBots = [];
|
var peerBots = [];
|
||||||
|
if (peerID >= 0 && !AppUsersManager.isBot(peerID) ||
|
||||||
|
AppPeersManager.isChannel(peerID)) {
|
||||||
|
return $q.when(peerBots);
|
||||||
|
}
|
||||||
if (peerID >= 0) {
|
if (peerID >= 0) {
|
||||||
if (!AppUsersManager.isBot(peerID)) {
|
|
||||||
return $q.when(peerBots);
|
|
||||||
}
|
|
||||||
return getProfile(peerID).then(function (userFull) {
|
return getProfile(peerID).then(function (userFull) {
|
||||||
var botInfo = userFull.bot_info;
|
var botInfo = userFull.bot_info;
|
||||||
if (botInfo && botInfo._ != 'botInfoEmpty') {
|
if (botInfo && botInfo._ != 'botInfoEmpty') {
|
||||||
@ -1121,7 +1033,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return AppChatsManager.getChatFull(-peerID).then(function (chatFull) {
|
return getChatFull(-peerID).then(function (chatFull) {
|
||||||
angular.forEach(chatFull.bot_info, function (botInfo) {
|
angular.forEach(chatFull.bot_info, function (botInfo) {
|
||||||
peerBots.push(saveBotInfo(botInfo));
|
peerBots.push(saveBotInfo(botInfo));
|
||||||
});
|
});
|
||||||
@ -1130,9 +1042,101 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getChatFull(id) {
|
||||||
|
if (AppChatsManager.isChannel(id)) {
|
||||||
|
return getChannelFull(id);
|
||||||
|
}
|
||||||
|
if (chatsFull[id] !== undefined) {
|
||||||
|
var chat = AppChatsManager.getChat(id);
|
||||||
|
if (chat.version == chatsFull[id].participants.version ||
|
||||||
|
chat.left) {
|
||||||
|
return $q.when(chatsFull[id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (chatFullPromises[id] !== undefined) {
|
||||||
|
return chatFullPromises[id];
|
||||||
|
}
|
||||||
|
return chatFullPromises[id] = MtpApiManager.invokeApi('messages.getFullChat', {
|
||||||
|
chat_id: AppChatsManager.getChatInput(id)
|
||||||
|
}).then(function (result) {
|
||||||
|
AppChatsManager.saveApiChats(result.chats);
|
||||||
|
AppUsersManager.saveApiUsers(result.users);
|
||||||
|
var fullChat = result.full_chat;
|
||||||
|
if (fullChat && fullChat.chat_photo.id) {
|
||||||
|
AppPhotosManager.savePhoto(fullChat.chat_photo);
|
||||||
|
}
|
||||||
|
NotificationsManager.savePeerSettings(-id, fullChat.notify_settings);
|
||||||
|
delete chatFullPromises[id];
|
||||||
|
chatsFull[id] = fullChat;
|
||||||
|
$rootScope.$broadcast('chat_full_update', id);
|
||||||
|
|
||||||
|
return fullChat;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getChannelParticipants (id) {
|
||||||
|
return MtpApiManager.invokeApi('channels.getParticipants', {
|
||||||
|
channel: AppChatsManager.getChannelInput(id),
|
||||||
|
filter: {_: 'channelParticipantsRecent'},
|
||||||
|
offset: 0,
|
||||||
|
limit: 200
|
||||||
|
}).then(function (result) {
|
||||||
|
AppUsersManager.saveApiUsers(result.users);
|
||||||
|
return result.participants;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getChannelFull (id, force) {
|
||||||
|
if (chatsFull[id] !== undefined && !force) {
|
||||||
|
return $q.when(chatsFull[id]);
|
||||||
|
}
|
||||||
|
if (chatFullPromises[id] !== undefined) {
|
||||||
|
return chatFullPromises[id];
|
||||||
|
}
|
||||||
|
|
||||||
|
return chatFullPromises[id] = MtpApiManager.invokeApi('channels.getFullChannel', {
|
||||||
|
channel: AppChatsManager.getChannelInput(id)
|
||||||
|
}).then(function (result) {
|
||||||
|
AppChatsManager.saveApiChats(result.chats);
|
||||||
|
AppUsersManager.saveApiUsers(result.users);
|
||||||
|
var fullChannel = result.full_chat;
|
||||||
|
var chat = AppChatsManager.getChat(id);
|
||||||
|
if (fullChannel && fullChannel.chat_photo.id) {
|
||||||
|
AppPhotosManager.savePhoto(fullChannel.chat_photo);
|
||||||
|
}
|
||||||
|
NotificationsManager.savePeerSettings(-id, fullChannel.notify_settings);
|
||||||
|
var participantsPromise;
|
||||||
|
if ((fullChannel.flags & 8) ||
|
||||||
|
chat.pFlags.creator ||
|
||||||
|
chat.pFlags.editor ||
|
||||||
|
chat.pFlags.moderator) {
|
||||||
|
participantsPromise = getChannelParticipants(id).then(function (participants) {
|
||||||
|
delete chatFullPromises[id];
|
||||||
|
fullChannel.participants = {
|
||||||
|
_: 'channelParticipants',
|
||||||
|
participants: participants
|
||||||
|
};
|
||||||
|
}, function (error) {
|
||||||
|
error.handled = true;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
participantsPromise = $q.when();
|
||||||
|
}
|
||||||
|
return participantsPromise.then(function () {
|
||||||
|
delete chatFullPromises[id];
|
||||||
|
chatsFull[id] = fullChannel;
|
||||||
|
$rootScope.$broadcast('chat_full_update', id);
|
||||||
|
|
||||||
|
return fullChannel;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
getPeerBots: getPeerBots,
|
||||||
getProfile: getProfile,
|
getProfile: getProfile,
|
||||||
getPeerBots: getPeerBots
|
getChatFull: getChatFull,
|
||||||
|
getChannelFull: getChannelFull
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -665,7 +665,7 @@ a.tg_checkbox {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
float: left;
|
float: left;
|
||||||
margin-left: -6px;
|
margin-left: -1px;
|
||||||
margin-top: -3px;
|
margin-top: -3px;
|
||||||
-webkit-transition: all ease 0.1s;
|
-webkit-transition: all ease 0.1s;
|
||||||
transition: all ease 0.1s;
|
transition: all ease 0.1s;
|
||||||
@ -3720,7 +3720,7 @@ a.countries_modal_search_clear {
|
|||||||
|
|
||||||
.md_modal_section {
|
.md_modal_section {
|
||||||
&s {
|
&s {
|
||||||
padding-top: 17px
|
padding-top: 17px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&_icon {
|
&_icon {
|
||||||
|
@ -27,18 +27,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="md_modal_split_actions_wrap" ng-if="chatFull.chat.pFlags.creator">
|
<div class="md_modal_split_actions_wrap">
|
||||||
<div class="md_modal_split_actions">
|
<div class="md_modal_split_actions" ng-switch="chatFull.chat.pFlags.creator">
|
||||||
<div class="md_modal_split_action">
|
<div ng-switch-when="true" class="md_modal_split_action">
|
||||||
<input my-file-upload type="file" multiple="false" class="im_attach_input" size="120" multiple="false" accept="image/x-png, image/png, image/gif, image/jpeg" title="{{'group_modal_update_photo' | i18n}}" />
|
<input my-file-upload type="file" multiple="false" class="im_attach_input" size="120" multiple="false" accept="image/x-png, image/png, image/gif, image/jpeg" title="{{'group_modal_update_photo' | i18n}}" />
|
||||||
<i class="md_modal_split_action_camera"></i>
|
<i class="md_modal_split_action_camera"></i>
|
||||||
</div>
|
</div>
|
||||||
|
<a ng-switch-default class="md_modal_split_action" href="" ng-click="goToHistory()" title="{{'user_modal_send_message' | i18n}}">
|
||||||
|
<i class="md_modal_split_action_msg"></i>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="md_modal_body">
|
<div class="md_modal_body">
|
||||||
|
|
||||||
<div class="md_modal_sections">
|
<div class="md_modal_sections clearfix">
|
||||||
|
|
||||||
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_number" ng-if="chatFull.rAbout || chatFull.chat.username || chatFull.chat.pFlags.creator">
|
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_number" ng-if="chatFull.rAbout || chatFull.chat.username || chatFull.chat.pFlags.creator">
|
||||||
<i class="md_modal_section_icon md_modal_section_icon_about"></i>
|
<i class="md_modal_section_icon md_modal_section_icon_about"></i>
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
<div class="md_modal_body">
|
<div class="md_modal_body">
|
||||||
|
|
||||||
<div class="md_modal_sections">
|
<div class="md_modal_sections clearfix">
|
||||||
|
|
||||||
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_link" ng-if="chatFull.chat._ != 'chatForbidden'">
|
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_link" ng-if="chatFull.chat._ != 'chatForbidden'">
|
||||||
<i class="md_modal_section_icon md_modal_section_icon_person"></i>
|
<i class="md_modal_section_icon md_modal_section_icon_person"></i>
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
</span>
|
</span>
|
||||||
<span ng-switch-when="messageActionChatJoinedByLink" my-i18n="conversation_joined_by_link"></span>
|
<span ng-switch-when="messageActionChatJoinedByLink" my-i18n="conversation_joined_by_link"></span>
|
||||||
|
|
||||||
<span ng-switch-when="messageActionChannelCreate" my-i18n-format="conversation_created_channel"></span>
|
<span ng-switch-when="messageActionChannelCreate" my-i18n="conversation_created_channel"></span>
|
||||||
<span ng-switch-when="messageActionChannelEditTitle" my-i18n-format="conversation_changed_channel_name"></span>
|
<span ng-switch-when="messageActionChannelEditTitle" my-i18n="conversation_changed_channel_name"></span>
|
||||||
<span ng-switch-when="messageActionChannelEditPhoto" my-i18n="conversation_changed_channel_photo"></span>
|
<span ng-switch-when="messageActionChannelEditPhoto" my-i18n="conversation_changed_channel_photo"></span>
|
||||||
<span ng-switch-when="messageActionChannelDeletePhoto" my-i18n="conversation_removed_channel_photo"></span>
|
<span ng-switch-when="messageActionChannelDeletePhoto" my-i18n="conversation_removed_channel_photo"></span>
|
||||||
</span>
|
</span>
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
<div class="md_modal_body">
|
<div class="md_modal_body">
|
||||||
|
|
||||||
<div class="md_modal_sections">
|
<div class="md_modal_sections clearfix">
|
||||||
|
|
||||||
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_number">
|
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_number">
|
||||||
<i class="md_modal_section_icon md_modal_section_icon_phone"></i>
|
<i class="md_modal_section_icon md_modal_section_icon_phone"></i>
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
<div class="md_modal_body">
|
<div class="md_modal_body">
|
||||||
|
|
||||||
<div class="md_modal_sections">
|
<div class="md_modal_sections clearfix">
|
||||||
|
|
||||||
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_number" ng-if="user.phone || user.username">
|
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_number" ng-if="user.phone || user.username">
|
||||||
<i class="md_modal_section_icon md_modal_section_icon_phone"></i>
|
<i class="md_modal_section_icon md_modal_section_icon_phone"></i>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user