Compare commits

...

1 Commits
dev ... ci

Author SHA1 Message Date
23rd
ff0e515361 Returned kick button to list of members but only for inaccessible users.
Related commits: d7bf9e285c and 490f6f7e50.
2025-12-25 18:52:28 +03:00
3 changed files with 27 additions and 3 deletions

View File

@@ -1902,6 +1902,9 @@ void ParticipantsBoxController::editRestrictedDone(
void ParticipantsBoxController::kickParticipant(not_null<PeerData*> participant) {
const auto user = participant->asUser();
if (user && user->isInaccessible()) {
return kickParticipantSure(participant);
}
const auto text = ((_peer->isChat() || _peer->isMegagroup())
? tr::lng_profile_sure_kick
: tr::lng_profile_sure_kick_channel)(
@@ -2128,7 +2131,12 @@ auto ParticipantsBoxController::computeType(
: (user && _additional.adminRights(user).has_value())
? Rights::Admin
: Rights::Normal;
result.adminRank = user ? _additional.adminRank(user) : QString();
result.canRemove = _additional.canRemoveParticipant(participant)
&& user
&& user->isInaccessible();
if (!result.canRemove) {
result.adminRank = user ? _additional.adminRank(user) : QString();
}
return result;
}

View File

@@ -30,7 +30,9 @@ MemberListRow::MemberListRow(
void MemberListRow::setType(Type type) {
_type = type;
PeerListRowWithLink::setActionLink(!_type.adminRank.isEmpty()
PeerListRowWithLink::setActionLink(_type.canRemove
? tr::lng_profile_delete_removed(tr::now)
: !_type.adminRank.isEmpty()
? _type.adminRank
: (_type.rights == Rights::Creator)
? tr::lng_owner_badge(tr::now)
@@ -44,11 +46,19 @@ MemberListRow::Type MemberListRow::type() const {
}
bool MemberListRow::rightActionDisabled() const {
return true;
return !canRemove();
}
QMargins MemberListRow::rightActionMargins() const {
const auto skip = st::contactsCheckPosition.x();
if (canRemove()) {
const auto &st = st::defaultPeerListItem;
return QMargins(
skip,
(st.height - st.nameStyle.font->height) / 2,
st.photoPosition.x() + skip,
0);
}
return QMargins(
skip,
st::defaultPeerListItem.namePosition.y(),
@@ -72,6 +82,10 @@ void MemberListRow::refreshStatus() {
}
}
bool MemberListRow::canRemove() const {
return _type.canRemove;
}
std::unique_ptr<ParticipantsBoxController> CreateMembersController(
not_null<Window::SessionNavigation*> navigation,
not_null<PeerData*> peer) {

View File

@@ -28,6 +28,7 @@ public:
};
struct Type {
Rights rights;
bool canRemove = false;
QString adminRank;
};
@@ -42,6 +43,7 @@ public:
not_null<UserData*> user() const;
private:
[[nodiscard]] bool canRemove() const;
Type _type;
};