1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-06-18 07:27:49 +02:00

invites: "User Label" 2/2

applies label to users. Also hide the user label element on the invite
dropdown when not set.
This commit is contained in:
Harvey Tindall 2023-09-08 14:37:07 +01:00
parent 7c76b58ab8
commit dae0ad1de5
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
2 changed files with 8 additions and 2 deletions

View File

@ -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{}

View File

@ -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 {
<p class="supra mb-4 top">${window.lang.strings("inviteDateCreated")} <strong class="inv-created"></strong></p>
<p class="supra mb-4">${window.lang.strings("inviteRemainingUses")} <strong class="inv-remaining"></strong></p>
<p class="supra mb-4"><span class="user-expiry"></span> <strong class="user-expiry-time"></strong></p>
<p class="mb-4 flex items-center"><span class="user-label-label supra mr-2"></span> <span class="user-label chip ~blue"></span></p>
<p class="mb-4 flex items-center"><span class="user-label-label supra mr-2"></span> <span class="user-label chip ~blue unfocused"></span></p>
`;
this._right = document.createElement('div') as HTMLDivElement;