Skip to content

Update query for elevated_guests to use occupies_seat

Hinam Mehra requested to merge 437719-update-query-for-elevated-guests into master

What does this MR do and why?

  • This MR follows from !146293 (merged)
  • In this MR, we update the scopes elevated_guests and with_elevated_guests to use the occupies_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

Query plan for elevated_guests
Query plan for with_elevated_guests

How to set up and validate locally

  1. 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)
  1. Navigate to a group you are an owner of, and assign these roles to two different users.

  2. 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

Merge request reports