Replace portal title with entity name
Store a short entity name instead of the full home heading so orgs can brand portals for sub-entities. Restore hero i18n composition and keep the English document title composed from the entity name. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -46,7 +46,7 @@ type (
|
||||
Slug *string
|
||||
SearchEngineIndexing *coredata.SearchEngineIndexing
|
||||
NonDisclosureAgreementFileID *gid.GID
|
||||
Title *string
|
||||
EntityName *string
|
||||
Description **string
|
||||
WebsiteURL **string
|
||||
Email **string
|
||||
@@ -75,8 +75,8 @@ func (utcr *UpdateRequest) Validate() error {
|
||||
v.Check(utcr.Slug, "slug", validator.SafeText(NameMaxLength))
|
||||
v.Check(utcr.NonDisclosureAgreementFileID, "non_disclosure_agreement_file_id", validator.GID(coredata.FileEntityType))
|
||||
|
||||
if utcr.Title != nil {
|
||||
v.Check(*utcr.Title, "title", validator.Required(), validator.SafeTextNoNewLine(TitleMaxLength))
|
||||
if utcr.EntityName != nil {
|
||||
v.Check(*utcr.EntityName, "entity_name", validator.Required(), validator.SafeTextNoNewLine(TitleMaxLength))
|
||||
}
|
||||
|
||||
if utcr.Description != nil {
|
||||
@@ -214,8 +214,8 @@ func (s *Service) Update(
|
||||
portal.SearchEngineIndexing = *req.SearchEngineIndexing
|
||||
}
|
||||
|
||||
if req.Title != nil {
|
||||
portal.Title = *req.Title
|
||||
if req.EntityName != nil {
|
||||
portal.EntityName = *req.EntityName
|
||||
}
|
||||
|
||||
if req.Description != nil {
|
||||
|
||||
@@ -85,7 +85,7 @@ func BuildClientMetadataDocument(
|
||||
|
||||
doc := oauth2.ClientMetadataDocument{
|
||||
ClientID: clientID,
|
||||
ClientName: portal.Title,
|
||||
ClientName: "Compliance at " + portal.EntityName + ".",
|
||||
ClientURI: portalRootURL,
|
||||
RedirectURIs: []string{redirectURI},
|
||||
TokenEndpointAuthMethod: "none",
|
||||
|
||||
@@ -66,7 +66,7 @@ func TestBuildClientMetadataDocument(t *testing.T) {
|
||||
|
||||
websiteURL := "https://www.acme.com"
|
||||
portal := &coredata.CompliancePortal{
|
||||
Title: "Acme Compliance Page",
|
||||
EntityName: "Acme",
|
||||
WebsiteURL: &websiteURL,
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ func TestBuildClientMetadataDocument(t *testing.T) {
|
||||
)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "https://acme.example.com/.well-known/oauth-client-metadata", doc.ClientID)
|
||||
assert.Equal(t, "Acme Compliance Page", doc.ClientName)
|
||||
assert.Equal(t, "Compliance at Acme.", doc.ClientName)
|
||||
assert.Equal(t, []string{"https://acme.example.com/callback"}, doc.RedirectURIs)
|
||||
assert.Equal(t, "https://acme.example.com", doc.ClientURI)
|
||||
assert.Equal(t, VisitorOAuthScope, doc.Scope)
|
||||
@@ -88,7 +88,7 @@ func TestBuildClientMetadataDocument_LogoURIUsesBrandLogoEndpoint(t *testing.T)
|
||||
|
||||
logoFileID := gid.MustParseGID("WR-qMrB5AAEAGQAAAZ9mIO8B8vDFQ-i3")
|
||||
portal := &coredata.CompliancePortal{
|
||||
Title: "Acme Compliance Page",
|
||||
EntityName: "Acme",
|
||||
LogoFileID: &logoFileID,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user