mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Added ability to open message statistics from context menu.
This commit is contained in:
parent
53c73accd0
commit
0aa1031402
1 changed files with 18 additions and 1 deletions
|
@ -45,6 +45,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/window_controller.h"
|
||||
#include "window/window_peer_menu.h"
|
||||
#include "window/notifications_manager.h"
|
||||
#include "info/info_memento.h"
|
||||
#include "info/statistics/info_statistics_widget.h"
|
||||
#include "boxes/about_sponsored_box.h"
|
||||
#include "boxes/delete_messages_box.h"
|
||||
#include "boxes/report_messages_box.h"
|
||||
|
@ -2212,11 +2214,26 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
if (pinItem->canPin()) {
|
||||
const auto isPinned = pinItem->isPinned();
|
||||
const auto pinItemId = pinItem->fullId();
|
||||
const auto controller = _controller;
|
||||
_menu->addAction(isPinned ? tr::lng_context_unpin_msg(tr::now) : tr::lng_context_pin_msg(tr::now), crl::guard(controller, [=] {
|
||||
Window::ToggleMessagePinned(controller, pinItemId, !isPinned);
|
||||
}), isPinned ? &st::menuIconUnpin : &st::menuIconPin);
|
||||
}
|
||||
if (!item->isService()
|
||||
&& peerIsChannel(itemId.peer)
|
||||
&& !_peer->isMegagroup()) {
|
||||
if (const auto channel = _peer->asChannel()) {
|
||||
if (channel->flags() & ChannelDataFlag::CanGetStatistics) {
|
||||
auto callback = crl::guard(controller, [=] {
|
||||
controller->showSection(
|
||||
Info::Statistics::Make(channel, itemId));
|
||||
});
|
||||
_menu->addAction(
|
||||
tr::lng_stats_title(tr::now),
|
||||
std::move(callback),
|
||||
&st::menuIconStats);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
const auto addPhotoActions = [&](not_null<PhotoData*> photo, HistoryItem *item) {
|
||||
const auto media = photo->activeMediaView();
|
||||
|
|
Loading…
Add table
Reference in a new issue