2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Ungroup all feed channels from context menu.

This commit is contained in:
John Preston
2018-02-18 17:00:14 +03:00
parent f8c2f339a0
commit 74aa1ad71e
5 changed files with 34 additions and 0 deletions

View File

@@ -76,6 +76,7 @@ private:
void addInfo();
void addSearch();
void addNotifications();
void addUngroup();
not_null<Controller*> _controller;
not_null<Data::Feed*> _feed;
@@ -423,6 +424,7 @@ void FeedFiller::fill() {
if (_source == PeerMenuSource::ChatsList) {
addSearch();
}
addUngroup();
}
bool FeedFiller::showInfo() {
@@ -477,6 +479,13 @@ void FeedFiller::addSearch() {
});
}
void FeedFiller::addUngroup() {
const auto feed = _feed;
_addAction(lang(lng_feed_ungroup_all), [=] {
PeerMenuUngroupFeed(feed);
});
}
} // namespace
void PeerMenuDeleteContact(not_null<UserData*> user) {
@@ -647,6 +656,13 @@ void PeerMenuAddMuteAction(
Ui::AttachAsChild(muteAction, std::move(lifetime));
}
void PeerMenuUngroupFeed(not_null<Data::Feed*> feed) {
Ui::show(Box<ConfirmBox>(
lang(lng_feed_sure_ungroup_all),
lang(lng_feed_ungroup_sure),
[=] { Ui::hideLayer(); Auth().api().ungroupAllFromFeed(feed); }));
}
void ToggleChannelGrouping(not_null<ChannelData*> channel, bool group) {
const auto callback = [=] {
Ui::Toast::Show(lang(group