diff --git a/Telegram/SourceFiles/api/api_blocked_peers.cpp b/Telegram/SourceFiles/api/api_blocked_peers.cpp index c28b9c37f2..bf3a061e8c 100644 --- a/Telegram/SourceFiles/api/api_blocked_peers.cpp +++ b/Telegram/SourceFiles/api/api_blocked_peers.cpp @@ -98,8 +98,11 @@ void BlockedPeers::block(not_null peer) { } } -void BlockedPeers::unblock(not_null peer, Fn onDone) { - if (!peer->isBlocked()) { +void BlockedPeers::unblock( + not_null peer, + Fn onDone, + bool force) { + if (!force && !peer->isBlocked()) { _session->changes().peerUpdated( peer, Data::PeerUpdate::Flag::IsBlocked); diff --git a/Telegram/SourceFiles/api/api_blocked_peers.h b/Telegram/SourceFiles/api/api_blocked_peers.h index ae506bbc92..af184c4576 100644 --- a/Telegram/SourceFiles/api/api_blocked_peers.h +++ b/Telegram/SourceFiles/api/api_blocked_peers.h @@ -42,7 +42,10 @@ public: void request(int offset, Fn onDone); void block(not_null peer); - void unblock(not_null peer, Fn onDone = nullptr); + void unblock( + not_null peer, + Fn onDone = nullptr, + bool force = false); private: const not_null _session; diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index d0d5a188d2..3af9d60293 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -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(&info.usernameOrId)) { resolveUsername(*name, [=](not_null 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(&info.usernameOrId)) { resolveChannelById(*id, [=](not_null channel) {