referrals: unlink/disable referrals for profile

This commit is contained in:
Harvey Tindall
2023-09-06 22:12:36 +01:00
parent 9e5034ebab
commit cdc8f9af4b
2 changed files with 68 additions and 51 deletions

View File

@@ -181,5 +181,18 @@ func (app *appContext) EnableReferralForProfile(gc *gin.Context) {
// @Security Bearer
// @tags Profiles & Settings
func (app *appContext) DisableReferralForProfile(gc *gin.Context) {
profileName := gc.Param("profile")
profile, ok := app.storage.GetProfileKey(profileName)
if !ok {
respondBool(200, true, gc)
return
}
app.storage.DeleteInvitesKey(profile.ReferralTemplateKey)
profile.ReferralTemplateKey = ""
app.storage.SetProfileKey(profileName, profile)
respondBool(200, true, gc)
}