2025-05-18 08:05:16 +00:00
|
|
|
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
package setting
|
|
|
|
|
2025-05-03 17:28:36 +03:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2025-05-18 08:05:16 +00:00
|
|
|
// Moderation settings
|
|
|
|
var Moderation = struct {
|
2025-05-03 17:28:36 +03:00
|
|
|
Enabled bool `ini:"ENABLED"`
|
2025-06-16 21:32:01 +03:00
|
|
|
RemoveResolvedReportsTimeout time.Duration `ini:"KEEP_RESOLVED_REPORTS_FOR"`
|
2025-05-18 08:05:16 +00:00
|
|
|
}{
|
|
|
|
Enabled: false,
|
|
|
|
}
|
|
|
|
|
2025-05-03 17:28:36 +03:00
|
|
|
func loadModerationFrom(rootCfg ConfigProvider) error {
|
2025-06-17 10:06:09 +03:00
|
|
|
sec := rootCfg.Section("moderation")
|
2025-05-03 17:28:36 +03:00
|
|
|
err := sec.MapTo(&Moderation)
|
|
|
|
if err != nil {
|
2025-06-17 10:06:09 +03:00
|
|
|
return fmt.Errorf("failed to map Moderation settings: %v", err)
|
2025-05-03 17:28:36 +03:00
|
|
|
}
|
|
|
|
|
2025-06-16 21:32:01 +03:00
|
|
|
Moderation.RemoveResolvedReportsTimeout = sec.Key("KEEP_RESOLVED_REPORTS_FOR").MustDuration(10 * time.Minute)
|
2025-05-03 17:28:36 +03:00
|
|
|
return nil
|
2025-05-18 08:05:16 +00:00
|
|
|
}
|