Skip to content

Commit

Permalink
fix: handle missing reaction (#4094)
Browse files Browse the repository at this point in the history
* migration version

* Updated test to match with current version set in version.go file

* updated logic to check if migration should run for fresh install

* Update test to test for version number set in version.go

* fixed test

* Revert "fixed test"

This reverts commit 4004d0e.

* Revert "Update test to test for version number set in version.go"

This reverts commit d304add.

* Revert "updated logic to check if migration should run for fresh install"

This reverts commit b44dca2.

* Revert "Updated test to match with current version set in version.go file"

This reverts commit 3ad0d88.

* Revert "migration version"

This reverts commit b13cfc3.

* Added default reaction if no reation found

* Fixed static check issue

* Use emoji
  • Loading branch information
RoccoSmit authored Nov 6, 2024
1 parent 3786fb8 commit 3b25a6b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions store/workspace_setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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},
Expand Down

0 comments on commit 3b25a6b

Please sign in to comment.