aboutsummaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-01-22 03:56:19 +0100
committerGitHub <noreply@github.com>2021-01-21 21:56:19 -0500
commita0e424da859a5bf52fe1f08c08a9dcbe3e9d92eb (patch)
treef2326a97f31b4816c5e0cba98bf60392898b3728 /routers/user
parent0e2e73410e1e222633c007969d384d392d0420a3 (diff)
downloadgitea-a0e424da859a5bf52fe1f08c08a9dcbe3e9d92eb.tar.gz
gitea-a0e424da859a5bf52fe1f08c08a9dcbe3e9d92eb.zip
Enhance Ghost comment mitigation Settings (#14392)
* refactor models.DeleteComment and delete related reactions too * use deleteComment for UserDeleteWithCommentsMaxDays in DeleteUser * nits * Use time.Duration as other time settings have * docs * Resolve Fixme & fix potential deadlock * Disabled by Default * Update Config Value Description * switch args * Update models/issue_comment.go Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'routers/user')
-rw-r--r--routers/user/setting/account.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/routers/user/setting/account.go b/routers/user/setting/account.go
index 3b4191f0be..42c2c59b7e 100644
--- a/routers/user/setting/account.go
+++ b/routers/user/setting/account.go
@@ -302,8 +302,8 @@ func loadAccountData(ctx *context.Context) {
ctx.Data["ActivationsPending"] = pendingActivation
ctx.Data["CanAddEmails"] = !pendingActivation || !setting.Service.RegisterEmailConfirm
- if setting.Service.UserDeleteWithCommentsMaxDays != 0 {
- ctx.Data["UserDeleteWithCommentsMaxDays"] = setting.Service.UserDeleteWithCommentsMaxDays
- ctx.Data["UserDeleteWithComments"] = ctx.User.CreatedUnix.AsTime().Add(time.Duration(setting.Service.UserDeleteWithCommentsMaxDays) * 24 * time.Hour).After(time.Now())
+ if setting.Service.UserDeleteWithCommentsMaxTime != 0 {
+ ctx.Data["UserDeleteWithCommentsMaxTime"] = setting.Service.UserDeleteWithCommentsMaxTime.String()
+ ctx.Data["UserDeleteWithComments"] = ctx.User.CreatedUnix.AsTime().Add(setting.Service.UserDeleteWithCommentsMaxTime).After(time.Now())
}
}