Fix NoMethodError when current_user is nil in MR subscription
What does this MR do and why?
Contributes to #579309 (closed)
Sentry error: https://new-sentry.gitlab.net/organizations/gitlab/issues/1722157
Problem
When current_user is nil in the
Subscriptions::User::MergeRequestUpdated GraphQL subscription, the
authorized? method was attempting to call .id on nil, causing a
NoMethodError.
Solution
Use the safe navigation operator (&.) to handle the case when current_user is nil, allowing the authorization check to properly fail and unsubscribe the user instead of raising an exception.
References
NoMethodError in Subscriptions::User::MergeRequ... (#579309 - closed)
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 #579309 (closed)