mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Allow editing messages even if sending is not allowed.
This commit is contained in:
parent
f46f655a0e
commit
8a99de16f6
1 changed files with 14 additions and 14 deletions
|
@ -1763,7 +1763,7 @@ void HistoryWidget::setInnerFocus() {
|
||||||
|| isRecording()
|
|| isRecording()
|
||||||
|| isBotStart()
|
|| isBotStart()
|
||||||
|| isBlocked()
|
|| isBlocked()
|
||||||
|| !_canSendTexts) {
|
|| (!_canSendTexts && !_editMsgId)) {
|
||||||
if (_scroll->isHidden()) {
|
if (_scroll->isHidden()) {
|
||||||
setFocus();
|
setFocus();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1881,10 +1881,6 @@ void HistoryWidget::fastShowAtEnd(not_null<History*> history) {
|
||||||
bool HistoryWidget::applyDraft(FieldHistoryAction fieldHistoryAction) {
|
bool HistoryWidget::applyDraft(FieldHistoryAction fieldHistoryAction) {
|
||||||
InvokeQueued(this, [=] { updateStickersByEmoji(); });
|
InvokeQueued(this, [=] { updateStickersByEmoji(); });
|
||||||
|
|
||||||
if (_voiceRecordBar->isActive() || !_canSendTexts) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto editDraft = _history ? _history->localEditDraft({}) : nullptr;
|
const auto editDraft = _history ? _history->localEditDraft({}) : nullptr;
|
||||||
const auto draft = editDraft
|
const auto draft = editDraft
|
||||||
? editDraft
|
? editDraft
|
||||||
|
@ -1892,7 +1888,15 @@ bool HistoryWidget::applyDraft(FieldHistoryAction fieldHistoryAction) {
|
||||||
? _history->localDraft({})
|
? _history->localDraft({})
|
||||||
: nullptr;
|
: nullptr;
|
||||||
auto fieldAvailable = canWriteMessage();
|
auto fieldAvailable = canWriteMessage();
|
||||||
if (!draft || (!_history->localEditDraft({}) && !fieldAvailable)) {
|
const auto editMsgId = editDraft ? editDraft->msgId : 0;
|
||||||
|
if (_voiceRecordBar->isActive() || (!_canSendTexts && !editMsgId)) {
|
||||||
|
if (!_canSendTexts) {
|
||||||
|
clearFieldText(0, fieldHistoryAction);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!draft || (!editDraft && !fieldAvailable)) {
|
||||||
auto fieldWillBeHiddenAfterEdit = (!fieldAvailable && _editMsgId != 0);
|
auto fieldWillBeHiddenAfterEdit = (!fieldAvailable && _editMsgId != 0);
|
||||||
clearFieldText(0, fieldHistoryAction);
|
clearFieldText(0, fieldHistoryAction);
|
||||||
setInnerFocus();
|
setInnerFocus();
|
||||||
|
@ -1922,11 +1926,7 @@ bool HistoryWidget::applyDraft(FieldHistoryAction fieldHistoryAction) {
|
||||||
|
|
||||||
_processingReplyItem = _replyEditMsg = nullptr;
|
_processingReplyItem = _replyEditMsg = nullptr;
|
||||||
_processingReplyId = _replyToId = 0;
|
_processingReplyId = _replyToId = 0;
|
||||||
if (const auto editDraft = _history->localEditDraft({})) {
|
setEditMsgId(editMsgId);
|
||||||
setEditMsgId(editDraft->msgId);
|
|
||||||
} else {
|
|
||||||
setEditMsgId(0);
|
|
||||||
}
|
|
||||||
updateCmdStartShown();
|
updateCmdStartShown();
|
||||||
updateControlsVisibility();
|
updateControlsVisibility();
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
|
@ -2805,7 +2805,7 @@ void HistoryWidget::updateControlsVisibility() {
|
||||||
_send->show();
|
_send->show();
|
||||||
updateSendButtonType();
|
updateSendButtonType();
|
||||||
|
|
||||||
if (_canSendTexts) {
|
if (_canSendTexts || _editMsgId) {
|
||||||
_field->show();
|
_field->show();
|
||||||
} else {
|
} else {
|
||||||
fieldDisabledRemoved = false;
|
fieldDisabledRemoved = false;
|
||||||
|
@ -4922,7 +4922,7 @@ void HistoryWidget::recountChatWidth() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int HistoryWidget::fieldHeight() const {
|
int HistoryWidget::fieldHeight() const {
|
||||||
return _canSendTexts
|
return (_canSendTexts || _editMsgId)
|
||||||
? _field->height()
|
? _field->height()
|
||||||
: (st::historySendSize.height() - 2 * st::historySendPadding);
|
: (st::historySendSize.height() - 2 * st::historySendPadding);
|
||||||
}
|
}
|
||||||
|
@ -7641,7 +7641,7 @@ void HistoryWidget::updateTopBarSelection() {
|
||||||
|| isRecording()
|
|| isRecording()
|
||||||
|| isBotStart()
|
|| isBotStart()
|
||||||
|| isBlocked()
|
|| isBlocked()
|
||||||
|| !_canSendTexts) {
|
|| (!_canSendTexts && !_editMsgId)) {
|
||||||
_list->setFocus();
|
_list->setFocus();
|
||||||
} else {
|
} else {
|
||||||
_field->setFocus();
|
_field->setFocus();
|
||||||
|
|
Loading…
Add table
Reference in a new issue