Visiting epic boards in public groups as a non-logged-in user can fail
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "bug" label: - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary Visiting epic boards in public groups as a non-logged-in user often fails with 500 status code. This is because visiting epic boards for the first time creates a board automatically. In the process it records a [usage event](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/services/boards/epic_boards/create_service.rb#L23) to track the creation of a board. This looks for the current user ID, which is `nil` as the user is not logged in. This bug cannot be reproduced if anyone who is logged in and authorized to create epic boards has visited the epic boards index page at least once. ### Steps to reproduce 1. Create a new public group, 1. Copy the link to the epic boards page from the sidebar (but _do not visit it_), 1. Open a private browser window, 1. Paste in and go to the link. ### Example Project It's brittle to provide an example group, as anyone visiting the link while logged in will create a board and stop the bug from occurring. Instead, see the instructions in [steps to reproduce](#steps-to-reproduce) ### What is the current *bug* behavior? User sees a 500. ### What is the expected *correct* behavior? User should see an epic board. ### Possible fixes The creation of a tracking event shouldn't break a feature for customers. Instead we should simply not track the user id if there isn't one. In other words, edit [/ee/app/services/boards/epic_boards/create_service.rb#L23](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/services/boards/epic_boards/create_service.rb#L23) to include the lonely operator: ```ruby track_usage_event(:g_project_management_users_creating_epic_boards, current_user&.id) ```
issue