Browse Source

Kicked from group status

Restrict writing in kicked groups
master
Eduard Kuzmenko 3 years ago
parent
commit
365b30f888
  1. 1
      src/lang.ts
  2. 6
      src/lib/appManagers/appMessagesManager.ts
  3. 8
      src/lib/appManagers/appProfileManager.ts

1
src/lang.ts

@ -482,6 +482,7 @@ const lang = { @@ -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",

6
src/lib/appManagers/appMessagesManager.ts

@ -4454,9 +4454,9 @@ export class AppMessagesManager { @@ -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);
}

8
src/lib/appManagers/appProfileManager.ts

@ -465,7 +465,11 @@ export class AppProfileManager { @@ -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 { @@ -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);

Loading…
Cancel
Save