Loading
Remove Security Manager guard from members scope
What does this MR do and why?
SecurityManagerConfig.enabled? returns a literal true, so the early return in the security_managers scope is unreachable.
scope :security_managers, -> { active.where(access_level: SECURITY_MANAGER) }Database
The emitted SQL does not change. I ran Member.security_managers.to_sql on the base commit and on this commit and diffed the output, and it is identical.
SELECT "members".* FROM "members"
LEFT OUTER JOIN "users" ON "users"."id" = "members"."user_id"
WHERE (("members"."user_id" IS NULL AND "members"."invite_token" IS NOT NULL)
OR "users"."state" = 'active')
AND "members"."requested_at" IS NULL
AND (members.access_level > 5)
AND "members"."access_level" = 25No execution plan is attached because this is not a new or altered query. Before this MR the scope either returned none or ran exactly the above, and the none branch has been dead since !256030 (merged). Happy to get a Database Lab plan if a reviewer wants one anyway.
How to set up and validate locally
bundle exec rspec spec/models/member_spec.rb:733 spec/models/group_spec.rb:46695 examples, 0 failures.
References
Part of the work in !239507 (closed)
Screenshots or screen recordings
No UI change.
Edited by Diane Russel