Messages: Fix deleting in the selected messages modal (#4927)
This commit is contained in:
parent
a59a3a4217
commit
342a3d92da
@ -20,13 +20,13 @@ import {
|
||||
isUserId,
|
||||
} from '../../global/helpers';
|
||||
import {
|
||||
getSendersFromSelectedMessages,
|
||||
selectCanDeleteSelectedMessages,
|
||||
selectChatFullInfo,
|
||||
selectCurrentChat,
|
||||
selectCurrentMessageIds,
|
||||
selectCurrentMessageList,
|
||||
selectSenderFromMessage,
|
||||
selectSendersFromSelectedMessages,
|
||||
selectTabState,
|
||||
selectUser,
|
||||
} from '../../global/selectors';
|
||||
@ -119,7 +119,8 @@ const DeleteSelectedMessageModal: FC<OwnProps & StateProps> = ({
|
||||
if (isChannel) {
|
||||
return undefined;
|
||||
}
|
||||
return selectSendersFromSelectedMessages(getGlobal(), chat);
|
||||
const senderArray = getSendersFromSelectedMessages(getGlobal(), chat);
|
||||
return senderArray?.filter(Boolean);
|
||||
// eslint-disable-next-line react-hooks-static-deps/exhaustive-deps
|
||||
}, [chat, isChannel, isOpen]);
|
||||
|
||||
|
||||
@ -213,30 +213,32 @@ addActionHandler('loadViewportMessages', (global, actions, payload): ActionRetur
|
||||
const isOutlying = Boolean(listedIds && !listedIds.includes(offsetId));
|
||||
const historyIds = (isOutlying
|
||||
? selectOutlyingListByMessageId(global, chatId, threadId, offsetId) : listedIds)!;
|
||||
const {
|
||||
newViewportIds, areSomeLocal, areAllLocal,
|
||||
} = getViewportSlice(historyIds, offsetId, direction);
|
||||
if (historyIds?.length) {
|
||||
const {
|
||||
newViewportIds, areSomeLocal, areAllLocal,
|
||||
} = getViewportSlice(historyIds, offsetId, direction);
|
||||
|
||||
if (areSomeLocal) {
|
||||
global = safeReplaceViewportIds(global, chatId, threadId, newViewportIds, tabId);
|
||||
if (areSomeLocal) {
|
||||
global = safeReplaceViewportIds(global, chatId, threadId, newViewportIds, tabId);
|
||||
}
|
||||
|
||||
onTickEnd(() => {
|
||||
void loadWithBudget(
|
||||
global,
|
||||
actions,
|
||||
areAllLocal,
|
||||
isOutlying,
|
||||
isBudgetPreload,
|
||||
chat,
|
||||
threadId!,
|
||||
direction,
|
||||
offsetId,
|
||||
onLoaded,
|
||||
tabId,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
onTickEnd(() => {
|
||||
void loadWithBudget(
|
||||
global,
|
||||
actions,
|
||||
areAllLocal,
|
||||
isOutlying,
|
||||
isBudgetPreload,
|
||||
chat,
|
||||
threadId!,
|
||||
direction,
|
||||
offsetId,
|
||||
onLoaded,
|
||||
tabId,
|
||||
);
|
||||
});
|
||||
|
||||
if (isBudgetPreload) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@ export function selectSender<T extends GlobalState>(global: T, message: ApiMessa
|
||||
return selectPeer(global, senderId);
|
||||
}
|
||||
|
||||
export function selectSendersFromSelectedMessages<T extends GlobalState>(
|
||||
export function getSendersFromSelectedMessages<T extends GlobalState>(
|
||||
global: T,
|
||||
chat: ApiChat | undefined,
|
||||
...[tabId = getCurrentTabId()]: TabArgs<T>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user