MCPcopy
hub / github.com/usememos/memos / GetInstanceMemoRelatedSetting

Method GetInstanceMemoRelatedSetting

store/instance_setting.go:152–175  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

150var DefaultReactions = []string{"👍", "👎", "❤️", "🎉", "😄", "😕", "😢", "😡"}
151
152func (s *Store) GetInstanceMemoRelatedSetting(ctx context.Context) (*storepb.InstanceMemoRelatedSetting, error) {
153 instanceSetting, err := s.GetInstanceSetting(ctx, &FindInstanceSetting{
154 Name: storepb.InstanceSettingKey_MEMO_RELATED.String(),
155 })
156 if err != nil {
157 return nil, errors.Wrap(err, "failed to get instance general setting")
158 }
159
160 instanceMemoRelatedSetting := &storepb.InstanceMemoRelatedSetting{}
161 if instanceSetting != nil {
162 instanceMemoRelatedSetting = instanceSetting.GetMemoRelatedSetting()
163 }
164 if instanceMemoRelatedSetting.ContentLengthLimit < DefaultContentLengthLimit {
165 instanceMemoRelatedSetting.ContentLengthLimit = DefaultContentLengthLimit
166 }
167 if len(instanceMemoRelatedSetting.Reactions) == 0 {
168 instanceMemoRelatedSetting.Reactions = append(instanceMemoRelatedSetting.Reactions, DefaultReactions...)
169 }
170 s.instanceSettingCache.Set(ctx, storepb.InstanceSettingKey_MEMO_RELATED.String(), &storepb.InstanceSetting{
171 Key: storepb.InstanceSettingKey_MEMO_RELATED,
172 Value: &storepb.InstanceSetting_MemoRelatedSetting{MemoRelatedSetting: instanceMemoRelatedSetting},
173 })
174 return instanceMemoRelatedSetting, nil
175}
176
177func (s *Store) GetInstanceTagsSetting(ctx context.Context) (*storepb.InstanceTagsSetting, error) {
178 instanceSetting, err := s.GetInstanceSetting(ctx, &FindInstanceSetting{

Calls 4

GetInstanceSettingMethod · 0.95
SetMethod · 0.65
StringMethod · 0.45
GetMemoRelatedSettingMethod · 0.45