Message List: Fix opening some private channels
This commit is contained in:
parent
297352d329
commit
93991e5cb1
@ -904,13 +904,32 @@ export async function openChatByInvite(hash: string) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (result instanceof GramJs.ChatInvite) {
|
||||
await invokeRequest(new GramJs.messages.ImportChatInvite({ hash }), true);
|
||||
let chat: ApiChat | undefined;
|
||||
|
||||
return undefined;
|
||||
if (result instanceof GramJs.ChatInvite) {
|
||||
const updates = await invokeRequest(new GramJs.messages.ImportChatInvite({ hash }), true);
|
||||
if (!(updates instanceof GramJs.Updates) || !updates.chats.length) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
chat = buildApiChatFromPreview(updates.chats[0]);
|
||||
} else {
|
||||
return buildApiChatFromPreview(result.chat);
|
||||
chat = buildApiChatFromPreview(result.chat);
|
||||
|
||||
if (chat) {
|
||||
onUpdate({
|
||||
'@type': 'updateChat',
|
||||
id: chat.id,
|
||||
chat,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!chat) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return { chatId: chat.id };
|
||||
}
|
||||
|
||||
function preparePeers(
|
||||
|
||||
@ -386,13 +386,12 @@ addReducer('openTelegramLink', (global, actions, payload) => {
|
||||
const hash = match[1];
|
||||
|
||||
(async () => {
|
||||
const chat = await callApi('openChatByInvite', hash);
|
||||
|
||||
if (!chat) {
|
||||
const result = await callApi('openChatByInvite', hash);
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
|
||||
actions.openChat({ id: chat.id });
|
||||
actions.openChat({ id: result.chatId });
|
||||
})();
|
||||
} else {
|
||||
match = RE_TME_LINK.exec(url)!;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user