mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-27 12:55:11 +01:00
Fixes for t.me links (#1495)
This commit is contained in:
parent
90a695a0cd
commit
2243343ccc
@ -38,7 +38,7 @@ import {
|
||||
selectChatByUsername,
|
||||
selectThreadTopMessageId,
|
||||
selectCurrentMessageList,
|
||||
selectThreadInfo,
|
||||
selectThreadInfo, selectCurrentChat,
|
||||
} from '../../selectors';
|
||||
import { buildCollectionByKey } from '../../../util/iteratees';
|
||||
import { debounce, pause, throttle } from '../../../util/schedulers';
|
||||
@ -562,7 +562,7 @@ addReducer('openTelegramLink', (global, actions, payload) => {
|
||||
} else {
|
||||
actions.openChatByUsername({
|
||||
username,
|
||||
messageId,
|
||||
messageId: messageId || chatOrChannelPostId,
|
||||
commentId,
|
||||
});
|
||||
}
|
||||
@ -586,11 +586,32 @@ addReducer('openChatByUsername', (global, actions, payload) => {
|
||||
const { username, messageId, commentId } = payload!;
|
||||
|
||||
(async () => {
|
||||
const chat = selectCurrentChat(global);
|
||||
|
||||
if (!commentId) {
|
||||
if (chat && chat.username === username) {
|
||||
actions.focusMessage({ chatId: chat.id, messageId });
|
||||
return;
|
||||
}
|
||||
await openChatByUsername(actions, username, messageId);
|
||||
return;
|
||||
}
|
||||
|
||||
const { chatId, type } = selectCurrentMessageList(global) || {};
|
||||
const usernameChat = selectChatByUsername(global, username);
|
||||
if (chatId && usernameChat && type === 'thread') {
|
||||
const threadInfo = selectThreadInfo(global, chatId, messageId);
|
||||
|
||||
if (threadInfo && threadInfo.chatId === chatId) {
|
||||
actions.focusMessage({
|
||||
chatId: threadInfo.chatId,
|
||||
threadId: threadInfo.threadId,
|
||||
messageId: commentId,
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!messageId) return;
|
||||
|
||||
await openCommentsByUsername(actions, username, messageId, commentId);
|
||||
|
Loading…
Reference in New Issue
Block a user