mirror of https://github.com/procxx/kepka.git
Add a confirmation when blocking a user.
This commit is contained in:
parent
2351865961
commit
ffba901620
|
@ -304,7 +304,8 @@ void ContactStatus::setupAddHandler(not_null<UserData*> user) {
|
||||||
void ContactStatus::setupBlockHandler(not_null<UserData*> user) {
|
void ContactStatus::setupBlockHandler(not_null<UserData*> user) {
|
||||||
_bar.entity()->blockClicks(
|
_bar.entity()->blockClicks(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
_window->show(Box(Window::PeerMenuBlockUserBox, _window, user));
|
_window->show(
|
||||||
|
Box(Window::PeerMenuBlockUserBox, _window, user, true));
|
||||||
}, _bar.lifetime());
|
}, _bar.lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -619,8 +619,11 @@ void ActionsFiller::addBlockAction(not_null<UserData*> user) {
|
||||||
if (user->botInfo) {
|
if (user->botInfo) {
|
||||||
Ui::showPeerHistory(user, ShowAtUnreadMsgId);
|
Ui::showPeerHistory(user, ShowAtUnreadMsgId);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (user->isBot()) {
|
||||||
user->session().api().blockUser(user);
|
user->session().api().blockUser(user);
|
||||||
|
} else {
|
||||||
|
window->show(
|
||||||
|
Box(Window::PeerMenuBlockUserBox, window, user, false));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
AddActionButton(
|
AddActionButton(
|
||||||
|
|
|
@ -154,7 +154,6 @@ void PhoneWidget::phoneSubmitDone(const MTPauth_SentCode &result) {
|
||||||
fillSentCodeData(d);
|
fillSentCodeData(d);
|
||||||
getData()->phone = _sentPhone;
|
getData()->phone = _sentPhone;
|
||||||
getData()->phoneHash = qba(d.vphone_code_hash());
|
getData()->phoneHash = qba(d.vphone_code_hash());
|
||||||
getData()->phoneIsRegistered = d.is_phone_registered();
|
|
||||||
const auto next = d.vnext_type();
|
const auto next = d.vnext_type();
|
||||||
if (next && next->type() == mtpc_auth_codeTypeCall) {
|
if (next && next->type() == mtpc_auth_codeTypeCall) {
|
||||||
getData()->callStatus = Widget::Data::CallStatus::Waiting;
|
getData()->callStatus = Widget::Data::CallStatus::Waiting;
|
||||||
|
|
|
@ -59,7 +59,6 @@ public:
|
||||||
QString country;
|
QString country;
|
||||||
QString phone;
|
QString phone;
|
||||||
QByteArray phoneHash;
|
QByteArray phoneHash;
|
||||||
bool phoneIsRegistered = false;
|
|
||||||
|
|
||||||
enum class CallStatus {
|
enum class CallStatus {
|
||||||
Waiting,
|
Waiting,
|
||||||
|
|
|
@ -348,7 +348,7 @@ void Filler::addBlockUser(not_null<UserData*> user) {
|
||||||
} else if (user->isBot()) {
|
} else if (user->isBot()) {
|
||||||
user->session().api().blockUser(user);
|
user->session().api().blockUser(user);
|
||||||
} else {
|
} else {
|
||||||
window->show(Box(PeerMenuBlockUserBox, window, user));
|
window->show(Box(PeerMenuBlockUserBox, window, user, false));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -710,7 +710,8 @@ void PeerMenuCreatePoll(not_null<PeerData*> peer) {
|
||||||
void PeerMenuBlockUserBox(
|
void PeerMenuBlockUserBox(
|
||||||
not_null<GenericBox*> box,
|
not_null<GenericBox*> box,
|
||||||
not_null<Window::Controller*> window,
|
not_null<Window::Controller*> window,
|
||||||
not_null<UserData*> user) {
|
not_null<UserData*> user,
|
||||||
|
bool suggestClearChat) {
|
||||||
using Flag = MTPDpeerSettings::Flag;
|
using Flag = MTPDpeerSettings::Flag;
|
||||||
const auto settings = user->settings().value_or(Flag(0));
|
const auto settings = user->settings().value_or(Flag(0));
|
||||||
|
|
||||||
|
@ -738,13 +739,17 @@ void PeerMenuBlockUserBox(
|
||||||
box->addSkip(st::boxMediumSkip);
|
box->addSkip(st::boxMediumSkip);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto clear = box->addRow(object_ptr<Ui::Checkbox>(
|
const auto clear = suggestClearChat
|
||||||
box,
|
? box->addRow(object_ptr<Ui::Checkbox>(
|
||||||
tr::lng_blocked_list_confirm_clear(tr::now),
|
box,
|
||||||
true,
|
tr::lng_blocked_list_confirm_clear(tr::now),
|
||||||
st::defaultBoxCheckbox));
|
true,
|
||||||
|
st::defaultBoxCheckbox))
|
||||||
|
: nullptr;
|
||||||
|
|
||||||
box->addSkip(st::boxLittleSkip);
|
if (report || clear) {
|
||||||
|
box->addSkip(st::boxLittleSkip);
|
||||||
|
}
|
||||||
|
|
||||||
box->setTitle(tr::lng_blocked_list_confirm_title(
|
box->setTitle(tr::lng_blocked_list_confirm_title(
|
||||||
lt_name,
|
lt_name,
|
||||||
|
@ -752,7 +757,7 @@ void PeerMenuBlockUserBox(
|
||||||
|
|
||||||
box->addButton(tr::lng_blocked_list_confirm_ok(), [=] {
|
box->addButton(tr::lng_blocked_list_confirm_ok(), [=] {
|
||||||
const auto reportChecked = report && report->checked();
|
const auto reportChecked = report && report->checked();
|
||||||
const auto clearChecked = clear->checked();
|
const auto clearChecked = clear && clear->checked();
|
||||||
|
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,8 @@ void PeerMenuCreatePoll(not_null<PeerData*> peer);
|
||||||
void PeerMenuBlockUserBox(
|
void PeerMenuBlockUserBox(
|
||||||
not_null<GenericBox*> box,
|
not_null<GenericBox*> box,
|
||||||
not_null<Window::Controller*> window,
|
not_null<Window::Controller*> window,
|
||||||
not_null<UserData*> user);
|
not_null<UserData*> user,
|
||||||
|
bool suggestClearChat);
|
||||||
void PeerMenuUnblockUserWithBotRestart(not_null<UserData*> user);
|
void PeerMenuUnblockUserWithBotRestart(not_null<UserData*> user);
|
||||||
|
|
||||||
void ToggleHistoryArchived(not_null<History*> history, bool archived);
|
void ToggleHistoryArchived(not_null<History*> history, bool archived);
|
||||||
|
|
Loading…
Reference in New Issue