Skip to content

DEV: Remove now-redundant is_staff check #33786

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 24, 2025

Conversation

Drenmi
Copy link
Contributor

@Drenmi Drenmi commented Jul 23, 2025

What is this change?

The personal_message_enabled_groups setting now has admins and moderators as mandatory values, so we don't need to check for is_staff? as well.

Also removes a duplicated test case.

@Drenmi Drenmi requested a review from martin-brennan July 23, 2025 08:12
Comment on lines +437 to +438
from_bot || from_system || notify_moderators ||
@user.in_any_groups?(SiteSetting.personal_message_enabled_groups_map)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed is_staff? and moved notify_moderators condition because they can all fit on one line without awkward formatting. 😅

Comment on lines -98 to -103
it "disallows pms to other users if trust level is not met" do
SiteSetting.personal_message_enabled_groups = Group::AUTO_GROUPS[:trust_level_2]
user.update!(trust_level: TrustLevel[1])
Group.user_trust_level_change!(user.id, TrustLevel[1])
expect(Guardian.new(user).can_send_private_message?(another_user)).to be_falsey
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Drenmi Drenmi merged commit f3c3919 into main Jul 24, 2025
17 checks passed
@Drenmi Drenmi deleted the dev/remove-redundant-staff-check-5 branch July 24, 2025 02: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