Comments: Fix opening invalid posts (#2915)
This commit is contained in:
parent
e070ffe8a0
commit
743715cdb1
@ -116,7 +116,7 @@ addActionHandler('preloadTopChatMessages', async (global, actions): Promise<void
|
|||||||
|
|
||||||
addActionHandler('openChat', (global, actions, payload): ActionReturnType => {
|
addActionHandler('openChat', (global, actions, payload): ActionReturnType => {
|
||||||
const {
|
const {
|
||||||
id, threadId = MAIN_THREAD_ID,
|
id, threadId = MAIN_THREAD_ID, noRequestThreadInfoUpdate,
|
||||||
} = payload;
|
} = payload;
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return;
|
return;
|
||||||
@ -142,7 +142,7 @@ addActionHandler('openChat', (global, actions, payload): ActionReturnType => {
|
|||||||
actions.requestChatUpdate({ chatId: id });
|
actions.requestChatUpdate({ chatId: id });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (threadId !== MAIN_THREAD_ID) {
|
if (threadId !== MAIN_THREAD_ID && !noRequestThreadInfoUpdate) {
|
||||||
actions.requestThreadInfoUpdate({ chatId: id, threadId });
|
actions.requestThreadInfoUpdate({ chatId: id, threadId });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -160,7 +160,9 @@ addActionHandler('openComments', async (global, actions, payload): Promise<void>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
actions.openChat({ id, threadId, tabId });
|
actions.openChat({
|
||||||
|
id, threadId, tabId, noRequestThreadInfoUpdate: true,
|
||||||
|
});
|
||||||
|
|
||||||
const result = await callApi('requestThreadInfoUpdate', { chat, threadId, originChannelId });
|
const result = await callApi('requestThreadInfoUpdate', { chat, threadId, originChannelId });
|
||||||
if (!result) {
|
if (!result) {
|
||||||
@ -176,9 +178,15 @@ addActionHandler('openComments', async (global, actions, payload): Promise<void>
|
|||||||
threadId: result.topMessageId,
|
threadId: result.topMessageId,
|
||||||
tabId,
|
tabId,
|
||||||
shouldReplaceLast: true,
|
shouldReplaceLast: true,
|
||||||
|
noRequestThreadInfoUpdate: true,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
actions.openChat({ id, threadId: topMessageId, tabId });
|
actions.openChat({
|
||||||
|
id,
|
||||||
|
threadId: topMessageId,
|
||||||
|
tabId,
|
||||||
|
noRequestThreadInfoUpdate: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -80,7 +80,7 @@ import {
|
|||||||
selectSendAs,
|
selectSendAs,
|
||||||
selectSponsoredMessage,
|
selectSponsoredMessage,
|
||||||
selectTabState,
|
selectTabState,
|
||||||
selectThreadIdFromMessage,
|
selectThreadIdFromMessage, selectThreadOriginChat,
|
||||||
selectThreadTopMessageId,
|
selectThreadTopMessageId,
|
||||||
selectUser,
|
selectUser,
|
||||||
selectViewportIds,
|
selectViewportIds,
|
||||||
@ -870,7 +870,9 @@ addActionHandler('requestThreadInfoUpdate', async (global, actions, payload): Pr
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await callApi('requestThreadInfoUpdate', { chat, threadId });
|
const originChannelId = selectThreadOriginChat(global, chatId, threadId)?.id;
|
||||||
|
|
||||||
|
const result = await callApi('requestThreadInfoUpdate', { chat, threadId, originChannelId });
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
global = getGlobal();
|
global = getGlobal();
|
||||||
global = addUsers(global, buildCollectionByKey(result.users, 'id'));
|
global = addUsers(global, buildCollectionByKey(result.users, 'id'));
|
||||||
|
|||||||
@ -1606,6 +1606,7 @@ export interface ActionPayloads {
|
|||||||
shouldReplaceHistory?: boolean;
|
shouldReplaceHistory?: boolean;
|
||||||
shouldReplaceLast?: boolean;
|
shouldReplaceLast?: boolean;
|
||||||
noForumTopicPanel?: boolean;
|
noForumTopicPanel?: boolean;
|
||||||
|
noRequestThreadInfoUpdate?: boolean;
|
||||||
} & WithTabId;
|
} & WithTabId;
|
||||||
openComments: {
|
openComments: {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user