Kicked from group status

Restrict writing in kicked groups
This commit is contained in:
Eduard Kuzmenko 2021-06-29 18:42:35 +03:00
parent 38daa43ad8
commit 365b30f888
3 changed files with 10 additions and 5 deletions

View File

@ -482,6 +482,7 @@ const lang = {
"formatDateAtTime": "%1$s at %2$s",
"JoinByPeekChannelTitle": "Join Channel",
"JoinByPeekGroupTitle": "Join Group",
"YouWereKicked": "you were removed",
// * macos
"AccountSettings.Filters": "Chat Folders",

View File

@ -4454,9 +4454,9 @@ export class AppMessagesManager {
public canWriteToPeer(peerId: number, threadId?: number) {
if(peerId < 0) {
const isChannel = appPeersManager.isChannel(peerId);
const hasRights = isChannel && appChatsManager.hasRights(-peerId, 'send_messages', undefined, !!threadId);
return !isChannel || hasRights;
//const isChannel = appPeersManager.isChannel(peerId);
const hasRights = /* isChannel && */appChatsManager.hasRights(-peerId, 'send_messages', undefined, !!threadId);
return /* !isChannel || */hasRights;
} else {
return appUsersManager.canSendToUser(peerId);
}

View File

@ -465,7 +465,11 @@ export class AppProfileManager {
}
public getChatMembersString(id: number) {
const chat = appChatsManager.getChat(id);
const chat: Chat = appChatsManager.getChat(id);
if(chat._ === 'chatForbidden') {
return i18n('YouWereKicked');
}
const chatFull = this.chatsFull[id];
let count: number;
if(chatFull) {
@ -475,7 +479,7 @@ export class AppProfileManager {
count = (chatFull.participants as ChatParticipants.chatParticipants).participants?.length;
}
} else {
count = chat.participants_count || chat.participants?.participants.length;
count = (chat as Chat.chat).participants_count || (chat as any).participants?.participants.length;
}
const isChannel = appChatsManager.isBroadcast(id);