Removed migrated groups from list of user's own groups.

This commit is contained in:
23rd 2024-04-03 17:35:51 +03:00 committed by John Preston
parent 53b75c8ea4
commit 154753c732
1 changed files with 9 additions and 1 deletions

View File

@ -117,7 +117,9 @@ not_null<Ui::SettingsButton*> AddMyChannelsBox(
button->setAcceptBoth(true);
const auto myChannelsBox = [=](not_null<Ui::GenericBox*> box) {
box->setTitle(tr::lng_notification_channels());
box->setTitle(chats
? tr::lng_notification_groups()
: tr::lng_notification_channels());
const auto st = box->lifetime().make_state<style::UserpicButton>(
st::defaultUserpicButton);
@ -191,10 +193,16 @@ not_null<Ui::SettingsButton*> AddMyChannelsBox(
const auto &data = controller->session().data();
if (chats) {
auto ids = std::vector<PeerId>();
data.enumerateGroups([&](not_null<PeerData*> peer) {
peer = peer->migrateToOrMe();
const auto c = peer->asChannel();
const auto g = peer->asChat();
if (ranges::contains(ids, peer->id)) {
return;
}
if ((c && c->amCreator()) || (g && g->amCreator())) {
ids.push_back(peer->id);
add(peer);
}
});