mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-01 12:00:48 +00:00
Added auto-unblocking of bot when it is auto-submitted.
This commit is contained in:
parent
2055fbc164
commit
57ecd918f1
@ -98,8 +98,11 @@ void BlockedPeers::block(not_null<PeerData*> peer) {
|
||||
}
|
||||
}
|
||||
|
||||
void BlockedPeers::unblock(not_null<PeerData*> peer, Fn<void()> onDone) {
|
||||
if (!peer->isBlocked()) {
|
||||
void BlockedPeers::unblock(
|
||||
not_null<PeerData*> peer,
|
||||
Fn<void()> onDone,
|
||||
bool force) {
|
||||
if (!force && !peer->isBlocked()) {
|
||||
_session->changes().peerUpdated(
|
||||
peer,
|
||||
Data::PeerUpdate::Flag::IsBlocked);
|
||||
|
@ -42,7 +42,10 @@ public:
|
||||
void request(int offset, Fn<void(Slice)> onDone);
|
||||
|
||||
void block(not_null<PeerData*> peer);
|
||||
void unblock(not_null<PeerData*> peer, Fn<void()> onDone = nullptr);
|
||||
void unblock(
|
||||
not_null<PeerData*> peer,
|
||||
Fn<void()> onDone = nullptr,
|
||||
bool force = false);
|
||||
|
||||
private:
|
||||
const not_null<Main::Session*> _session;
|
||||
|
@ -73,6 +73,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "apiwrap.h"
|
||||
#include "api/api_chat_invite.h"
|
||||
#include "api/api_global_privacy.h"
|
||||
#include "api/api_blocked_peers.h"
|
||||
#include "support/support_helper.h"
|
||||
#include "storage/file_upload.h"
|
||||
#include "facades.h"
|
||||
@ -186,7 +187,14 @@ void SessionNavigation::showPeerByLink(const PeerByLinkInfo &info) {
|
||||
});
|
||||
} else if (const auto name = std::get_if<QString>(&info.usernameOrId)) {
|
||||
resolveUsername(*name, [=](not_null<PeerData*> peer) {
|
||||
showPeerByLinkResolved(peer, info);
|
||||
if (info.startAutoSubmit) {
|
||||
peer->session().api().blockedPeers().unblock(
|
||||
peer,
|
||||
[=] { showPeerByLinkResolved(peer, info); },
|
||||
true);
|
||||
} else {
|
||||
showPeerByLinkResolved(peer, info);
|
||||
}
|
||||
});
|
||||
} else if (const auto id = std::get_if<ChannelId>(&info.usernameOrId)) {
|
||||
resolveChannelById(*id, [=](not_null<ChannelData*> channel) {
|
||||
|
Loading…
Reference in New Issue
Block a user