From bf15a88c7ffb0571f6c00db97d20cabbd09e3c7c Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Sat, 24 Apr 2021 21:30:16 +0400 Subject: [PATCH] Forgot to remove last apiUpdate listener --- .../sidebarRight/tabs/groupPermissions.ts | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/components/sidebarRight/tabs/groupPermissions.ts b/src/components/sidebarRight/tabs/groupPermissions.ts index 51a3b176..5a204282 100644 --- a/src/components/sidebarRight/tabs/groupPermissions.ts +++ b/src/components/sidebarRight/tabs/groupPermissions.ts @@ -255,32 +255,30 @@ export default class AppGroupPermissionsTab extends SliderSuperTabEventable { //dom.lastMessageSpan.innerHTML = 'Can Add Users and Pin Messages'; }; - this.listenerSetter.add(rootScope, 'apiUpdate', (update: Update) => { - if(update._ === 'updateChannelParticipant') { - const needAdd = update.new_participant?._ === 'channelParticipantBanned' && !update.new_participant.banned_rights.pFlags.view_messages; - const li = list.querySelector(`[data-peer-id="${update.user_id}"]`); - if(needAdd) { - if(!li) { - add(update.new_participant as ChannelParticipant.channelParticipantBanned, false); - } else { - setSubtitle(li, update.new_participant as ChannelParticipant.channelParticipantBanned); - } - - if(update.prev_participant?._ !== 'channelParticipantBanned') { - ++exceptionsCount; - } + this.listenerSetter.add(rootScope, 'updateChannelParticipant', (update: Update.updateChannelParticipant) => { + const needAdd = update.new_participant?._ === 'channelParticipantBanned' && !update.new_participant.banned_rights.pFlags.view_messages; + const li = list.querySelector(`[data-peer-id="${update.user_id}"]`); + if(needAdd) { + if(!li) { + add(update.new_participant as ChannelParticipant.channelParticipantBanned, false); } else { - if(li) { - li.remove(); - } + setSubtitle(li, update.new_participant as ChannelParticipant.channelParticipantBanned); + } - if(update.prev_participant?._ === 'channelParticipantBanned') { - --exceptionsCount; - } + if(update.prev_participant?._ !== 'channelParticipantBanned') { + ++exceptionsCount; + } + } else { + if(li) { + li.remove(); } - setLength(); + if(update.prev_participant?._ === 'channelParticipantBanned') { + --exceptionsCount; + } } + + setLength(); }); const setLength = () => {