Fix opening private linked channel from message

This commit is contained in:
RadRussianRus 2020-01-26 05:50:52 +03:00 committed by John Preston
parent 05eabfd539
commit 46de86f1e4
1 changed files with 6 additions and 2 deletions

View File

@ -85,10 +85,14 @@ PeerClickHandler::PeerClickHandler(not_null<PeerData*> peer)
void PeerClickHandler::onClick(ClickContext context) const {
if (context.button == Qt::LeftButton && App::wnd()) {
const auto controller = App::wnd()->sessionController();
const auto currentPeer = controller->activeChatCurrent().peer();
if (_peer
&& _peer->isChannel()
&& controller->activeChatCurrent().peer() != _peer) {
if (!_peer->asChannel()->isPublic() && !_peer->asChannel()->amIn()) {
&& currentPeer != _peer) {
const auto clickedChannel = _peer->asChannel();
if (!clickedChannel->isPublic() && !clickedChannel->amIn()
&& (!currentPeer->isChannel()
|| currentPeer->asChannel()->linkedChat() != clickedChannel)) {
Ui::show(Box<InformBox>(_peer->isMegagroup()
? tr::lng_group_not_accessible(tr::now)
: tr::lng_channel_not_accessible(tr::now)));