Add optional label for invites

Requested in #38.
This commit is contained in:
Harvey Tindall
2021-01-24 15:55:45 +00:00
parent ea262ca60b
commit dd96d71280
8 changed files with 51 additions and 17 deletions
+4
View File
@@ -532,6 +532,9 @@ func (app *appContext) GenerateInvite(gc *gin.Context) {
_, err = strconv.Atoi(string(inviteCode[0]))
}
var invite Invite
if req.Label != "" {
invite.Label = req.Label
}
invite.Created = currentTime
if req.MultipleUses {
if req.NoLimit {
@@ -732,6 +735,7 @@ func (app *appContext) GetInvites(gc *gin.Context) {
Created: app.formatDatetime(inv.Created),
Profile: inv.Profile,
NoLimit: inv.NoLimit,
Label: inv.Label,
}
if len(inv.UsedBy) != 0 {
invite.UsedBy = inv.UsedBy