From 10c8d4ad2f66d085e43b5a074a5af1e018282def Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Thu, 16 Nov 2023 11:19:49 +0000 Subject: [PATCH] accounts: add "remove expiry" --- api-users.go | 14 +++++++++++++- html/admin.html | 10 +++++++++- lang/admin/en-us.json | 3 ++- router.go | 1 + ts/modules/accounts.ts | 38 +++++++++++++++++++++++++++++++++----- 5 files changed, 58 insertions(+), 8 deletions(-) diff --git a/api-users.go b/api-users.go index d735215..cb6725f 100644 --- a/api-users.go +++ b/api-users.go @@ -707,7 +707,7 @@ func (app *appContext) DeleteUsers(gc *gin.Context) { respondBool(200, true, gc) } -// @Summary Extend time before the user(s) expiry, or create and expiry if it doesn't exist. +// @Summary Extend time before the user(s) expiry, or create an expiry if it doesn't exist. // @Produce json // @Param extendExpiryDTO body extendExpiryDTO true "Extend expiry object" // @Success 200 {object} boolResponse @@ -737,6 +737,17 @@ func (app *appContext) ExtendExpiry(gc *gin.Context) { respondBool(204, true, gc) } +// @Summary Remove an expiry from a user's account. +// @Produce json +// @Param id path string true "id of user to extend expiry of." +// @Success 200 {object} boolResponse +// @Router /users/{id}/expiry [delete] +// @tags Users +func (app *appContext) RemoveExpiry(gc *gin.Context) { + app.storage.DeleteUserExpiryKey(gc.Param("id")) + respondBool(200, true, gc) +} + // @Summary Enable referrals for the given user(s) based on the rules set in the given invite code, or profile. // @Produce json // @Param EnableDisableReferralDTO body EnableDisableReferralDTO true "List of users" @@ -753,6 +764,7 @@ func (app *appContext) EnableReferralForUsers(gc *gin.Context) { var req EnableDisableReferralDTO gc.BindJSON(&req) mode := gc.Param("mode") + source := gc.Param("source") useExpiry := gc.Param("useExpiry") == "with-expiry" baseInv := Invite{} diff --git a/html/admin.html b/html/admin.html index 5a519cb..7a5a04d 100644 --- a/html/admin.html +++ b/html/admin.html @@ -679,7 +679,15 @@ {{ if .referralsEnabled }} {{ .strings.enableReferrals }} {{ end }} - {{ .strings.extendExpiry }} +