Skip to content

DEV: Remove now-redundant is_staff? guardian check #33919

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

Merged
merged 1 commit into from
Jul 29, 2025

Conversation

Drenmi
Copy link
Contributor

@Drenmi Drenmi commented Jul 29, 2025

What is this change?

Instead of doing both an is_staff? and a group access check, just add admins and moderators as mandatory values to the group access setting.

@Drenmi Drenmi requested a review from martin-brennan July 29, 2025 02:30
@@ -225,7 +225,7 @@ def can_delete_post?(post)
# Can't delete the first post
return false if post.is_first_post?

return true if is_staff? || is_category_group_moderator?(post.topic&.category)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The group access check that now covers this is two lines down. 👇

@Drenmi Drenmi force-pushed the dev/remove-redundant-staff-check-7 branch 2 times, most recently from f8349c0 to 4c2eb4f Compare July 29, 2025 02:42
@@ -145,22 +145,23 @@ def is_in_edit_topic_groups?
end

def can_recover_topic?(topic)
if is_staff? || (topic&.category && is_category_group_moderator?(topic.category)) ||
return false if topic.blank?
Copy link
Contributor Author

@Drenmi Drenmi Jul 29, 2025

Choose a reason for hiding this comment

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

Hoisted this guard up here because it was checked in all three expressions below.

@Drenmi Drenmi force-pushed the dev/remove-redundant-staff-check-7 branch from 4c2eb4f to ed1c134 Compare July 29, 2025 03:18
@Drenmi Drenmi merged commit 1c61fec into main Jul 29, 2025
16 checks passed
@Drenmi Drenmi deleted the dev/remove-redundant-staff-check-7 branch July 29, 2025 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants