mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-11 17:29:46 +00:00
Ungroup all feed channels from context menu.
This commit is contained in:
parent
f8c2f339a0
commit
74aa1ad71e
@ -1429,6 +1429,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_feed_channels#one" = "{count} channel";
|
||||
"lng_feed_channels#other" = "{count} channels";
|
||||
"lng_feed_notifications" = "Feed notifications";
|
||||
"lng_feed_ungroup_all" = "Ungroup all channels";
|
||||
"lng_feed_sure_ungroup_all" = "Are you sure you want to ungroup all channels from this feed?";
|
||||
"lng_feed_ungroup_sure" = "Ungroup";
|
||||
|
||||
"lng_info_feed_title" = "Feed Info";
|
||||
"lng_info_feed_is_default" = "Group new channels";
|
||||
|
@ -203,6 +203,19 @@ void ApiWrap::toggleChannelGrouping(
|
||||
_channelGroupingRequests.emplace(channel, requestId, callback);
|
||||
}
|
||||
|
||||
void ApiWrap::ungroupAllFromFeed(not_null<Data::Feed*> feed) {
|
||||
const auto flags = MTPchannels_SetFeedBroadcasts::Flag::f_channels
|
||||
| MTPchannels_SetFeedBroadcasts::Flag::f_also_newly_joined;
|
||||
request(MTPchannels_SetFeedBroadcasts(
|
||||
MTP_flags(flags),
|
||||
MTP_int(feed->id()),
|
||||
MTP_vector<MTPInputChannel>(0),
|
||||
MTP_bool(false)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
applyUpdates(result);
|
||||
}).send();
|
||||
}
|
||||
|
||||
void ApiWrap::sendMessageFail(const RPCError &error) {
|
||||
if (error.type() == qstr("PEER_FLOOD")) {
|
||||
Ui::show(Box<InformBox>(
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
not_null<ChannelData*> channel,
|
||||
bool group,
|
||||
base::lambda<void()> callback);
|
||||
void ungroupAllFromFeed(not_null<Data::Feed*> feed);
|
||||
|
||||
using RequestMessageDataCallback = base::lambda<void(ChannelData*, MsgId)>;
|
||||
void requestMessageData(
|
||||
|
@ -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
|
||||
|
@ -48,6 +48,7 @@ void PeerMenuDeleteContact(not_null<UserData*> user);
|
||||
void PeerMenuShareContactBox(not_null<UserData*> user);
|
||||
void PeerMenuAddContact(not_null<UserData*> user);
|
||||
void PeerMenuAddChannelMembers(not_null<ChannelData*> channel);
|
||||
void PeerMenuUngroupFeed(not_null<Data::Feed*> feed);
|
||||
|
||||
void ToggleChannelGrouping(not_null<ChannelData*> channel, bool group);
|
||||
base::lambda<void()> ClearHistoryHandler(not_null<PeerData*> peer);
|
||||
|
Loading…
Reference in New Issue
Block a user