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

@ -735,7 +735,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
"lng_sure_delete_and_exit" = "Are you sure, you want to delete all message history and leave «{group}»?\n\nThis action cannot be undone.";
"lng_sure_leave_channel" = "Are you sure, you want to leave\nthis channel?";
"lng_sure_delete_channel" = "Are you sure, you want to delete this channel? All members will be removed and all messages will be lost.";
"lng_sure_leave_group" = "Are you sure, you want to leave\nthis group? This action cannot be undone.";
"lng_sure_leave_group" = "Are you sure, you want to leave\nthis group?";
"lng_sure_delete_group" = "Are you sure, you want to delete this group? All members will be removed and all messages will be lost.";
"lng_message_empty" = "Empty Message";

View File

@ -44,6 +44,10 @@ InnerWidget::InnerWidget(
: RpWidget(parent)
, _controller(controller)
, _empty(this) {
_empty->heightValue()
| rpl::start_with_next(
[this] { refreshHeight(); },
_empty->lifetime());
_list = setupList();
setupOtherTypes();
}

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(