mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Request WhoRead/Reacted only for group leader.
This commit is contained in:
parent
4eefebc96c
commit
480c109b09
1 changed files with 15 additions and 14 deletions
|
@ -2128,21 +2128,30 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
isUponSelected = hasSelected;
|
||||
}
|
||||
|
||||
const auto hasWhoReactedItem = _dragStateItem
|
||||
&& Api::WhoReactedExists(_dragStateItem, Api::WhoReactedList::All);
|
||||
const auto groupLeaderOrSelf = [](HistoryItem *item) -> HistoryItem* {
|
||||
if (!item) {
|
||||
return nullptr;
|
||||
} else if (const auto group = item->history()->owner().groups().find(item)) {
|
||||
return group->items.front();
|
||||
}
|
||||
return item;
|
||||
};
|
||||
const auto whoReactedItem = groupLeaderOrSelf(_dragStateItem);
|
||||
const auto hasWhoReactedItem = whoReactedItem
|
||||
&& Api::WhoReactedExists(whoReactedItem, Api::WhoReactedList::All);
|
||||
const auto clickedReaction = link
|
||||
? link->property(
|
||||
kReactionsCountEmojiProperty).value<Data::ReactionId>()
|
||||
: Data::ReactionId();
|
||||
_whoReactedMenuLifetime.destroy();
|
||||
if (!clickedReaction.empty()
|
||||
&& _dragStateItem
|
||||
&& Api::WhoReactedExists(_dragStateItem, Api::WhoReactedList::One)) {
|
||||
&& whoReactedItem
|
||||
&& Api::WhoReactedExists(whoReactedItem, Api::WhoReactedList::One)) {
|
||||
HistoryView::ShowWhoReactedMenu(
|
||||
&_menu,
|
||||
e->globalPos(),
|
||||
this,
|
||||
_dragStateItem,
|
||||
whoReactedItem,
|
||||
clickedReaction,
|
||||
_controller,
|
||||
_whoReactedMenuLifetime);
|
||||
|
@ -2152,14 +2161,6 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
_menu = base::make_unique_q<Ui::PopupMenu>(this, st::popupMenuWithIcons);
|
||||
const auto session = &this->session();
|
||||
const auto controller = _controller;
|
||||
const auto groupLeaderOrSelf = [](HistoryItem *item) -> HistoryItem* {
|
||||
if (!item) {
|
||||
return nullptr;
|
||||
} else if (const auto group = item->history()->owner().groups().find(item)) {
|
||||
return group->items.front();
|
||||
}
|
||||
return item;
|
||||
};
|
||||
const auto addItemActions = [&](
|
||||
HistoryItem *item,
|
||||
HistoryItem *albumPartItem) {
|
||||
|
@ -2630,7 +2631,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
HistoryView::AddWhoReactedAction(
|
||||
_menu,
|
||||
this,
|
||||
_dragStateItem,
|
||||
whoReactedItem,
|
||||
_controller);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue