fix: show notice for unforwardable messages

This commit is contained in:
AlexeyZavar 2025-09-12 00:43:11 +03:00
parent 41523b03d1
commit 28ceb0bed2
2 changed files with 9 additions and 14 deletions

View file

@ -3189,17 +3189,17 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
if (_dragStateItem) {
const auto view = viewByItem(_dragStateItem);
const auto textItem = view ? view->textItem() : _dragStateItem;
/*const auto wasAmount = _menu->actions().size();*/
const auto wasAmount = _menu->actions().size();
HistoryView::AddEmojiPacksAction(
_menu,
textItem ? textItem : _dragStateItem,
HistoryView::EmojiPacksSource::Message,
_controller);
/*const auto added = (_menu->actions().size() > wasAmount);
const auto added = (_menu->actions().size() > wasAmount);
HistoryView::AddSelectRestrictionAction(
_menu,
textItem ? textItem : _dragStateItem,
!added);*/
!added);
}
if (hasWhoReactedItem) {
HistoryView::AddWhoReactedAction(

View file

@ -95,6 +95,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
// AyuGram includes
#include "ayu/ayu_settings.h"
#include "ayu/features/forward/ayu_forward.h"
#include "ayu/ui/context_menu/context_menu.h"
@ -1419,7 +1420,7 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
AddCopyLinkAction(result, link);
AddMessageActions(result, request, list);
/*const auto wasAmount = result->actions().size();*/
const auto wasAmount = result->actions().size();
if (const auto textItem = view ? view->textItem() : item) {
AddEmojiPacksAction(
result,
@ -1427,10 +1428,10 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
HistoryView::EmojiPacksSource::Message,
list->controller());
}
/*if (item) {
if (item) {
const auto added = (result->actions().size() > wasAmount);
AddSelectRestrictionAction(result, item, !added);
}*/
}
if (hasWhoReactedItem) {
AddWhoReactedAction(result, list, item, list->controller());
} else if (item) {
@ -2076,7 +2077,7 @@ void AddSelectRestrictionAction(
not_null<HistoryItem*> item,
bool addIcon) {
const auto peer = item->history()->peer;
if ((peer->allowsForwarding() && !item->forbidsForward())
if ((!peer->isAyuNoForwards() && !AyuForward::isAyuForwardNeeded(item))
|| item->isSponsored()) {
return;
}
@ -2090,13 +2091,7 @@ void AddSelectRestrictionAction(
addIcon
? st::historySponsoredAboutMenuLabelPosition
: st::historyHasCustomEmojiPosition,
(peer->isMegagroup()
? tr::lng_context_noforwards_info_group
: (peer->isChannel())
? tr::lng_context_noforwards_info_channel
: (peer->isUser() && peer->asUser()->isBot())
? tr::lng_context_noforwards_info_channel
: tr::lng_context_noforwards_info_bot)(
tr::ayu_UnforwardableContextMenuText(
tr::now,
Ui::Text::RichLangValue),
addIcon ? &st::menuIconCopyright : nullptr);