From a0fd43642aaac82a1666dd804ad5d4e0dc367d84 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 19 Jun 2026 13:14:28 +0400 Subject: [PATCH] Update API scheme on layer 228. --- Telegram/SourceFiles/api/api_communities.cpp | 7 ++++++ Telegram/SourceFiles/api/api_updates.cpp | 21 ++++++++++++++++ Telegram/SourceFiles/apiwrap.cpp | 14 ++++++++++- .../SourceFiles/boxes/choose_filter_box.cpp | 12 +++++++++ .../codegen/scheme/codegen_scheme.py | 1 + Telegram/SourceFiles/data/data_channel.cpp | 2 +- Telegram/SourceFiles/data/data_channel.h | 3 +++ Telegram/SourceFiles/data/data_histories.cpp | 10 ++++++++ .../SourceFiles/data/data_saved_messages.cpp | 6 +++++ .../data/data_search_controller.cpp | 1 + Telegram/SourceFiles/data/data_session.cpp | 25 ++++++++++++++++++- Telegram/SourceFiles/data/data_session.h | 3 +++ .../data/notify/data_notify_settings.cpp | 4 +++ .../dialogs/dialogs_pinned_list.cpp | 11 ++++++++ .../SourceFiles/dialogs/dialogs_widget.cpp | 1 + Telegram/SourceFiles/history/history.cpp | 10 ++++---- Telegram/SourceFiles/iv/iv_rich_page.cpp | 8 ++++++ Telegram/SourceFiles/mtproto/scheme/api.tl | 16 ++++++++++-- .../SourceFiles/window/window_peer_menu.cpp | 18 ++++++++++++- 19 files changed, 162 insertions(+), 11 deletions(-) diff --git a/Telegram/SourceFiles/api/api_communities.cpp b/Telegram/SourceFiles/api/api_communities.cpp index 0e7f428ca3..0c4b21c314 100644 --- a/Telegram/SourceFiles/api/api_communities.cpp +++ b/Telegram/SourceFiles/api/api_communities.cpp @@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_peer.h" #include "data/data_session.h" #include "data/data_user.h" +#include "history/history.h" #include "main/main_session.h" namespace Api { @@ -189,6 +190,12 @@ void Communities::toggleCollapsedInDialogs( } }; apply(collapsed); + if (!collapsed) { + const auto history = community->owner().history(community); + if (history->folderKnown() && history->isPinnedDialog(FilterId())) { + community->owner().setChatPinned(history, FilterId(), false); + } + } using Flag = MTPcommunities_ToggleCommunityCollapsedInDialogs::Flag; _api.request(MTPcommunities_ToggleCommunityCollapsedInDialogs( MTP_flags(collapsed ? Flag::f_collapsed : Flag()), diff --git a/Telegram/SourceFiles/api/api_updates.cpp b/Telegram/SourceFiles/api/api_updates.cpp index e557ee9da9..4dbe96861f 100644 --- a/Telegram/SourceFiles/api/api_updates.cpp +++ b/Telegram/SourceFiles/api/api_updates.cpp @@ -411,6 +411,7 @@ void Updates::channelDifferenceDone( channel->ptsInit(pts->v); } }, [&](const MTPDdialogFolder &) { + }, [&](const MTPDdialogCommunity &) { }); session().data().applyDialogs( nullptr, @@ -855,6 +856,8 @@ void Updates::channelRangeDifferenceDone( return data.vpts().value_or_empty(); }, [&](const MTPDdialogFolder &data) { return 0; + }, [&](const MTPDdialogCommunity &data) { + return 0; }); isFinal = d.is_final(); } break; @@ -1826,6 +1829,7 @@ void Updates::feedUpdate(const MTPUpdate &update) { history->setUnreadMark(data.is_unread()); } }, [](const MTPDdialogPeerFolder &dialog) { + }, [](const MTPDdialogPeerCommunity &dialog) { }); } break; @@ -2344,6 +2348,12 @@ void Updates::feedUpdate(const MTPUpdate &update) { return true; } return !session().data().folderLoaded(data.vfolder_id().v); + }, [&](const MTPDdialogPeerCommunity &data) { + const auto channelId = ChannelId(data.vcommunity_id().v); + const auto channel + = session().data().channelLoaded(channelId); + return !channel + || !session().data().historyLoaded(channel); }); }; if (!ranges::none_of(order, notLoaded)) { @@ -2394,6 +2404,17 @@ void Updates::feedUpdate(const MTPUpdate &update) { ).arg(folderId )); return false; + }, [&](const MTPDdialogPeerCommunity &data) { + const auto channelId = ChannelId(data.vcommunity_id().v); + const auto channel = session().data().channelLoaded(channelId); + if (channel) { + if (const auto history + = session().data().historyLoaded(channel)) { + history->applyPinnedUpdate(d); + return true; + } + } + return false; }); if (!done) { session().api().requestPinnedDialogs(folder); diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 7d7f1033a1..e4c5c202ea 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -403,6 +403,10 @@ void ApiWrap::savePinnedOrder(Data::Folder *folder) { const auto &order = _session->data().pinnedChatsOrder(folder); const auto input = [](Dialogs::Key key) { if (const auto history = key.history()) { + if (const auto channel = history->peer->asChannel() + ; channel && channel->isCommunity()) { + return MTP_inputDialogPeerCommunity(channel->inputChannel()); + } return MTP_inputDialogPeer(history->peer->input()); } else if (const auto folder = key.folder()) { return MTP_inputDialogPeerFolder(MTP_int(folder->id())); @@ -1022,7 +1026,7 @@ void ApiWrap::updateDialogsOffset( auto lastPeer = PeerId(0); auto lastMsgId = MsgId(0); for (const auto &dialog : ranges::views::reverse(dialogs)) { - dialog.match([&](const auto &dialog) { + dialog.match([&](const MTPDdialog &dialog) { const auto peer = peerFromMTP(dialog.vpeer()); const auto messageId = dialog.vtop_message().v; if (!peer || !messageId) { @@ -1043,6 +1047,8 @@ void ApiWrap::updateDialogsOffset( return; } } + }, [&](const MTPDdialogFolder &) { + }, [&](const MTPDdialogCommunity &) { }); if (lastDate) { break; @@ -1945,6 +1951,9 @@ void ApiWrap::requestNotifySettings(const MTPInputNotifyPeer &peer) { return true; } return false; + }, [&](const MTPDinputNotifyCommunity &) { + AssertIsDebug(); + return false; }); if (bad) { return; @@ -1980,6 +1989,9 @@ void ApiWrap::requestNotifySettings(const MTPInputNotifyPeer &peer) { peerFromInput(data.vpeer()), data.vtop_msg_id().v, }; + }, [&](const MTPDinputNotifyCommunity &) { + AssertIsDebug(); + return NotifySettingsKey{ peerFromChannel(0) }; }); if (_notifySettingRequests.contains(key)) { return; diff --git a/Telegram/SourceFiles/boxes/choose_filter_box.cpp b/Telegram/SourceFiles/boxes/choose_filter_box.cpp index d705ca3921..ae2479bb99 100644 --- a/Telegram/SourceFiles/boxes/choose_filter_box.cpp +++ b/Telegram/SourceFiles/boxes/choose_filter_box.cpp @@ -210,6 +210,12 @@ ChooseFilterValidator::ChooseFilterValidator(not_null history) } bool ChooseFilterValidator::canAdd() const { + if (const auto channel = _history->peer->asChannel() + ; channel + && channel->isCommunity() + && !channel->collapsedInDialogs()) { + return false; + } for (const auto &filter : _history->owner().chatsFilters().list()) { if (filter.id() && !filter.contains(_history)) { return true; @@ -221,6 +227,12 @@ bool ChooseFilterValidator::canAdd() const { bool ChooseFilterValidator::canAdd(FilterId filterId) const { Expects(filterId != 0); + if (const auto channel = _history->peer->asChannel() + ; channel + && channel->isCommunity() + && !channel->collapsedInDialogs()) { + return false; + } const auto list = _history->owner().chatsFilters().list(); const auto i = ranges::find(list, filterId, &Data::ChatFilter::id); if (i != end(list)) { diff --git a/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py b/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py index e3750a68d0..568fe93e51 100644 --- a/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py +++ b/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py @@ -46,6 +46,7 @@ generate({ 'peerNotifySettings': 'inputPeerNotifySettings', 'channelForbidden': 'channel', 'dialogFolder': 'dialog', + 'dialogCommunity': 'dialog', }, 'typeIdExceptions': [ diff --git a/Telegram/SourceFiles/data/data_channel.cpp b/Telegram/SourceFiles/data/data_channel.cpp index 785361f288..0e069aa351 100644 --- a/Telegram/SourceFiles/data/data_channel.cpp +++ b/Telegram/SourceFiles/data/data_channel.cpp @@ -1587,7 +1587,7 @@ void ApplyCommunityUpdate( channel->setAbout(qs(update.vabout())); channel->setAdminsCount(update.vadmins_count().value_or(1)); channel->setPendingRequestsCount( - update.vpending_requests().value_or_empty(), + update.vpeer_link_requests_pending().value_or_empty(), QVector()); if (const auto info = channel->communityInfo()) { info->applyLinkedPeers(update.vlinked_peers().v); diff --git a/Telegram/SourceFiles/data/data_channel.h b/Telegram/SourceFiles/data/data_channel.h index 01e2214148..2a54f725c2 100644 --- a/Telegram/SourceFiles/data/data_channel.h +++ b/Telegram/SourceFiles/data/data_channel.h @@ -339,6 +339,9 @@ public: [[nodiscard]] bool isCommunity() const { return flags() & Flag::Community; } + [[nodiscard]] bool collapsedInDialogs() const { + return flags() & Flag::CommunityCollapsed; + } [[nodiscard]] bool hasUsername() const { return flags() & Flag::Username; } diff --git a/Telegram/SourceFiles/data/data_histories.cpp b/Telegram/SourceFiles/data/data_histories.cpp index 1a27e34ed3..22f454504f 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_text_entities.h" #include "data/business/data_shortcut_messages.h" #include "data/components/scheduled_messages.h" +#include "data/notify/data_notify_settings.h" #include "data/data_channel.h" #include "data/data_chat.h" #include "data/data_document.h" @@ -496,6 +497,15 @@ void Histories::applyPeerDialogs(const MTPmessages_PeerDialogs &dialogs) { }, [&](const MTPDdialogFolder &data) { const auto folder = _owner->processFolder(data.vfolder()); folder->applyDialog(data); + }, [&](const MTPDdialogCommunity &data) { + const auto channelId = ChannelId(data.vcommunity_id().v); + if (const auto channel = _owner->channelLoaded(channelId)) { + if (channel->isCommunity()) { + _owner->notifySettings().apply( + peerFromChannel(channelId), + data.vnotify_settings()); + } + } }); } _owner->sendHistoryChangeNotifications(); diff --git a/Telegram/SourceFiles/data/data_saved_messages.cpp b/Telegram/SourceFiles/data/data_saved_messages.cpp index 6d309a324c..5ae28499ce 100644 --- a/Telegram/SourceFiles/data/data_saved_messages.cpp +++ b/Telegram/SourceFiles/data/data_saved_messages.cpp @@ -467,6 +467,10 @@ void SavedMessages::apply(const MTPDupdatePinnedSavedDialogs &update) { LOG(("API Error: " "updatePinnedSavedDialogs has folders.")); return false; + }, [&](const MTPDdialogPeerCommunity &data) { + LOG(("API Error: " + "updatePinnedSavedDialogs has communities.")); + return false; }); }; if (!ranges::none_of(order, notLoaded)) { @@ -491,6 +495,8 @@ void SavedMessages::apply(const MTPDupdateSavedDialogPinned &update) { } }, [&](const MTPDdialogPeerFolder &data) { DEBUG_LOG(("API Error: Folder in updateSavedDialogPinned.")); + }, [&](const MTPDdialogPeerCommunity &data) { + DEBUG_LOG(("API Error: Community in updateSavedDialogPinned.")); }); } diff --git a/Telegram/SourceFiles/data/data_search_controller.cpp b/Telegram/SourceFiles/data/data_search_controller.cpp index 5e7fdddd08..c6e4f8ca0a 100644 --- a/Telegram/SourceFiles/data/data_search_controller.cpp +++ b/Telegram/SourceFiles/data/data_search_controller.cpp @@ -79,6 +79,7 @@ std::optional PrepareGlobalMediaRequest( return MTPmessages_SearchGlobal( MTP_flags(MTPmessages_SearchGlobal::Flag::f_folder_id), // No archive MTP_int(folderId), + MTPInputChannel(), MTP_string(query), filter, MTP_int(minDate), diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 65a36ff9c7..6c05e50483 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -2619,6 +2619,11 @@ void Session::applyPinnedChats( if (folder) { LOG(("API Error: Nested folders detected.")); } + }, [&](const MTPDdialogPeerCommunity &data) { + const auto channelId = ChannelId(data.vcommunity_id().v); + if (const auto channel = channelLoaded(channelId)) { + this->history(channel)->clearFolder(); + } }); } chatsList(folder)->pinned()->applyList(this, list); @@ -2682,6 +2687,22 @@ void Session::applyDialog( setPinnedFromEntryList(folder, data.is_pinned()); } +void Session::applyDialog( + Data::Folder *requestFolder, + const MTPDdialogCommunity &data) { + const auto channelId = ChannelId(data.vcommunity_id().v); + const auto channel = channelLoaded(channelId); + if (!channel || !channel->isCommunity()) { + return; + } + const auto history = this->history(channel); + notifySettings().apply( + peerFromChannel(channelId), + data.vnotify_settings()); + channel->ensuredCommunityInfo()->ensureRowInChatList(); + setPinnedFromEntryList(history, data.is_pinned()); +} + bool Session::pinnedCanPin(not_null entry) const { if ([[maybe_unused]] const auto sublist = entry->asSublist()) { if (sublist->parentChat()) { @@ -5304,7 +5325,9 @@ not_null Session::chatsListFor( return sublist->parent()->chatsList(); } else if (const auto history = entry->asHistory()) { if (const auto info = history->communityListInfo() - ; info && info->collapsedInDialogs()) { + ; info + && info->collapsedInDialogs() + && info->channel() != history->peer) { return info->chatsList(); } } diff --git a/Telegram/SourceFiles/data/data_session.h b/Telegram/SourceFiles/data/data_session.h index 8210fd81da..3aef257a1f 100644 --- a/Telegram/SourceFiles/data/data_session.h +++ b/Telegram/SourceFiles/data/data_session.h @@ -1046,6 +1046,9 @@ private: void applyDialog( Folder *requestFolder, const MTPDdialogFolder &data); + void applyDialog( + Folder *requestFolder, + const MTPDdialogCommunity &data); const Messages *messagesList(PeerId peerId) const; not_null messagesListForInsert(PeerId peerId); diff --git a/Telegram/SourceFiles/data/notify/data_notify_settings.cpp b/Telegram/SourceFiles/data/notify/data_notify_settings.cpp index b97cadbd63..027898fdaa 100644 --- a/Telegram/SourceFiles/data/notify/data_notify_settings.cpp +++ b/Telegram/SourceFiles/data/notify/data_notify_settings.cpp @@ -116,6 +116,8 @@ void NotifySettings::apply( apply(peerFromMTP(data.vpeer()), settings); }, [&](const MTPDnotifyForumTopic &data) { apply(peerFromMTP(data.vpeer()), data.vtop_msg_id().v, settings); + }, [&](const MTPDnotifyCommunity &) { + AssertIsDebug(); }); } @@ -149,6 +151,8 @@ void NotifySettings::apply( apply(peerFromInput(data.vpeer()), settings); }, [&](const MTPDinputNotifyForumTopic &data) { apply(peerFromInput(data.vpeer()), data.vtop_msg_id().v, settings); + }, [&](const MTPDinputNotifyCommunity &) { + AssertIsDebug(); }); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_pinned_list.cpp b/Telegram/SourceFiles/dialogs/dialogs_pinned_list.cpp index f00a296136..73bff3ba12 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_pinned_list.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_pinned_list.cpp @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "dialogs/dialogs_key.h" #include "dialogs/dialogs_entry.h" #include "history/history.h" +#include "data/data_channel.h" #include "data/data_session.h" #include "data/data_forum.h" @@ -100,6 +101,15 @@ void PinnedList::applyList( } }, [&](const MTPDdialogPeerFolder &data) { addPinned(owner->folder(data.vfolder_id().v)); + }, [&](const MTPDdialogPeerCommunity &data) { + const auto channelId = ChannelId(data.vcommunity_id().v); + if (const auto channel = owner->channelLoaded(channelId)) { + const auto history = owner->history(channel); + if (!history->folderKnown()) { + history->clearFolder(); + } + addPinned(history); + } }); } } @@ -117,6 +127,7 @@ void PinnedList::applyList( addPinned(sublistsOwner->sublist(peer)); } }, [](const MTPDdialogPeerFolder &data) { + }, [](const MTPDdialogPeerCommunity &data) { }); } } diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index 8843d4dbbd..f779461474 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -3146,6 +3146,7 @@ void Widget::requestMessages(bool fromStart) { MTPmessages_SearchGlobal( MTP_flags(flags), MTP_int(folderId), + MTPInputChannel(), MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), // min_date diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index a4ff957542..fc387f1f43 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -3333,14 +3333,14 @@ bool History::trackUnreadMessages() const { bool History::shouldBeInChatList() const { if (peer->migrateTo() || !folderKnown()) { return false; + } else if (const auto community = peer->asChannel() + ; community && community->isCommunity()) { + return !(community->flags() & ChannelDataFlag::Forbidden) + && !community->haveLeft() + && (community->flags() & ChannelDataFlag::CommunityCollapsed); } else if (isPinnedDialog(FilterId())) { return true; } else if (const auto channel = peer->asChannel()) { - if (channel->isCommunity()) { - return !(channel->flags() & ChannelDataFlag::Forbidden) - && !channel->haveLeft() - && (channel->flags() & ChannelDataFlag::CommunityCollapsed); - } if (!channel->amIn()) { return isTopPromoted(); } diff --git a/Telegram/SourceFiles/iv/iv_rich_page.cpp b/Telegram/SourceFiles/iv/iv_rich_page.cpp index a88a7d1498..a1daf7b964 100644 --- a/Telegram/SourceFiles/iv/iv_rich_page.cpp +++ b/Telegram/SourceFiles/iv/iv_rich_page.cpp @@ -1050,6 +1050,14 @@ void RememberWebPageMedia( context, anchorId, anchorIds); + }, [&](const MTPDtextDiff &data) { + AssertIsDebug(); + return AppendRichText( + data.vtext(), + result, + context, + anchorId, + anchorIds); }); } diff --git a/Telegram/SourceFiles/mtproto/scheme/api.tl b/Telegram/SourceFiles/mtproto/scheme/api.tl index bb024e4c86..22156b5acc 100644 --- a/Telegram/SourceFiles/mtproto/scheme/api.tl +++ b/Telegram/SourceFiles/mtproto/scheme/api.tl @@ -108,7 +108,7 @@ community#44cfa2fd flags:# creator:flags.0?true left:flags.2?true min:flags.12?t chatFull#2633421b flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions reactions_limit:flags.20?int = ChatFull; channelFull#a04e8d3a flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true paid_messages_available:flags2.20?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int send_paid_messages_stars:flags2.21?long main_tab:flags2.22?ProfileTab guard_bot_id:flags2.23?long = ChatFull; -communityFull#ff2b487a flags:# id:long about:string chat_photo:Photo linked_peers:Vector admins_count:flags.1?int pending_requests:flags.0?int = ChatFull; +communityFull#cbb7a507 flags:# id:long about:string chat_photo:Photo linked_peers:Vector admins_count:flags.1?int kicked_count:flags.2?int peer_link_requests_pending:flags.0?int = ChatFull; chatParticipant#38e79fde flags:# user_id:long inviter_id:long date:int rank:flags.0?string = ChatParticipant; chatParticipantCreator#e1f867b8 flags:# user_id:long rank:flags.0?string = ChatParticipant; @@ -215,6 +215,7 @@ messageActionChangeCommunity#5d20bae8 flags:# community_id:flags.0?long = Messag dialog#fc89f7f3 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int unread_poll_votes_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; +dialogCommunity#f78a0973 flags:# pinned:flags.2?true community_id:long notify_settings:PeerNotifySettings = Dialog; photoEmpty#2331b22d id:long = Photo; photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector video_sizes:flags.1?Vector dc_id:int = Photo; @@ -243,6 +244,7 @@ inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer; inputNotifyForumTopic#5c467992 peer:InputPeer top_msg_id:int = InputNotifyPeer; +inputNotifyCommunity#27bb1adc community:InputChannel = InputNotifyPeer; inputPeerNotifySettings#cacb6ae2 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?NotificationSound stories_muted:flags.6?Bool stories_hide_sender:flags.7?Bool stories_sound:flags.8?NotificationSound = InputPeerNotifySettings; @@ -551,6 +553,7 @@ notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyBroadcasts#d612e8ef = NotifyPeer; notifyForumTopic#226e6308 peer:Peer top_msg_id:int = NotifyPeer; +notifyCommunity#be376999 community_id:long = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; @@ -939,6 +942,7 @@ textAutoPhone#24c26789 text:RichText = RichText; textBankCard#b956812d text:RichText = RichText; textMentionName#1a9fbfc text:RichText user_id:long = RichText; textDate#a5b45e2b flags:# relative:flags.0?true short_time:flags.1?true long_time:flags.2?true short_date:flags.3?true long_date:flags.4?true day_of_week:flags.5?true text:RichText date:int = RichText; +textDiff#9686cb50 text:RichText old_text:RichText = RichText; pageBlockUnsupported#13567e8a = PageBlock; pageBlockTitle#70abc3fd text:RichText = PageBlock; @@ -1152,9 +1156,11 @@ inputMessageCallbackQuery#acfa1a7e id:int query_id:long = InputMessage; inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer; inputDialogPeerFolder#64600527 folder_id:int = InputDialogPeer; +inputDialogPeerCommunity#69ef72c4 community:InputChannel = InputDialogPeer; dialogPeer#e56dbf05 peer:Peer = DialogPeer; dialogPeerFolder#514519e2 folder_id:int = DialogPeer; +dialogPeerCommunity#2f65c8e4 community_id:long = DialogPeer; messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets; messages.foundStickerSets#8af09dd2 hash:long sets:Vector = messages.FoundStickerSets; @@ -2238,6 +2244,10 @@ ephemeralMessage#d9c6dc1a flags:# out:flags.0?true id:int from_id:Peer peer_id:P communities.participantJoinedChats#8d78512a creator_chat_ids:Vector joined_chat_ids:Vector chats:Vector users:Vector = communities.ParticipantJoinedChats; +messages.translatedRichMessage#4203998f result:Vector = messages.TranslatedRichMessage; + +messages.composedRichMessageWithAI#4c4537c8 result:RichMessage = messages.ComposedRichMessageWithAI; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -2492,7 +2502,7 @@ messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_par messages.getMessagesViews#5784d3e1 peer:InputPeer id:Vector increment:Bool = messages.MessageViews; messages.editChatAdmin#a85bd1c2 chat_id:long user_id:InputUser is_admin:Bool = Bool; messages.migrateChat#a2875319 chat_id:long = Updates; -messages.searchGlobal#4bc6589a flags:# broadcasts_only:flags.1?true groups_only:flags.2?true users_only:flags.3?true folder_id:flags.0?int q:string filter:MessagesFilter min_date:int max_date:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; +messages.searchGlobal#6126a43c flags:# broadcasts_only:flags.1?true groups_only:flags.2?true users_only:flags.3?true folder_id:flags.0?int community:flags.4?InputChannel q:string filter:MessagesFilter min_date:int max_date:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; messages.reorderStickerSets#78337739 flags:# masks:flags.0?true emojis:flags.1?true order:Vector = Bool; messages.getDocumentByHash#b1f2061f sha256:bytes size:long mime_type:string = Document; messages.getSavedGifs#5cf09635 hash:long = messages.SavedGifs; @@ -2701,6 +2711,8 @@ messages.deleteParticipantReactions#a0b80cf8 peer:InputPeer participant:InputPee messages.deleteParticipantReaction#e3b7f82c peer:InputPeer msg_id:int participant:InputPeer = Updates; messages.getPersonalChannelHistory#55fb0996 user_id:InputUser limit:int max_id:int min_id:int hash:long = messages.Messages; messages.getRichMessage#501569cf peer:InputPeer id:int = messages.Messages; +messages.translateRichMessage#1a542004 flags:# peer:flags.0?InputPeer id:flags.0?Vector text:flags.1?Vector to_lang:string tone:flags.2?string = messages.TranslatedRichMessage; +messages.composeRichMessageWithAI#b4e4eec7 flags:# proofread:flags.0?true emojify:flags.3?true text:InputRichMessage translate_to_lang:flags.1?string tone:flags.2?InputAiComposeTone = messages.ComposedRichMessageWithAI; updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 5c08c5b0b5..134a4238f8 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -440,9 +440,13 @@ void TogglePinnedThread( const auto flags = isPinned ? MTPmessages_ToggleDialogPin::Flag::f_pinned : MTPmessages_ToggleDialogPin::Flag(0); + const auto channel = history->peer->asChannel(); + const auto peer = (channel && channel->isCommunity()) + ? MTP_inputDialogPeerCommunity(channel->inputChannel()) + : MTP_inputDialogPeer(history->peer->input()); owner->session().api().request(MTPmessages_ToggleDialogPin( MTP_flags(flags), - MTP_inputDialogPeer(history->peer->input()) + peer )).done([=] { owner->notifyPinnedDialogsOrderUpdated(); if (onToggled) { @@ -545,6 +549,12 @@ void Filler::addTogglePin() { if (!entry || entry->fixedOnTopIndex()) { return; } + const auto community = _peer ? _peer->asChannel() : nullptr; + if (community + && community->isCommunity() + && !community->collapsedInDialogs()) { + return; + } const auto pinText = [=] { return entry->isPinnedDialog(filterId) ? tr::lng_context_unpin_from_top(tr::now) @@ -662,6 +672,12 @@ void Filler::addToggleFolder() { && !_topic) { return; } + if (const auto channel = history->peer->asChannel() + ; channel + && channel->isCommunity() + && !channel->collapsedInDialogs()) { + return; + } _addAction(PeerMenuCallback::Args{ .text = tr::lng_filters_menu_add(tr::now), .handler = nullptr,