FIX: Name field should appear in the signup form for login-required sites (#30634)

Meta topic: https://meta.discourse.org/t/full-name-at-sign-up-went-missing/345662/17?u=osama

The preloaded `site` object for anons on login-required sites is a stripped down version of the full object with just a specific set of attributes and doesn't use the site serializer. This results in the `full_name_required_for_signup` and `full_name_visible_in_signup` attributes not making it to the client app when a login-required site is accessed by an anon, causing the name field in the signup form to not be rendered, even when it's required.

This commit includes those attributes in the stripped down version of the `site` object that's used for anons on login-required sites.
This commit is contained in:
Osama Sayegh
2025-01-08 03:49:34 +03:00
committed by GitHub
parent a08d6e8f37
commit 4f9359d056
5 changed files with 79 additions and 2 deletions

View File

@@ -384,11 +384,11 @@ class SiteSerializer < ApplicationSerializer
end
def full_name_required_for_signup
SiteSetting.enable_names && SiteSetting.full_name_requirement == "required_at_signup"
Site.full_name_required_for_signup
end
def full_name_visible_in_signup
SiteSetting.enable_names && SiteSetting.full_name_requirement != "hidden_at_signup"
Site.full_name_visible_in_signup
end
private