mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed migrated groups from list of user's own groups.
This commit is contained in:
parent
53b75c8ea4
commit
154753c732
1 changed files with 9 additions and 1 deletions
|
@ -117,7 +117,9 @@ not_null<Ui::SettingsButton*> AddMyChannelsBox(
|
||||||
button->setAcceptBoth(true);
|
button->setAcceptBoth(true);
|
||||||
|
|
||||||
const auto myChannelsBox = [=](not_null<Ui::GenericBox*> box) {
|
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>(
|
const auto st = box->lifetime().make_state<style::UserpicButton>(
|
||||||
st::defaultUserpicButton);
|
st::defaultUserpicButton);
|
||||||
|
@ -191,10 +193,16 @@ not_null<Ui::SettingsButton*> AddMyChannelsBox(
|
||||||
|
|
||||||
const auto &data = controller->session().data();
|
const auto &data = controller->session().data();
|
||||||
if (chats) {
|
if (chats) {
|
||||||
|
auto ids = std::vector<PeerId>();
|
||||||
data.enumerateGroups([&](not_null<PeerData*> peer) {
|
data.enumerateGroups([&](not_null<PeerData*> peer) {
|
||||||
|
peer = peer->migrateToOrMe();
|
||||||
const auto c = peer->asChannel();
|
const auto c = peer->asChannel();
|
||||||
const auto g = peer->asChat();
|
const auto g = peer->asChat();
|
||||||
|
if (ranges::contains(ids, peer->id)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ((c && c->amCreator()) || (g && g->amCreator())) {
|
if ((c && c->amCreator()) || (g && g->amCreator())) {
|
||||||
|
ids.push_back(peer->id);
|
||||||
add(peer);
|
add(peer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue