Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix admin actions visibility for non admin mods #1412

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

MV-GH
Copy link
Collaborator

@MV-GH MV-GH commented Feb 26, 2024

Fix #1411
Fix #1408

  • Fixed some admin actions being shown to non admin mods

  • Did more deep research into the non admin can't ban user from community. I couldn't reproduce this at all. User was certain though it was a community ban and not a instance ban

  • Added a simulateModerators only for post options popup menu, it is not completely correct but this way non admin mods which probably make up most of the mods can actually moderate from the main feed. In case of the edge case moderator moderates a higher mod, the call will fail. So not that bad

  • Also fixed the weird movement of the post when opening the morePostOptions menu (regression)
    see https://stackoverflow.com/questions/77010371/prevent-popup-from-adding-padding-in-a-column-with-arrangement-spacedbylarge-p

@MV-GH MV-GH requested a review from dessalines as a code owner February 26, 2024 21:32
!subList.contains(creatorId)
}
} else {
// You can do moderator actions only on the mods added after you.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the moderator hierarchy not apply to admins? i.e. Any admin can moderate any admin?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does apply to other admins. Check L28 and L35, it adds admins, then mods for the ordered hierarchy.

Copy link
Collaborator Author

@MV-GH MV-GH Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not about the code, but rather does Lemmy also have the hierarchy for admin. (so yes I assume)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep admins also have a hierarchy.

!subList.contains(creatorId)
}
} else {
// You can do moderator actions only on the mods added after you.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does apply to other admins. Check L28 and L35, it adds admins, then mods for the ordered hierarchy.

*
* So this is QoL were we simulate the mods of the community
* It is not completely accurate as it doesn't take into account the hierarchy of mods
*/
Copy link
Member

@dessalines dessalines Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really shows that the canMod logic needs to be added on the back-end: LemmyNet/lemmy#4365

Once I eventually get some time to work on that, we'd be able to remove the mod list from almost every response, and stuff like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I forgot, how does the self option play into this? Which mod actions can you do on yourself? like lockpost? How would that work with canMod from server side?

Currently we don't do that correctly either. canMod should probably return which actions can be done?

Copy link
Member

@dessalines dessalines Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just looked through the lemmy-ui code, and its only distinguish that you can do to yourself, and anyone lower than you. We could probably change that to just isModOrAdmin && myComment , and remove the onSelf attribute.

Copy link
Collaborator Author

@MV-GH MV-GH Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only distinguish? Can top admin not pin his own comment? Or lock/feature his own posts?

@dessalines dessalines merged commit 5d4e7f0 into LemmyNet:main Feb 26, 2024
1 check passed
@MV-GH MV-GH deleted the fix/1411 branch February 26, 2024 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants