2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add confirmation on leaving group/channel.

This commit is contained in:
John Preston
2017-11-14 21:37:39 +04:00
parent 8dfccf55d1
commit 388d743d29
3 changed files with 14 additions and 2 deletions

View File

@@ -556,11 +556,19 @@ void ActionsFiller::addBlockAction(not_null<UserData*> user) {
void ActionsFiller::addLeaveChannelAction(
not_null<ChannelData*> channel) {
auto callback = [=] {
auto text = lang(channel->isMegagroup()
? lng_sure_leave_group
: lng_sure_leave_channel);
Ui::show(Box<ConfirmBox>(text, lang(lng_box_leave), [=] {
Auth().api().leaveChannel(channel);
}), LayerOption::KeepOther);
};
AddActionButton(
_wrap,
Lang::Viewer(lng_profile_leave_channel),
AmInChannelValue(channel),
[channel] { Auth().api().leaveChannel(channel); });
std::move(callback));
}
void ActionsFiller::addJoinChannelAction(