diff --git a/backend/app/cmd/server.go b/backend/app/cmd/server.go index 18a59f5c..5ff65abe 100644 --- a/backend/app/cmd/server.go +++ b/backend/app/cmd/server.go @@ -307,7 +307,7 @@ func (s *ServerCommand) newServerApp() (*serverApp, error) { } imgProxy := &proxy.Image{Enabled: s.ImageProxy, RoutePath: "/api/v1/img", RemarkURL: s.RemarkURL} - emojiFmt := store.CommentConverterFunc(func(text string) string { return text }) + emojiFmt := store.CommentConverterFunc(func(text string) string { return text }) if s.EnableEmoji { emojiFmt = func(text string) string { return emoji.Sprint(text) } } @@ -339,6 +339,7 @@ func (s *ServerCommand) newServerApp() (*serverApp, error) { Refresh: s.Stream.RefreshInterval, MaxActive: int32(s.Stream.MaxActive), }, + EmojiEnabled: s.EnableEmoji, } srv.ScoreThresholds.Low, srv.ScoreThresholds.Critical = s.LowScore, s.CriticalScore diff --git a/backend/app/rest/api/rest.go b/backend/app/rest/api/rest.go index 5bea46ef..435efae3 100644 --- a/backend/app/rest/api/rest.go +++ b/backend/app/rest/api/rest.go @@ -55,6 +55,7 @@ type Rest struct { Critical int } UpdateLimiter float64 + EmojiEnabled bool SSLConfig SSLConfig httpsServer *http.Server @@ -392,6 +393,7 @@ func (s *Rest) configCtrl(w http.ResponseWriter, r *http.Request) { PositiveScore bool `json:"positive_score"` ReadOnlyAge int `json:"readonly_age"` MaxImageSize int `json:"max_image_size"` + EmojiEnabled bool `json:"emoji_enabled"` }{ Version: s.Version, EditDuration: int(s.DataService.EditDuration.Seconds()), @@ -403,6 +405,7 @@ func (s *Rest) configCtrl(w http.ResponseWriter, r *http.Request) { PositiveScore: s.DataService.PositiveScore, ReadOnlyAge: s.ReadOnlyAge, MaxImageSize: s.ImageService.Store.SizeLimit(), + EmojiEnabled: s.EmojiEnabled, } cnf.Auth = []string{} diff --git a/backend/app/rest/api/rest_public_test.go b/backend/app/rest/api/rest_public_test.go index 3526b0d6..f7d5ec9f 100644 --- a/backend/app/rest/api/rest_public_test.go +++ b/backend/app/rest/api/rest_public_test.go @@ -505,6 +505,7 @@ func TestRest_Config(t *testing.T) { assert.False(t, j["positive_score"].(bool)) assert.Equal(t, 10., j["readonly_age"]) assert.Equal(t, 10000., j["max_image_size"]) + assert.Equal(t, true, j["emoji_enabled"].(bool)) t.Logf("%+v", j) } diff --git a/backend/app/rest/api/rest_test.go b/backend/app/rest/api/rest_test.go index 25eb0c9d..84ab7d3d 100644 --- a/backend/app/rest/api/rest_test.go +++ b/backend/app/rest/api/rest_test.go @@ -344,6 +344,7 @@ func startupT(t *testing.T) (ts *httptest.Server, srv *Rest, teardown func()) { TimeOut: 5 * time.Second, MaxActive: 100, }, + EmojiEnabled: true, } srv.ScoreThresholds.Low, srv.ScoreThresholds.Critical = -5, -10