Allow select single album part under spoiler.

This commit is contained in:
John Preston 2023-11-27 10:21:22 +04:00
parent d6d76c8477
commit aa29d1c619
1 changed files with 14 additions and 6 deletions

View File

@ -2362,9 +2362,14 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
}
};
const auto addSelectMessageAction = [&](
not_null<HistoryItem*> item,
bool asGroup = true) {
const auto asGroup = !Element::Moused()
|| (Element::Moused() != Element::Hovered())
|| (Element::Moused()->pointState(
mapPointToItem(
mapFromGlobal(_mousePosition),
Element::Moused())
) != HistoryView::PointState::GroupPart);
const auto addSelectMessageAction = [&](not_null<HistoryItem*> item) {
if (item->isRegular()
&& !item->isService()
&& !hasSelectRestriction()) {
@ -2523,7 +2528,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
}, &st::menuIconReport);
}
}
addSelectMessageAction(item, false);
addSelectMessageAction(item);
if (isUponSelected != -2 && blockSender) {
_menu->addAction(tr::lng_profile_block_user(tr::now), [=] {
blockSenderItem(itemId);
@ -2540,6 +2545,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
: nullptr;
return result ? groupLeaderOrSelf(result) : nullptr;
}();
const auto partItemOrLeader = (asGroup || !albumPartItem)
? item
: albumPartItem;
const auto itemId = item ? item->fullId() : FullMsgId();
const auto canDelete = item
&& item->canDelete()
@ -2576,7 +2584,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
}
addItemActions(item, item);
} else {
addReplyAction(item);
addReplyAction(partItemOrLeader);
addItemActions(item, albumPartItem);
if (item && !isUponSelected) {
const auto media = (view ? view->media() : nullptr);
@ -2723,7 +2731,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
}, &st::menuIconReport);
}
}
addSelectMessageAction(item);
addSelectMessageAction(partItemOrLeader);
if (isUponSelected != -2 && canBlockSender) {
_menu->addAction(tr::lng_profile_block_user(tr::now), [=] {
blockSenderAsGroup(itemId);