Fix NoMethodError when current_user is not set
What does this MR do and why?
Sentry error: https://new-sentry.gitlab.net/organizations/gitlab/issues/111267
Problem
Tests don't verify the case when unauthorized user requests data about an authorized one. It leads to 500 error.
Solution
- Add a check for unauthorized user case
- Modify tests to verify that
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.