Draft: Fix clearDraft (#6094)

This commit is contained in:
Alexander Zinchuk 2025-07-31 00:53:19 +02:00
parent 4713c63fa4
commit 25721d514e

View File

@ -684,10 +684,11 @@ addActionHandler('clearDraft', (global, actions, payload): ActionReturnType => {
const currentReplyInfo = currentDraft.replyInfo;
const newDraft: ApiDraft | undefined = (shouldKeepReply || shouldKeepSuggestedPost) ? {
replyInfo: shouldKeepReply ? currentReplyInfo : undefined,
suggestedPostInfo: shouldKeepSuggestedPost ? currentDraft.suggestedPostInfo : undefined,
} : undefined;
const newDraft: ApiDraft | undefined = (shouldKeepReply && currentReplyInfo)
|| (shouldKeepSuggestedPost && currentDraft.suggestedPostInfo) ? {
replyInfo: shouldKeepReply ? currentReplyInfo : undefined,
suggestedPostInfo: shouldKeepSuggestedPost ? currentDraft.suggestedPostInfo : undefined,
} : undefined;
saveDraft({
global, chatId, threadId, draft: newDraft, isLocalOnly,