From dae0ad1de561d39e7d6abd389c30d4fdf95b8c7b Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Fri, 8 Sep 2023 14:37:07 +0100 Subject: [PATCH] invites: "User Label" 2/2 applies label to users. Also hide the user label element on the invite dropdown when not set. --- api-users.go | 6 +++++- ts/modules/invites.ts | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api-users.go b/api-users.go index 7adc77d..f30930d 100644 --- a/api-users.go +++ b/api-users.go @@ -310,6 +310,10 @@ func (app *appContext) newUser(req newUserDTO, confirmed bool) (f errorFunc, suc Contact: (req.Email != ""), } + if invite.UserLabel != "" { + emailStore.Label = invite.UserLabel + } + var profile Profile if invite.Profile != "" { app.debug.Printf("Applying settings from profile \"%s\"", invite.Profile) @@ -338,7 +342,7 @@ func (app *appContext) newUser(req newUserDTO, confirmed bool) (f errorFunc, suc } } // if app.config.Section("password_resets").Key("enabled").MustBool(false) { - if req.Email != "" { + if req.Email != "" || invite.UserLabel != "" { app.storage.SetEmailsKey(id, emailStore) } expiry := time.Time{} diff --git a/ts/modules/invites.ts b/ts/modules/invites.ts index 7c4edc0..c7dc04c 100644 --- a/ts/modules/invites.ts +++ b/ts/modules/invites.ts @@ -48,9 +48,11 @@ class DOMInvite implements Invite { if (label) { labelLabel.textContent = window.lang.strings("userLabel"); value.textContent = label; + value.classList.remove("unfocused"); } else { labelLabel.textContent = ""; value.textContent = ""; + value.classList.add("unfocused"); } } @@ -366,7 +368,7 @@ class DOMInvite implements Invite {

${window.lang.strings("inviteDateCreated")}

${window.lang.strings("inviteRemainingUses")}

-

+

`; this._right = document.createElement('div') as HTMLDivElement;