Fix register link showing when signup is disabled
What does this MR do and why?
Fixes the issue where the "Register" link was appearing on snippet pages and other public pages even when signup was explicitly disabled in GitLab settings.
Closes #517346 (closed)
Problem
The register comment was showing because the templates were checking allow_signup?
which requires both signup_enabled?
AND password_authentication_enabled_for_web?
to be true. When administrators disable signup, they expect the register link to be hidden regardless of password authentication settings.
Solution
Updated the templates to check signup_enabled?
directly, which specifically controls whether new user registration should be allowed.
Changes
-
Notes template: Added conditional logic to show register link only when
signup_enabled?
is true - Tests: Added comprehensive test coverage for both scenarios
Screenshots or screen recordings
Before (signup disabled but register comment still shows)
The register link would appear in comment section even when signup was disabled.
After (signup disabled and register comment hidden)
The register link is properly hidden when signup is disabled, showing only the sign-in option.
How to set up and validate locally
- Disable signup in Admin settings: Admin Area > Settings > General > Sign-up restrictions > Sign-up enabled (uncheck)
- Visit a public snippet page while logged out
- Verify the comment section shows "Please sign in to comment" instead of "Please register or sign in to comment"
MR acceptance checklist
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guidelines -
Separation of EE specific content -
Security guidelines -
Documentation not required (no new features) -
Tests added for new functionality -
End-to-end tests not required (simple UI change)
Testing
Added comprehensive test coverage:
- Notes template tests verify register link visibility and proper fallback messages
- Tests cover both enabled and disabled signup scenarios