This commit is contained in:
2025-10-22 21:10:46 +08:00
parent d8ab1d1146
commit d3a64c0a77
3 changed files with 34 additions and 17 deletions

View File

@@ -1,8 +1,9 @@
package cache
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestSet(t *testing.T) {

View File

@@ -776,6 +776,16 @@ func (s *settingProvider) PWA(ctx context.Context) *PWASetting {
}
}
// AnnouncementEnabled returns true if announcement is enabled.
func (s *settingProvider) AnnouncementEnabled(ctx context.Context) bool {
return s.getBoolean(ctx, "announcement_enabled", false)
}
// Announcement returns the site announcement content.
func (s *settingProvider) Announcement(ctx context.Context) string {
return s.getString(ctx, "announcement", "")
}
func IsTrueValue(val string) bool {
return val == "1" || val == "true"
}