Throw error if group is null

What does this MR do and why?

Throw error if group is null

  • sentry says that sometimes the group is null
  • update the frontend to account for this
  • update the code to be a bit more readable at match the query logic
  • update tests

Changelog: fixed

EE: true

References

Screenshots or screen recordings

Before After
image Ideally we should show an error when there is an API error, but right now there is no visual change

How to set up and validate locally

  1. Upload a GitLab Ultimate license
  2. Navigate to a project/group => Secure => Policies => New policies => Merge request approval policy
  3. Select a group role
  4. Verify the dropdown loads for the groups
  5. Apply the following patch
diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/action/group_select.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/action/group_select.vue
index 5d46dec38d5b..785676efd73e 100644
--- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/action/group_select.vue
+++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/action/group_select.vue
@@ -35,7 +35,7 @@ export default {
       },
       update(data) {
         // Handle global group approvers case (searchNamespaceGroups query)
-        if (this.globalGroupApproversEnabled) {
+        if (!this.globalGroupApproversEnabled) {
           const groups = (data?.groups?.nodes || [])
             .filter((group) => group)
             .map(createGroupObject);
  1. Verify the section is still editable.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #543092 (closed)

Edited by Alexander Turinske

Merge request reports

Loading