Added edit message prevent when there is unsent recorded voice data.

This commit is contained in:
23rd 2020-11-11 00:50:22 +03:00 committed by John Preston
parent 6ecc446a8a
commit e0cc3791ff
3 changed files with 10 additions and 0 deletions

View File

@ -184,6 +184,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_edit_media_album_error" = "This file cannot be saved as a part of an album.";
"lng_edit_media_invalid_file" = "Sorry, no way to use this file.";
"lng_edit_caption_attach" = "Sorry, you can't attach a new media while you're editing your message.";
"lng_edit_caption_voice" = "Sorry, you can't edit your message while you're having an unsent voice message.";
"lng_intro_about" = "Welcome to the official Telegram Desktop app.\nIt's fast and secure.";
"lng_start_msgs" = "START MESSAGING";

View File

@ -5523,6 +5523,10 @@ void HistoryWidget::editMessage(FullMsgId itemId) {
}
void HistoryWidget::editMessage(not_null<HistoryItem*> item) {
if (_voiceRecordBar && _voiceRecordBar->isListenState()) {
Ui::show(Box<InformBox>(tr::lng_edit_caption_voice(tr::now)));
return;
}
if (const auto media = item->media()) {
if (media->allowsEditCaption()) {
Ui::show(Box<EditCaptionBox>(controller(), item));

View File

@ -1748,6 +1748,11 @@ void ComposeControls::editMessage(not_null<HistoryItem*> item) {
Expects(_history != nullptr);
Expects(draftKeyCurrent() != Data::DraftKey::None());
if (_voiceRecordBar && _voiceRecordBar->isListenState()) {
Ui::show(Box<InformBox>(tr::lng_edit_caption_voice(tr::now)));
return;
}
if (!isEditingMessage()) {
saveFieldToHistoryLocalDraft();
}