aboutsummaryrefslogtreecommitdiffstats
path: root/modules/setting
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 /modules/setting
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 'modules/setting')
-rw-r--r--modules/setting/service.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/setting/service.go b/modules/setting/service.go
index 86f46898ac..4410a600dd 100644
--- a/modules/setting/service.go
+++ b/modules/setting/service.go
@@ -6,6 +6,7 @@ package setting
import (
"regexp"
+ "time"
"code.gitea.io/gitea/modules/structs"
)
@@ -50,7 +51,7 @@ var Service struct {
AutoWatchNewRepos bool
AutoWatchOnChanges bool
DefaultOrgMemberVisible bool
- UserDeleteWithCommentsMaxDays int
+ UserDeleteWithCommentsMaxTime time.Duration
// OpenID settings
EnableOpenIDSignIn bool
@@ -103,7 +104,7 @@ func newService() {
Service.DefaultOrgVisibility = sec.Key("DEFAULT_ORG_VISIBILITY").In("public", structs.ExtractKeysFromMapString(structs.VisibilityModes))
Service.DefaultOrgVisibilityMode = structs.VisibilityModes[Service.DefaultOrgVisibility]
Service.DefaultOrgMemberVisible = sec.Key("DEFAULT_ORG_MEMBER_VISIBLE").MustBool()
- Service.UserDeleteWithCommentsMaxDays = sec.Key("USER_DELETE_WITH_COMMENTS_MAX_DAYS").MustInt(0)
+ Service.UserDeleteWithCommentsMaxTime = sec.Key("USER_DELETE_WITH_COMMENTS_MAX_TIME").MustDuration(0)
sec = Cfg.Section("openid")
Service.EnableOpenIDSignIn = sec.Key("ENABLE_OPENID_SIGNIN").MustBool(!InstallLock)