Updates: Fix chat composer visible after join (#6633)
This commit is contained in:
parent
a662e58e78
commit
408ee1e2b0
@ -217,9 +217,24 @@ function buildApiChatRestrictions(peerEntity: Entity): {
|
||||
};
|
||||
}
|
||||
|
||||
const restrictions = {};
|
||||
const restrictions: {
|
||||
isNotJoined?: boolean;
|
||||
isForbidden?: boolean;
|
||||
isRestricted?: boolean;
|
||||
restrictionReasons?: ApiRestrictionReason[];
|
||||
} = {};
|
||||
|
||||
if ('restricted' in peerEntity && !peerEntity.min) {
|
||||
const isMin = 'min' in peerEntity && peerEntity.min;
|
||||
const hasRestricted = 'restricted' in peerEntity;
|
||||
|
||||
if (!isMin) {
|
||||
Object.assign(restrictions, {
|
||||
isForbidden: undefined,
|
||||
isRestricted: undefined,
|
||||
});
|
||||
}
|
||||
|
||||
if (hasRestricted && !isMin) {
|
||||
const restrictionReasons = buildApiRestrictionReasons(peerEntity.restrictionReason);
|
||||
|
||||
Object.assign(restrictions, {
|
||||
|
||||
@ -243,6 +243,16 @@ export function updater(update: Update) {
|
||||
},
|
||||
});
|
||||
}
|
||||
} else if (action instanceof GramJs.MessageActionChatJoinedByLink) {
|
||||
const { fromId } = update.message;
|
||||
if (fromId instanceof GramJs.PeerUser && update._entities?.some((e): e is GramJs.User => (
|
||||
e instanceof GramJs.User && Boolean(e.self) && e.id === fromId.userId
|
||||
))) {
|
||||
sendApiUpdate({
|
||||
'@type': 'updateChatJoin',
|
||||
id: message.chatId,
|
||||
});
|
||||
}
|
||||
} else if (action instanceof GramJs.MessageActionChatAddUser) {
|
||||
if (update._entities && update._entities.some((e): e is GramJs.User => (
|
||||
e instanceof GramJs.User && Boolean(e.self) && action.users.includes(e.id)
|
||||
|
||||
@ -124,7 +124,8 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
||||
const listType = selectChatListType(global, update.id);
|
||||
const chat = selectChat(global, update.id);
|
||||
|
||||
global = updateChat(global, update.id, { isNotJoined: false });
|
||||
global = updateChat(global, update.id, { isNotJoined: false, isForbidden: false });
|
||||
|
||||
setGlobal(global);
|
||||
|
||||
if (chat) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user