mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-07 18:02:03 +00:00
feat: add configurable timeout for automatically removing resolved reports (#7940)
Supersedes [this PR](https://codeberg.org/lenikadali/forgejo/pulls/1) Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7940 Reviewed-by: Otto <otto@codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Leni Kadali <lenikadali@noreply.codeberg.org> Co-committed-by: Leni Kadali <lenikadali@noreply.codeberg.org>
This commit is contained in:
parent
b2c8a1cfd3
commit
29eaab5ff4
10 changed files with 247 additions and 4 deletions
|
@ -3,13 +3,28 @@
|
|||
|
||||
package setting
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Moderation settings
|
||||
var Moderation = struct {
|
||||
Enabled bool `ini:"ENABLED"`
|
||||
Enabled bool `ini:"ENABLED"`
|
||||
KeepResolvedReportsFor time.Duration `ini:"KEEP_RESOLVED_REPORTS_FOR"`
|
||||
}{
|
||||
Enabled: false,
|
||||
}
|
||||
|
||||
func loadModerationFrom(rootCfg ConfigProvider) {
|
||||
mustMapSetting(rootCfg, "moderation", &Moderation)
|
||||
func loadModerationFrom(rootCfg ConfigProvider) error {
|
||||
sec := rootCfg.Section("moderation")
|
||||
err := sec.MapTo(&Moderation)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to map Moderation settings: %v", err)
|
||||
}
|
||||
|
||||
// keep reports for one week by default. Since time.Duration stops at the unit of an hour
|
||||
// we are using the value of 24 (hours) * 7 (days) which gives us the value of 168
|
||||
Moderation.KeepResolvedReportsFor = sec.Key("KEEP_RESOLVED_REPORTS_FOR").MustDuration(168 * time.Hour)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue