Update query for elevated_guests to use occupies_seat
What does this MR do and why?
- This MR follows from !146293 (merged)
- In this MR, we update the scopes
elevated_guests
andwith_elevated_guests
to use theoccupies_seat
column instead of using the individual abilities for custom roles. This is done to improve performance without affecting the logic.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Database
How to set up and validate locally
- In the rails console:
# create two member roles
member_role_first = MemberRole.create(name: "Elevated Guest", base_access_level: 10, read_vulnerability: true)
member_role_second = MemberRole.create(name: "Guest", base_access_level: 10, read_code: true)
-
Navigate to a group you are an owner of, and assign these roles to two different users.
-
Back in the rails console, run the methods:
# should return only the member which had `Elevated Guest` role assigned to them
Member.elevated_guests
# should return all guest+ on the instance including `Elevated Guest`
Member.with_elevated_guests
Related to #437719 (closed)
Edited by Hinam Mehra