mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Don't suggest "Set As Quick" on already quick.
This commit is contained in:
parent
4d11ad45db
commit
9a451a1423
5 changed files with 28 additions and 14 deletions
|
@ -1852,7 +1852,10 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
const auto link = ClickHandler::getActive();
|
||||
if (link
|
||||
&& !link->property(kSendReactionEmojiProperty).toString().isEmpty()
|
||||
&& _reactionsManager->showContextMenu(this, e)) {
|
||||
&& _reactionsManager->showContextMenu(
|
||||
this,
|
||||
e,
|
||||
session().data().reactions().favorite())) {
|
||||
return;
|
||||
}
|
||||
auto selectedState = getSelectionState();
|
||||
|
|
|
@ -1126,10 +1126,8 @@ void ShowWhoReactedMenu(
|
|||
const auto reactions = &controller->session().data().reactions();
|
||||
const auto &list = reactions->list(
|
||||
Data::Reactions::Type::Active);
|
||||
const auto active = ranges::contains(
|
||||
list,
|
||||
emoji,
|
||||
&Data::Reaction::emoji);
|
||||
const auto activeNonQuick = (emoji != reactions->favorite())
|
||||
&& ranges::contains(list, emoji, &Data::Reaction::emoji);
|
||||
const auto filler = lifetime.make_state<Ui::WhoReactedListMenu>(
|
||||
participantChosen,
|
||||
showAllChosen);
|
||||
|
@ -1143,7 +1141,7 @@ void ShowWhoReactedMenu(
|
|||
}) | rpl::start_with_next([=, &lifetime](Ui::WhoReadContent &&content) {
|
||||
const auto creating = !*menu;
|
||||
const auto refill = [=] {
|
||||
if (active) {
|
||||
if (activeNonQuick) {
|
||||
(*menu)->addAction(tr::lng_context_set_as_quick(tr::now), [=] {
|
||||
reactions->setFavorite(emoji);
|
||||
}, &st::menuIconFave);
|
||||
|
|
|
@ -2096,7 +2096,10 @@ void ListWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
const auto link = ClickHandler::getActive();
|
||||
if (link
|
||||
&& !link->property(kSendReactionEmojiProperty).toString().isEmpty()
|
||||
&& _reactionsManager->showContextMenu(this, e)) {
|
||||
&& _reactionsManager->showContextMenu(
|
||||
this,
|
||||
e,
|
||||
session().data().reactions().favorite())) {
|
||||
return;
|
||||
}
|
||||
const auto overItem = _overItemExact
|
||||
|
|
|
@ -1553,19 +1553,26 @@ void Manager::recordCurrentReactionEffect(FullMsgId itemId, QPoint origin) {
|
|||
}
|
||||
}
|
||||
|
||||
bool Manager::showContextMenu(QWidget *parent, QContextMenuEvent *e) {
|
||||
bool Manager::showContextMenu(
|
||||
QWidget *parent,
|
||||
QContextMenuEvent *e,
|
||||
const QString &favorite) {
|
||||
if (_icons.empty() || _selectedIcon < 0) {
|
||||
return false;
|
||||
}
|
||||
const auto lookupSelectedEmoji = [&] {
|
||||
const auto i = ranges::find(_icons, true, &ReactionIcons::selected);
|
||||
return (i != end(_icons)) ? (*i)->emoji : QString();
|
||||
};
|
||||
if (!favorite.isEmpty() && lookupSelectedEmoji() == favorite) {
|
||||
return true;
|
||||
}
|
||||
_menu = base::make_unique_q<Ui::PopupMenu>(
|
||||
parent,
|
||||
st::popupMenuWithIcons);
|
||||
const auto callback = [=] {
|
||||
for (const auto &icon : _icons) {
|
||||
if (icon->selected) {
|
||||
_faveRequests.fire_copy(icon->emoji);
|
||||
return;
|
||||
}
|
||||
if (const auto emoji = lookupSelectedEmoji(); !emoji.isEmpty()) {
|
||||
_faveRequests.fire_copy(emoji);
|
||||
}
|
||||
};
|
||||
_menu->addAction(
|
||||
|
|
|
@ -177,7 +177,10 @@ public:
|
|||
-> not_null<Ui::ReactionEffectPainter*>;
|
||||
void recordCurrentReactionEffect(FullMsgId itemId, QPoint origin);
|
||||
|
||||
bool showContextMenu(QWidget *parent, QContextMenuEvent *e);
|
||||
bool showContextMenu(
|
||||
QWidget *parent,
|
||||
QContextMenuEvent *e,
|
||||
const QString &favorite);
|
||||
[[nodiscard]] rpl::producer<QString> faveRequests() const;
|
||||
|
||||
[[nodiscard]] rpl::lifetime &lifetime() {
|
||||
|
|
Loading…
Add table
Reference in a new issue