mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Disable effects for inline results sending.
This commit is contained in:
parent
26345208a9
commit
12eecec501
4 changed files with 26 additions and 7 deletions
|
@ -390,11 +390,20 @@ base::unique_qptr<Ui::PopupMenu> GifsListWidget::fillContextMenu(
|
|||
const auto send = crl::guard(this, [=](Api::SendOptions options) {
|
||||
selectInlineResult(selected, options, true);
|
||||
});
|
||||
const auto item = _mosaic.maybeItemAt(_selected);
|
||||
const auto isInlineResult = !item->getPhoto()
|
||||
&& !item->getDocument()
|
||||
&& item->getResult();
|
||||
const auto icons = &st().icons;
|
||||
auto copyDetails = details;
|
||||
if (isInlineResult) {
|
||||
// inline results don't have effects
|
||||
copyDetails.effectAllowed = false;
|
||||
}
|
||||
SendMenu::FillSendMenu(
|
||||
menu,
|
||||
_show,
|
||||
details,
|
||||
copyDetails,
|
||||
SendMenu::DefaultCallback(_show, send),
|
||||
icons);
|
||||
|
||||
|
|
|
@ -4211,7 +4211,7 @@ void HistoryWidget::sendScheduled(Api::SendOptions initialOptions) {
|
|||
HistoryView::PrepareScheduleBox(
|
||||
_list,
|
||||
controller()->uiShow(),
|
||||
sendMenuDetails(),
|
||||
sendButtonDefaultDetails(),
|
||||
[=](Api::SendOptions options) { send(options); },
|
||||
initialOptions));
|
||||
}
|
||||
|
@ -4224,9 +4224,7 @@ SendMenu::Details HistoryWidget::sendMenuDetails() const {
|
|||
: HistoryView::CanScheduleUntilOnline(_peer)
|
||||
? SendMenu::Type::ScheduledToUser
|
||||
: SendMenu::Type::Scheduled;
|
||||
const auto effectAllowed = _peer
|
||||
&& _peer->isUser()
|
||||
&& (HasSendText(_field) || _previewDrawPreview);
|
||||
const auto effectAllowed = _peer && _peer->isUser();
|
||||
return { .type = type, .effectAllowed = effectAllowed };
|
||||
}
|
||||
|
||||
|
@ -4257,7 +4255,15 @@ SendMenu::Details HistoryWidget::sendButtonMenuDetails() const {
|
|||
} else if (type != Type::Send) {
|
||||
return {};
|
||||
}
|
||||
return sendMenuDetails();
|
||||
return sendButtonDefaultDetails();
|
||||
}
|
||||
|
||||
SendMenu::Details HistoryWidget::sendButtonDefaultDetails() const {
|
||||
auto result = sendMenuDetails();
|
||||
if (!HasSendText(_field) && !_previewDrawPreview) {
|
||||
result.effectAllowed = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void HistoryWidget::unblockUser() {
|
||||
|
|
|
@ -398,6 +398,7 @@ private:
|
|||
void sendWithModifiers(Qt::KeyboardModifiers modifiers);
|
||||
void sendScheduled(Api::SendOptions initialOptions);
|
||||
[[nodiscard]] SendMenu::Details sendButtonMenuDetails() const;
|
||||
[[nodiscsard]] SendMenu::Details sendButtonDefaultDetails() const;
|
||||
void handlePendingHistoryUpdate();
|
||||
void fullInfoUpdated();
|
||||
void toggleTabbedSelectorMode();
|
||||
|
|
|
@ -329,10 +329,13 @@ void Inner::contextMenuEvent(QContextMenuEvent *e) {
|
|||
if (_selected < 0 || _pressed >= 0) {
|
||||
return;
|
||||
}
|
||||
const auto details = _sendMenuDetails
|
||||
auto details = _sendMenuDetails
|
||||
? _sendMenuDetails()
|
||||
: SendMenu::Details();
|
||||
|
||||
// inline results don't have effects
|
||||
details.effectAllowed = false;
|
||||
|
||||
_menu = base::make_unique_q<Ui::PopupMenu>(
|
||||
this,
|
||||
st::popupMenuWithIcons);
|
||||
|
|
Loading…
Add table
Reference in a new issue