mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Unblock bots without restarting from Settings.
This commit is contained in:
@@ -344,7 +344,7 @@ void Filler::addBlockUser(not_null<UserData*> user) {
|
||||
};
|
||||
const auto blockAction = _addAction(blockText(user), [=] {
|
||||
if (user->isBlocked()) {
|
||||
user->session().api().unblockUser(user);
|
||||
PeerMenuUnblockUserWithBotRestart(user);
|
||||
} else if (user->isBot()) {
|
||||
user->session().api().blockUser(user);
|
||||
} else {
|
||||
@@ -778,6 +778,14 @@ void PeerMenuBlockUserBox(
|
||||
});
|
||||
}
|
||||
|
||||
void PeerMenuUnblockUserWithBotRestart(not_null<UserData*> user) {
|
||||
user->session().api().unblockUser(user, [=] {
|
||||
if (user->isBot() && !user->isSupport()) {
|
||||
user->session().api().sendBotStart(user);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
QPointer<Ui::RpWidget> ShowForwardMessagesBox(
|
||||
MessageIdsList &&items,
|
||||
FnMut<void()> &&successCallback) {
|
||||
|
@@ -57,6 +57,7 @@ void PeerMenuBlockUserBox(
|
||||
not_null<GenericBox*> box,
|
||||
not_null<Window::Controller*> window,
|
||||
not_null<UserData*> user);
|
||||
void PeerMenuUnblockUserWithBotRestart(not_null<UserData*> user);
|
||||
|
||||
void ToggleHistoryArchived(not_null<History*> history, bool archived);
|
||||
Fn<void()> ClearHistoryHandler(not_null<PeerData*> peer);
|
||||
|
Reference in New Issue
Block a user