fixed leaving supergroup as creator

This commit is contained in:
Igor Zhukov 2018-01-16 10:23:17 +04:00
parent 4c00dca398
commit 0c614b0780

View File

@ -802,17 +802,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
function wrapParticipants(id, participants) {
var chat = getChat(id)
var myID = AppUsersManager.getSelf().id
if (isChannel(id)) {
var isAdmin = chat.pFlags.creator || chat.pFlags.editor || chat.pFlags.moderator
angular.forEach(participants, function (participant) {
participant.canLeave = participant._ == 'channelParticipantSelf'
participant.canLeave = myID == participant.user_id
participant.canKick = isAdmin && participant._ == 'channelParticipant'
// just for order by last seen
participant.user = AppUsersManager.getUser(participant.user_id)
})
} else {
var myID = AppUsersManager.getSelf().id
var isAdmin = chat.pFlags.creator || chat.pFlags.admins_enabled && chat.pFlags.admin
angular.forEach(participants, function (participant) {
participant.canLeave = myID == participant.user_id