mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Fix replace media button non-disappearance.
This commit is contained in:
parent
a02ded6fd8
commit
22ca4e25d9
1 changed files with 15 additions and 12 deletions
|
@ -1910,22 +1910,29 @@ void ComposeControls::applyCloudDraft() {
|
|||
void ComposeControls::applyDraft(FieldHistoryAction fieldHistoryAction) {
|
||||
Expects(_history != nullptr);
|
||||
|
||||
InvokeQueued(_autocomplete.get(), [=] { updateStickersByEmoji(); });
|
||||
const auto guard = gsl::finally([&] {
|
||||
updateSendButtonType();
|
||||
updateControlsVisibility();
|
||||
updateControlsGeometry(_wrap->size());
|
||||
});
|
||||
|
||||
const auto editDraft = _history->draft(draftKey(DraftType::Edit));
|
||||
const auto draft = editDraft
|
||||
? editDraft
|
||||
: _history->draft(draftKey(DraftType::Normal));
|
||||
const auto editingId = (draft == editDraft)
|
||||
? FullMsgId{ _history->peer->id, draft ? draft->msgId : 0 }
|
||||
: FullMsgId();
|
||||
|
||||
InvokeQueued(_autocomplete.get(), [=] { updateStickersByEmoji(); });
|
||||
const auto guard = gsl::finally([&] {
|
||||
updateSendButtonType();
|
||||
updateReplaceMediaButton(editingId);
|
||||
updateControlsVisibility();
|
||||
updateControlsGeometry(_wrap->size());
|
||||
});
|
||||
|
||||
if (!draft) {
|
||||
clearFieldText(0, fieldHistoryAction);
|
||||
_field->setFocus();
|
||||
_header->editMessage({});
|
||||
_header->replyToMessage({});
|
||||
_canReplaceMedia = false;
|
||||
_photoEditMedia = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1939,15 +1946,11 @@ void ComposeControls::applyDraft(FieldHistoryAction fieldHistoryAction) {
|
|||
}
|
||||
|
||||
if (draft == editDraft) {
|
||||
_header->editMessage({ _history->peer->id, draft->msgId });
|
||||
_header->editMessage(editingId);
|
||||
_header->replyToMessage({});
|
||||
} else {
|
||||
_canReplaceMedia = false;
|
||||
_photoEditMedia = nullptr;
|
||||
if (updateReplaceMediaButton(FullMsgId())) {
|
||||
updateControlsVisibility();
|
||||
updateControlsGeometry(_wrap->size());
|
||||
}
|
||||
_header->replyToMessage({ _history->peer->id, draft->msgId });
|
||||
if (_header->replyingToMessage()) {
|
||||
cancelForward();
|
||||
|
|
Loading…
Add table
Reference in a new issue