Fix drag area in comments appearance.

This commit is contained in:
John Preston 2023-02-15 10:02:14 +04:00
parent bb900c195c
commit 3573b84e8b
2 changed files with 20 additions and 2 deletions

View file

@ -511,7 +511,16 @@ HistoryWidget::HistoryWidget(
_attachDragAreas = DragArea::SetupDragAreaToContainer(
this,
crl::guard(this, [=](not_null<const QMimeData*> d) {
return _history && _canSendMessages && !isRecording();
if (!_peer || isRecording()) {
return false;
}
const auto replyTo = (_replyToId && !_editMsgId)
? _replyEditMsg
: 0;
const auto topic = replyTo ? replyTo->topic() : nullptr;
return topic
? Data::CanSendAnyOf(topic, Data::FilesSendRestrictions())
: Data::CanSendAnyOf(_peer, Data::FilesSendRestrictions());
}),
crl::guard(this, [=](bool f) { _field->setAcceptDrops(f); }),
crl::guard(this, [=] { updateControlsGeometry(); }));

View file

@ -2616,9 +2616,18 @@ void RepliesWidget::clearSelected() {
}
void RepliesWidget::setupDragArea() {
const auto filter = [=](const auto &d) {
if (!_history || _composeControls->isRecording()) {
return false;
}
const auto peer = _history->peer;
return _topic
? Data::CanSendAnyOf(_topic, Data::FilesSendRestrictions())
: Data::CanSendAnyOf(peer, Data::FilesSendRestrictions());
};
const auto areas = DragArea::SetupDragAreaToContainer(
this,
[=](auto d) { return _history && !_composeControls->isRecording(); },
filter,
nullptr,
[=] { updateControlsGeometry(); });