Fix couple of crashes.
This commit is contained in:
parent
bee6a1dc06
commit
0a0803de6f
|
@ -1457,8 +1457,6 @@ void ParticipantsBoxController::rowActionClicked(
|
||||||
base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
|
base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<PeerListRow*> row) {
|
not_null<PeerListRow*> row) {
|
||||||
Expects(row->peer()->isUser());
|
|
||||||
|
|
||||||
const auto chat = _peer->asChat();
|
const auto chat = _peer->asChat();
|
||||||
const auto channel = _peer->asChannel();
|
const auto channel = _peer->asChannel();
|
||||||
const auto participant = row->peer();
|
const auto participant = row->peer();
|
||||||
|
@ -1466,7 +1464,11 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
|
||||||
auto result = base::make_unique_q<Ui::PopupMenu>(parent);
|
auto result = base::make_unique_q<Ui::PopupMenu>(parent);
|
||||||
if (_navigation) {
|
if (_navigation) {
|
||||||
result->addAction(
|
result->addAction(
|
||||||
tr::lng_context_view_profile(tr::now),
|
(participant->isUser()
|
||||||
|
? tr::lng_context_view_profile
|
||||||
|
: participant->isBroadcast()
|
||||||
|
? tr::lng_context_view_channel
|
||||||
|
: tr::lng_context_view_group)(tr::now),
|
||||||
crl::guard(this, [=] {
|
crl::guard(this, [=] {
|
||||||
_navigation->showPeerInfo(participant); }));
|
_navigation->showPeerInfo(participant); }));
|
||||||
}
|
}
|
||||||
|
@ -1493,7 +1495,7 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
|
||||||
: tr::lng_context_promote_admin)(tr::now),
|
: tr::lng_context_promote_admin)(tr::now),
|
||||||
crl::guard(this, [=] { showAdmin(user); }));
|
crl::guard(this, [=] { showAdmin(user); }));
|
||||||
}
|
}
|
||||||
if (_additional.canRestrictParticipant(participant)) {
|
if (user && _additional.canRestrictParticipant(participant)) {
|
||||||
const auto canRestrictWithoutKick = [&] {
|
const auto canRestrictWithoutKick = [&] {
|
||||||
if (const auto chat = _peer->asChat()) {
|
if (const auto chat = _peer->asChat()) {
|
||||||
return chat->amCreator();
|
return chat->amCreator();
|
||||||
|
@ -1506,7 +1508,7 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
|
||||||
crl::guard(this, [=] { showRestricted(user); }));
|
crl::guard(this, [=] { showRestricted(user); }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_additional.canRemoveParticipant(participant)) {
|
if (user && _additional.canRemoveParticipant(participant)) {
|
||||||
if (!_additional.isKicked(participant)) {
|
if (!_additional.isKicked(participant)) {
|
||||||
const auto isGroup = _peer->isChat() || _peer->isMegagroup();
|
const auto isGroup = _peer->isChat() || _peer->isMegagroup();
|
||||||
result->addAction(
|
result->addAction(
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit eded7cc540123eaf26361958b9a61c65cb2f7cfc
|
Subproject commit 4a9de89c61882f00e0563d44516284a89874144b
|
Loading…
Reference in New Issue