Skip to content

Fix 500 error when viewing explore/catalog with anonymous user

Leaminn Ma requested to merge fix-explore-catalog-for-public-users into master

What does this MR do and why?

Currently when you visit https://gitlab.com/explore/catalog with an unauthenticated user (i.e. not logged in), a 500 internal server error is shown. However, the page should be visible to public users per #436642 (comment 1708816294).

This error occurs because the tracking event namespace source (current_user.namespace) is unable to resolve when current_user is nil. This MR fixes this bug by adding a condition to only track the event when the user is logged in. (Note that we're currently only tracking events for authenticated users.)

Resolves #436642 (closed).

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.

Screenshots or screen recordings

Before After
Screenshot_2023-12-28_at_10.33.21_AM Screenshot_2023-12-28_at_10.33.50_AM

How to set up and validate locally

  1. Run your gdk and go to http://gdk.test:3000/explore/catalog with a signed-out user. The page should render without errors. (Note: You can open an Incognito window and navigate to http://gdk.test:3000/explore/catalog to test this.)

Related to #436642 (closed)

Edited by Leaminn Ma

Merge request reports