MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / HidePinnedBar

Function HidePinnedBar

Telegram/SourceFiles/window/window_peer_menu.cpp:3844–3887  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3842}
3843
3844void HidePinnedBar(
3845 not_null<Window::SessionNavigation*> navigation,
3846 not_null<PeerData*> peer,
3847 MsgId topicRootId,
3848 PeerId monoforumPeerId,
3849 Fn<void()> onHidden) {
3850 const auto callback = crl::guard(navigation, [=](Fn<void()> &&close) {
3851 close();
3852 auto &session = peer->session();
3853 const auto migrated = (topicRootId || monoforumPeerId)
3854 ? nullptr
3855 : peer->migrateFrom();
3856 const auto top = Data::ResolveTopPinnedId(
3857 peer,
3858 topicRootId,
3859 monoforumPeerId,
3860 migrated);
3861 const auto universal = !top
3862 ? MsgId(0)
3863 : (migrated && !peerIsChannel(top.peer))
3864 ? (top.msg - ServerMaxMsgId)
3865 : top.msg;
3866 if (universal) {
3867 session.settings().setHiddenPinnedMessageId(
3868 peer->id,
3869 topicRootId,
3870 monoforumPeerId,
3871 universal);
3872 session.saveSettingsDelayed();
3873 if (onHidden) {
3874 onHidden();
3875 }
3876 } else {
3877 session.api().requestFullPeer(peer);
3878 }
3879 });
3880 navigation->parentController()->show(
3881 Ui::MakeConfirmBox({
3882 .text = tr::lng_pinned_hide_all_sure(),
3883 .confirmed = callback,
3884 .confirmText = tr::lng_pinned_hide_all_hide(),
3885 }),
3886 Ui::LayerOption::CloseOther);
3887}
3888
3889void UnpinAllMessages(
3890 not_null<Window::SessionNavigation*> navigation,

Callers 3

hidePinnedMessageMethod · 0.85
hidePinnedMessageMethod · 0.85
setupClearButtonMethod · 0.85

Calls 13

ResolveTopPinnedIdFunction · 0.85
peerIsChannelFunction · 0.85
settingsMethod · 0.80
requestFullPeerMethod · 0.80
apiMethod · 0.80
MsgIdClass · 0.50
MakeConfirmBoxFunction · 0.50
sessionMethod · 0.45
migrateFromMethod · 0.45
saveSettingsDelayedMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected