Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: handle missing reaction (#4094)

RoccoSmit3b25a6bbec8d
diff --git a/store/workspace_setting.go b/store/workspace_setting.go
index a3cddbacb..ddd52f0f7 100644
--- a/store/workspace_setting.go
+++ b/store/workspace_setting.go
@@ -140,6 +140,7 @@ func (s *Store) GetWorkspaceGeneralSetting(ctx context.Context) (*storepb.Worksp
const (
// DefaultContentLengthLimit is the default limit of content length in bytes. 8KB.
DefaultContentLengthLimit = 8 * 1024
+ DefaultReaction = "👍"
)
func (s *Store) GetWorkspaceMemoRelatedSetting(ctx context.Context) (*storepb.WorkspaceMemoRelatedSetting, error) {
@@ -157,6 +158,9 @@ func (s *Store) GetWorkspaceMemoRelatedSetting(ctx context.Context) (*storepb.Wo
if workspaceMemoRelatedSetting.ContentLengthLimit < DefaultContentLengthLimit {
workspaceMemoRelatedSetting.ContentLengthLimit = DefaultContentLengthLimit
}
+ if len(workspaceMemoRelatedSetting.Reactions) == 0 {
+ workspaceMemoRelatedSetting.Reactions = append(workspaceMemoRelatedSetting.Reactions, DefaultReaction)
+ }
s.workspaceSettingCache.Store(storepb.WorkspaceSettingKey_MEMO_RELATED.String(), &storepb.WorkspaceSetting{
Key: storepb.WorkspaceSettingKey_MEMO_RELATED,
Value: &storepb.WorkspaceSetting_MemoRelatedSetting{MemoRelatedSetting: workspaceMemoRelatedSetting},