feat(reactions): add full emoji picker

Let people use any Unicode emoji through a searchable, virtualized
picker.
Keep reaction counts accurate and requests optimistic and idempotent.
Refresh demo content so signed-in visitors can participate.

BREAKING CHANGE: Remove the MEMO_RELATED instance setting and
memoRelatedSetting configuration value. Remove their declarations and
lifecycle references from configuration files; existing reactions are
preserved.
This commit is contained in:
johnnyjoygh
2026-11-14 20:46:46 +08:00
parent 063fafb818
commit 5f3969a830
98 changed files with 5234 additions and 1791 deletions
+1 -1
View File
@@ -136,7 +136,7 @@ Black-box service tests live in `server/api/test/`, unit tests next to the code.
- Style with Tailwind CSS v4 and the package's `mu-` utilities (`bg-mu-surface`, `text-mu-text-secondary`, `rounded-mu-md`),
text with its type classes (`mu-caption`, `mu-body`, `mu-label`, `mu-title`), and `cn()` for class merging. No Tailwind
text sizes or old color names (`muted-foreground`, `destructive`, `popover`). The exceptions are the brand wordmark and
emoji glyphs, whose font size is their icon box (`SpaceIcon`, `SpaceMark`, `MemoViewIcon`, `CustomIconPicker`).
emoji glyphs, whose font size is their icon box (`SpaceIcon`, `SpaceMark`, `MemoViewIcon`, `CustomIconPicker`, `ReactionSelector`).
- Custom controls using `mu-focus` must reserve a real 1px border (transparent for borderless controls).
- Focus shows through `mu-focus`. Never add `ring-*` or `focus-visible:ring-*`, and never pair `mu-focus` with
`outline-none`, which overrides it. Visually hidden text uses `mu-visually-hidden`; a control that appears on focus keeps
+4 -4
View File
@@ -144,7 +144,7 @@ func TestApplyRemovals(t *testing.T) {
"idp.json": `{"identityProviders":[` + validIDP + `]}`,
"settings.json": `{"instanceSettings":[
{"name":"instance/settings/ACCESS","accessSetting":{"accessMode":"INSTANCE_ACCESS_MODE_PUBLIC"}},
{"name":"instance/settings/MEMO_RELATED","memoRelatedSetting":{"reactions":["👍"]}}]}`,
{"name":"instance/settings/NOTIFICATION","notificationSetting":{"email":{"fromName":"Memos"}}}]}`,
}
_, state := applyFor(t, loadDesired(t, declared), s)
require.Len(t, state.Resources, 3)
@@ -152,7 +152,7 @@ func TestApplyRemovals(t *testing.T) {
_, state = applyFor(t, loadDesired(t, map[string]string{"removed.json": `{"removed":[
{"resource":"identity-providers/sso","destroy":true},
{"resource":"instance/settings/ACCESS","destroy":true},
{"resource":"instance/settings/MEMO_RELATED"}]}`}), s)
{"resource":"instance/settings/NOTIFICATION"}]}`}), s)
require.Empty(t, state.Resources)
providers, err := s.ListIdentityProviders(ctx, &store.FindIdentityProvider{})
@@ -161,9 +161,9 @@ func TestApplyRemovals(t *testing.T) {
access, err := s.GetInstanceAccessSetting(ctx)
require.NoError(t, err)
require.Equal(t, storepb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE, access.AccessMode, "a reset ACCESS is private")
memoRelated, err := s.GetUncachedInstanceSetting(ctx, &store.FindInstanceSetting{Name: "MEMO_RELATED"})
notification, err := s.GetUncachedInstanceSetting(ctx, &store.FindInstanceSetting{Name: "NOTIFICATION"})
require.NoError(t, err)
require.Equal(t, []string{"👍"}, memoRelated.GetMemoRelatedSetting().GetReactions(), "a released setting is left as it is")
require.Equal(t, "Memos", notification.GetNotificationSetting().GetEmail().GetFromName(), "a released setting is left as it is")
}
func TestApplyLinkedIdentities(t *testing.T) {
+1
View File
@@ -197,6 +197,7 @@ func TestLoadChecksSchema(t *testing.T) {
"basic": {`{"instanceSettings":[{"name":"instance/settings/BASIC"}]}`, "BASIC holds the instance secret"},
"tags": {`{"instanceSettings":[{"name":"instance/settings/TAGS","tagsSetting":{}}]}`, "TAGS is kept only for compatibility"},
"unknown key": {`{"instanceSettings":[{"name":"instance/settings/THEME"}]}`, "unknown instance setting"},
"retired reactions": {`{"instanceSettings":[{"name":"instance/settings/MEMO_RELATED"}]}`, "unknown instance setting"},
"state record": {`{"instanceSettings":[{"name":"instance/settings/CONFIGURATION_STATE"}]}`, "is the configuration state record"},
"missing value": {`{"instanceSettings":[{"name":"instance/settings/GENERAL"}]}`, "generalSetting is required for GENERAL"},
"mismatched value": {`{"instanceSettings":[{"name":"instance/settings/GENERAL","accessSetting":{}}]}`, "accessSetting does not match GENERAL; use generalSetting"},
+8
View File
@@ -585,6 +585,14 @@ func (p *planner) planUndeclared() error {
if _, declared := p.desired.Sources[name]; declared {
continue
}
if name == "instance/settings/MEMO_RELATED" {
change := &apipb.ResourceChange{
Resource: name, Action: apipb.ResourceChange_RELEASE,
Message: "reaction configuration is retired; reactions use the full emoji picker",
}
p.changes = append(p.changes, rankedChange{rank: rankInstanceSetting, change: change, op: &operation{change: change}})
continue
}
removed := p.removed[name]
kind, id, err := ParseResourceName(name)
if err != nil {
+15 -3
View File
@@ -243,7 +243,7 @@ func TestPlanUndeclaredManagedResources(t *testing.T) {
managed("identity-providers/vanished", "IdentityProvider"),
locked,
managed("identity-providers/forgotten", "IdentityProvider"),
managed("instance/settings/MEMO_RELATED", "InstanceSetting"),
managed("instance/settings/NOTIFICATION", "InstanceSetting"),
managed("users/old", "User"),
managed("users/kept", "User"),
}}
@@ -254,7 +254,7 @@ func TestPlanUndeclaredManagedResources(t *testing.T) {
{"resource":"identity-providers/destroyed","destroy":true},
{"resource":"identity-providers/vanished","destroy":true},
{"resource":"identity-providers/locked","destroy":true},
{"resource":"instance/settings/MEMO_RELATED","destroy":true},
{"resource":"instance/settings/NOTIFICATION","destroy":true},
{"resource":"users/old","destroy":true},
{"resource":"users/kept"},
{"resource":"users/never-managed","destroy":true}
@@ -265,7 +265,7 @@ func TestPlanUndeclaredManagedResources(t *testing.T) {
"identity-providers/vanished": apipb.ResourceChange_RELEASE,
"identity-providers/locked": apipb.ResourceChange_ERROR,
"identity-providers/forgotten": apipb.ResourceChange_ERROR,
"instance/settings/MEMO_RELATED": apipb.ResourceChange_RESET,
"instance/settings/NOTIFICATION": apipb.ResourceChange_RESET,
"users/old": apipb.ResourceChange_ERROR,
"users/kept": apipb.ResourceChange_RELEASE,
}
@@ -281,6 +281,18 @@ func TestPlanUndeclaredManagedResources(t *testing.T) {
require.Equal(t, int64(4), result.Message.Serial)
}
func TestPlanReleasesRetiredReactionSetting(t *testing.T) {
reader := newFakeReader()
reader.state = &storepb.InstanceConfigurationState{Resources: []*storepb.InstanceConfigurationState_ManagedResource{
{Name: "instance/settings/MEMO_RELATED", Kind: "InstanceSetting", ManagedFields: []string{"*"}},
}}
desired := loadDesired(t, map[string]string{"empty.json": `{}`})
plan := planFor(t, desired, reader)
require.True(t, plan.Valid())
require.Equal(t, apipb.ResourceChange_RELEASE, changeFor(t, plan, "instance/settings/MEMO_RELATED").Action)
require.Empty(t, plan.next.Resources)
}
func TestPlanOrdersActions(t *testing.T) {
reader := newFakeReader()
reader.state = &storepb.InstanceConfigurationState{Resources: []*storepb.InstanceConfigurationState_ManagedResource{
+1 -1
View File
@@ -27,7 +27,7 @@ const (
)
// ConfigurableInstanceSettingKeys are the instance setting keys a file may declare.
var ConfigurableInstanceSettingKeys = []string{"ACCESS", "GENERAL", "STORAGE", "MEMO_RELATED", "NOTIFICATION", "AI", "USAGE_LIMITS"}
var ConfigurableInstanceSettingKeys = []string{"ACCESS", "GENERAL", "STORAGE", "NOTIFICATION", "AI", "USAGE_LIMITS"}
// userFields are the User fields a file may set. The rest of a profile belongs
// to the user.
@@ -0,0 +1,5 @@
# Unreleased configuration fixture
Reactions use the full Unicode emoji picker. Configuration files must omit the retired `MEMO_RELATED` setting and
`memoRelatedSetting` value, including references in `lifecycle` or `removed`. After those entries are removed, the next
apply releases the old ownership record automatically. Existing memo reactions are preserved.
-24
View File
@@ -35,10 +35,6 @@ func ToStore(setting *apipb.InstanceSetting) *storepb.InstanceSetting {
if value := setting.GetStorageSetting(); value != nil {
result.Value = &storepb.InstanceSetting_StorageSetting{StorageSetting: storageSettingToStore(value)}
}
case storepb.InstanceSettingKey_MEMO_RELATED:
if value := setting.GetMemoRelatedSetting(); value != nil {
result.Value = &storepb.InstanceSetting_MemoRelatedSetting{MemoRelatedSetting: memoRelatedSettingToStore(value)}
}
case storepb.InstanceSettingKey_TAGS:
if value := setting.GetTagsSetting(); value != nil {
result.Value = &storepb.InstanceSetting_TagsSetting{TagsSetting: tagsSettingToStore(value)}
@@ -74,8 +70,6 @@ func FromStore(setting *storepb.InstanceSetting) *apipb.InstanceSetting {
result.Value = &apipb.InstanceSetting_GeneralSetting_{GeneralSetting: generalSettingFromStore(setting.GetGeneralSetting())}
case *storepb.InstanceSetting_StorageSetting:
result.Value = &apipb.InstanceSetting_StorageSetting_{StorageSetting: storageSettingFromStore(setting.GetStorageSetting())}
case *storepb.InstanceSetting_MemoRelatedSetting:
result.Value = &apipb.InstanceSetting_MemoRelatedSetting_{MemoRelatedSetting: memoRelatedSettingFromStore(setting.GetMemoRelatedSetting())}
case *storepb.InstanceSetting_TagsSetting:
result.Value = &apipb.InstanceSetting_TagsSetting_{TagsSetting: tagsSettingFromStore(setting.GetTagsSetting())}
case *storepb.InstanceSetting_NotificationSetting:
@@ -312,24 +306,6 @@ func storageToStore(storage *apipb.InstanceSetting_Storage) *storepb.Storage {
return storagepb
}
func memoRelatedSettingFromStore(setting *storepb.InstanceMemoRelatedSetting) *apipb.InstanceSetting_MemoRelatedSetting {
if setting == nil {
return nil
}
return &apipb.InstanceSetting_MemoRelatedSetting{
Reactions: setting.Reactions,
}
}
func memoRelatedSettingToStore(setting *apipb.InstanceSetting_MemoRelatedSetting) *storepb.InstanceMemoRelatedSetting {
if setting == nil {
return nil
}
return &storepb.InstanceMemoRelatedSetting{
Reactions: setting.Reactions,
}
}
func tagsSettingFromStore(setting *storepb.InstanceTagsSetting) *apipb.InstanceSetting_TagsSetting {
if setting == nil {
return nil
-3
View File
@@ -32,9 +32,6 @@ func TestConversionRoundTrips(t *testing.T) {
},
DefaultStorageId: "s3",
}}},
{Key: storepb.InstanceSettingKey_MEMO_RELATED, Value: &storepb.InstanceSetting_MemoRelatedSetting{MemoRelatedSetting: &storepb.InstanceMemoRelatedSetting{
Reactions: []string{"👍", "🎉"},
}}},
{Key: storepb.InstanceSettingKey_TAGS, Value: &storepb.InstanceSetting_TagsSetting{TagsSetting: &storepb.InstanceTagsSetting{
Tags: map[string]*storepb.InstanceTagMetadata{"work": {BackgroundColor: &colorpb.Color{Red: 1}, BlurContent: true}},
}}},
-4
View File
@@ -55,10 +55,6 @@ func ValidateUpdate(setting, existing *storepb.InstanceSetting) error {
return errors.New("storage setting is required")
}
return validateStorageSetting(setting.GetStorageSetting(), existing.GetStorageSetting())
case storepb.InstanceSettingKey_MEMO_RELATED:
if setting.GetMemoRelatedSetting() == nil {
return errors.New("memo related setting is required")
}
case storepb.InstanceSettingKey_TAGS:
if setting.GetTagsSetting() == nil {
return errors.New("tags setting is required")
+2 -3
View File
@@ -14,7 +14,6 @@ func TestValidateRequiresValueMatchingKey(t *testing.T) {
for _, key := range []storepb.InstanceSettingKey{
storepb.InstanceSettingKey_GENERAL,
storepb.InstanceSettingKey_STORAGE,
storepb.InstanceSettingKey_MEMO_RELATED,
storepb.InstanceSettingKey_TAGS,
storepb.InstanceSettingKey_NOTIFICATION,
storepb.InstanceSettingKey_AI,
@@ -22,13 +21,13 @@ func TestValidateRequiresValueMatchingKey(t *testing.T) {
storepb.InstanceSettingKey_USAGE_LIMITS,
} {
// A GENERAL value under every other key is a mismatch; under GENERAL
// the MEMO_RELATED value is.
// the TAGS value is.
setting := &storepb.InstanceSetting{
Key: key,
Value: &storepb.InstanceSetting_GeneralSetting{GeneralSetting: &storepb.InstanceGeneralSetting{}},
}
if key == storepb.InstanceSettingKey_GENERAL {
setting.Value = &storepb.InstanceSetting_MemoRelatedSetting{MemoRelatedSetting: &storepb.InstanceMemoRelatedSetting{}}
setting.Value = &storepb.InstanceSetting_TagsSetting{TagsSetting: &storepb.InstanceTagsSetting{}}
}
require.Error(t, Validate(setting), key.String())
}
+5
View File
@@ -834,3 +834,8 @@ The v0.31 deployment configuration files (`/etc/secrets/memos-idp-*.json` and `m
26.10.0 without a migration, and an instance that kept them through the upgrade gave no sign of it beyond the settings that had silently
reverted (usememos/memos#6515). Startup now logs one warning naming any such files still present, without reading them, and points at the
configuration directory. A missing `/etc/secrets` stays silent.
### 2026-11-14 — Reaction picker
`MEMO_RELATED` is retired. Reactions use the full Unicode emoji picker; remove this setting and its lifecycle references from
declarative configuration files. The next apply releases its old ownership record automatically. Existing reactions are preserved.
+8
View File
@@ -25,6 +25,14 @@ instead, and update `core/configuration/testdata/compat/` in the same change. Af
- `Memo.unassigned`: use an unset `Memo.space`. Removed in a later release.
```
## Unreleased
### Breaking
- Removed `InstanceSetting.MemoRelatedSetting`, `memo_related_setting`, and the `MEMO_RELATED` key.
Reactions now use the full Unicode emoji picker. Configuration files declaring `instance/settings/MEMO_RELATED` or
`memoRelatedSetting` are rejected; remove that setting from configuration files. Stored reactions are preserved.
## 26.10.0
### Breaking
+5 -10
View File
@@ -135,14 +135,15 @@ message InstanceSetting {
// Format: instance/settings/{setting}
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
reserved 4;
reserved "memo_related_setting";
// The setting value. The set field matches the key in name.
oneof value {
// The value of the GENERAL setting.
GeneralSetting general_setting = 2;
// The value of the STORAGE setting.
StorageSetting storage_setting = 3;
// The value of the MEMO_RELATED setting.
MemoRelatedSetting memo_related_setting = 4;
// The value of the TAGS setting.
TagsSetting tags_setting = 5;
// The value of the NOTIFICATION setting.
@@ -162,8 +163,8 @@ message InstanceSetting {
GENERAL = 1;
// Attachment storage settings.
STORAGE = 2;
// Memo-related settings.
MEMO_RELATED = 3;
reserved 3;
reserved "MEMO_RELATED";
// Tag metadata.
TAGS = 4;
// Notification transport settings.
@@ -339,12 +340,6 @@ message InstanceSetting {
}
}
// MemoRelatedSetting is the memo-related instance configuration.
message MemoRelatedSetting {
// The reactions users can choose from. Defaults to a built-in emoji set when empty.
repeated string reactions = 1;
}
// TagsSetting is the instance-wide tag metadata configuration.
// Active tag metadata is stored in per-user tag settings. This message remains for backward compatibility with
// existing clients and migrations.
+119 -193
View File
@@ -88,8 +88,6 @@ const (
InstanceSetting_GENERAL InstanceSetting_Key = 1
// Attachment storage settings.
InstanceSetting_STORAGE InstanceSetting_Key = 2
// Memo-related settings.
InstanceSetting_MEMO_RELATED InstanceSetting_Key = 3
// Tag metadata.
InstanceSetting_TAGS InstanceSetting_Key = 4
// Notification transport settings.
@@ -108,7 +106,6 @@ var (
0: "KEY_UNSPECIFIED",
1: "GENERAL",
2: "STORAGE",
3: "MEMO_RELATED",
4: "TAGS",
5: "NOTIFICATION",
6: "AI",
@@ -119,7 +116,6 @@ var (
"KEY_UNSPECIFIED": 0,
"GENERAL": 1,
"STORAGE": 2,
"MEMO_RELATED": 3,
"TAGS": 4,
"NOTIFICATION": 5,
"AI": 6,
@@ -483,7 +479,6 @@ type InstanceSetting struct {
//
// *InstanceSetting_GeneralSetting_
// *InstanceSetting_StorageSetting_
// *InstanceSetting_MemoRelatedSetting_
// *InstanceSetting_TagsSetting_
// *InstanceSetting_NotificationSetting_
// *InstanceSetting_AiSetting
@@ -556,15 +551,6 @@ func (x *InstanceSetting) GetStorageSetting() *InstanceSetting_StorageSetting {
return nil
}
func (x *InstanceSetting) GetMemoRelatedSetting() *InstanceSetting_MemoRelatedSetting {
if x != nil {
if x, ok := x.Value.(*InstanceSetting_MemoRelatedSetting_); ok {
return x.MemoRelatedSetting
}
}
return nil
}
func (x *InstanceSetting) GetTagsSetting() *InstanceSetting_TagsSetting {
if x != nil {
if x, ok := x.Value.(*InstanceSetting_TagsSetting_); ok {
@@ -624,11 +610,6 @@ type InstanceSetting_StorageSetting_ struct {
StorageSetting *InstanceSetting_StorageSetting `protobuf:"bytes,3,opt,name=storage_setting,json=storageSetting,proto3,oneof"`
}
type InstanceSetting_MemoRelatedSetting_ struct {
// The value of the MEMO_RELATED setting.
MemoRelatedSetting *InstanceSetting_MemoRelatedSetting `protobuf:"bytes,4,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"`
}
type InstanceSetting_TagsSetting_ struct {
// The value of the TAGS setting.
TagsSetting *InstanceSetting_TagsSetting `protobuf:"bytes,5,opt,name=tags_setting,json=tagsSetting,proto3,oneof"`
@@ -658,8 +639,6 @@ func (*InstanceSetting_GeneralSetting_) isInstanceSetting_Value() {}
func (*InstanceSetting_StorageSetting_) isInstanceSetting_Value() {}
func (*InstanceSetting_MemoRelatedSetting_) isInstanceSetting_Value() {}
func (*InstanceSetting_TagsSetting_) isInstanceSetting_Value() {}
func (*InstanceSetting_NotificationSetting_) isInstanceSetting_Value() {}
@@ -1496,52 +1475,6 @@ type InstanceSetting_Storage_S3Config_ struct {
func (*InstanceSetting_Storage_S3Config_) isInstanceSetting_Storage_Config() {}
// MemoRelatedSetting is the memo-related instance configuration.
type InstanceSetting_MemoRelatedSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The reactions users can choose from. Defaults to a built-in emoji set when empty.
Reactions []string `protobuf:"bytes,1,rep,name=reactions,proto3" json:"reactions,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *InstanceSetting_MemoRelatedSetting) Reset() {
*x = InstanceSetting_MemoRelatedSetting{}
mi := &file_api_instance_service_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *InstanceSetting_MemoRelatedSetting) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InstanceSetting_MemoRelatedSetting) ProtoMessage() {}
func (x *InstanceSetting_MemoRelatedSetting) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[16]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use InstanceSetting_MemoRelatedSetting.ProtoReflect.Descriptor instead.
func (*InstanceSetting_MemoRelatedSetting) Descriptor() ([]byte, []int) {
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 3}
}
func (x *InstanceSetting_MemoRelatedSetting) GetReactions() []string {
if x != nil {
return x.Reactions
}
return nil
}
// TagsSetting is the instance-wide tag metadata configuration.
// Active tag metadata is stored in per-user tag settings. This message remains for backward compatibility with
// existing clients and migrations.
@@ -1557,7 +1490,7 @@ type InstanceSetting_TagsSetting struct {
func (x *InstanceSetting_TagsSetting) Reset() {
*x = InstanceSetting_TagsSetting{}
mi := &file_api_instance_service_proto_msgTypes[17]
mi := &file_api_instance_service_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1569,7 +1502,7 @@ func (x *InstanceSetting_TagsSetting) String() string {
func (*InstanceSetting_TagsSetting) ProtoMessage() {}
func (x *InstanceSetting_TagsSetting) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[17]
mi := &file_api_instance_service_proto_msgTypes[16]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1582,7 +1515,7 @@ func (x *InstanceSetting_TagsSetting) ProtoReflect() protoreflect.Message {
// Deprecated: Use InstanceSetting_TagsSetting.ProtoReflect.Descriptor instead.
func (*InstanceSetting_TagsSetting) Descriptor() ([]byte, []int) {
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 4}
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 3}
}
func (x *InstanceSetting_TagsSetting) GetTags() map[string]*InstanceSetting_TagMetadata {
@@ -1605,7 +1538,7 @@ type InstanceSetting_TagMetadata struct {
func (x *InstanceSetting_TagMetadata) Reset() {
*x = InstanceSetting_TagMetadata{}
mi := &file_api_instance_service_proto_msgTypes[18]
mi := &file_api_instance_service_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1617,7 +1550,7 @@ func (x *InstanceSetting_TagMetadata) String() string {
func (*InstanceSetting_TagMetadata) ProtoMessage() {}
func (x *InstanceSetting_TagMetadata) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[18]
mi := &file_api_instance_service_proto_msgTypes[17]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1630,7 +1563,7 @@ func (x *InstanceSetting_TagMetadata) ProtoReflect() protoreflect.Message {
// Deprecated: Use InstanceSetting_TagMetadata.ProtoReflect.Descriptor instead.
func (*InstanceSetting_TagMetadata) Descriptor() ([]byte, []int) {
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 5}
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 4}
}
func (x *InstanceSetting_TagMetadata) GetBackgroundColor() *color.Color {
@@ -1658,7 +1591,7 @@ type InstanceSetting_NotificationSetting struct {
func (x *InstanceSetting_NotificationSetting) Reset() {
*x = InstanceSetting_NotificationSetting{}
mi := &file_api_instance_service_proto_msgTypes[19]
mi := &file_api_instance_service_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1670,7 +1603,7 @@ func (x *InstanceSetting_NotificationSetting) String() string {
func (*InstanceSetting_NotificationSetting) ProtoMessage() {}
func (x *InstanceSetting_NotificationSetting) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[19]
mi := &file_api_instance_service_proto_msgTypes[18]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1683,7 +1616,7 @@ func (x *InstanceSetting_NotificationSetting) ProtoReflect() protoreflect.Messag
// Deprecated: Use InstanceSetting_NotificationSetting.ProtoReflect.Descriptor instead.
func (*InstanceSetting_NotificationSetting) Descriptor() ([]byte, []int) {
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 6}
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 5}
}
func (x *InstanceSetting_NotificationSetting) GetEmail() *InstanceSetting_NotificationSetting_EmailSetting {
@@ -1708,7 +1641,7 @@ type InstanceSetting_AISetting struct {
func (x *InstanceSetting_AISetting) Reset() {
*x = InstanceSetting_AISetting{}
mi := &file_api_instance_service_proto_msgTypes[20]
mi := &file_api_instance_service_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1720,7 +1653,7 @@ func (x *InstanceSetting_AISetting) String() string {
func (*InstanceSetting_AISetting) ProtoMessage() {}
func (x *InstanceSetting_AISetting) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[20]
mi := &file_api_instance_service_proto_msgTypes[19]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1733,7 +1666,7 @@ func (x *InstanceSetting_AISetting) ProtoReflect() protoreflect.Message {
// Deprecated: Use InstanceSetting_AISetting.ProtoReflect.Descriptor instead.
func (*InstanceSetting_AISetting) Descriptor() ([]byte, []int) {
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 7}
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 6}
}
func (x *InstanceSetting_AISetting) GetProviders() []*InstanceSetting_AIProviderConfig {
@@ -1773,7 +1706,7 @@ type InstanceSetting_AIProviderConfig struct {
func (x *InstanceSetting_AIProviderConfig) Reset() {
*x = InstanceSetting_AIProviderConfig{}
mi := &file_api_instance_service_proto_msgTypes[21]
mi := &file_api_instance_service_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1785,7 +1718,7 @@ func (x *InstanceSetting_AIProviderConfig) String() string {
func (*InstanceSetting_AIProviderConfig) ProtoMessage() {}
func (x *InstanceSetting_AIProviderConfig) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[21]
mi := &file_api_instance_service_proto_msgTypes[20]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1798,7 +1731,7 @@ func (x *InstanceSetting_AIProviderConfig) ProtoReflect() protoreflect.Message {
// Deprecated: Use InstanceSetting_AIProviderConfig.ProtoReflect.Descriptor instead.
func (*InstanceSetting_AIProviderConfig) Descriptor() ([]byte, []int) {
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 8}
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 7}
}
func (x *InstanceSetting_AIProviderConfig) GetId() string {
@@ -1870,7 +1803,7 @@ type InstanceSetting_TranscriptionConfig struct {
func (x *InstanceSetting_TranscriptionConfig) Reset() {
*x = InstanceSetting_TranscriptionConfig{}
mi := &file_api_instance_service_proto_msgTypes[22]
mi := &file_api_instance_service_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1882,7 +1815,7 @@ func (x *InstanceSetting_TranscriptionConfig) String() string {
func (*InstanceSetting_TranscriptionConfig) ProtoMessage() {}
func (x *InstanceSetting_TranscriptionConfig) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[22]
mi := &file_api_instance_service_proto_msgTypes[21]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1895,7 +1828,7 @@ func (x *InstanceSetting_TranscriptionConfig) ProtoReflect() protoreflect.Messag
// Deprecated: Use InstanceSetting_TranscriptionConfig.ProtoReflect.Descriptor instead.
func (*InstanceSetting_TranscriptionConfig) Descriptor() ([]byte, []int) {
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 9}
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 8}
}
func (x *InstanceSetting_TranscriptionConfig) GetProviderId() string {
@@ -1937,7 +1870,7 @@ type InstanceSetting_AccessSetting struct {
func (x *InstanceSetting_AccessSetting) Reset() {
*x = InstanceSetting_AccessSetting{}
mi := &file_api_instance_service_proto_msgTypes[23]
mi := &file_api_instance_service_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1949,7 +1882,7 @@ func (x *InstanceSetting_AccessSetting) String() string {
func (*InstanceSetting_AccessSetting) ProtoMessage() {}
func (x *InstanceSetting_AccessSetting) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[23]
mi := &file_api_instance_service_proto_msgTypes[22]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1962,7 +1895,7 @@ func (x *InstanceSetting_AccessSetting) ProtoReflect() protoreflect.Message {
// Deprecated: Use InstanceSetting_AccessSetting.ProtoReflect.Descriptor instead.
func (*InstanceSetting_AccessSetting) Descriptor() ([]byte, []int) {
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 10}
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 9}
}
func (x *InstanceSetting_AccessSetting) GetAccessMode() InstanceAccessMode {
@@ -1987,7 +1920,7 @@ type InstanceSetting_UsageLimitsSetting struct {
func (x *InstanceSetting_UsageLimitsSetting) Reset() {
*x = InstanceSetting_UsageLimitsSetting{}
mi := &file_api_instance_service_proto_msgTypes[24]
mi := &file_api_instance_service_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1999,7 +1932,7 @@ func (x *InstanceSetting_UsageLimitsSetting) String() string {
func (*InstanceSetting_UsageLimitsSetting) ProtoMessage() {}
func (x *InstanceSetting_UsageLimitsSetting) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[24]
mi := &file_api_instance_service_proto_msgTypes[23]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2012,7 +1945,7 @@ func (x *InstanceSetting_UsageLimitsSetting) ProtoReflect() protoreflect.Message
// Deprecated: Use InstanceSetting_UsageLimitsSetting.ProtoReflect.Descriptor instead.
func (*InstanceSetting_UsageLimitsSetting) Descriptor() ([]byte, []int) {
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 11}
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 10}
}
func (x *InstanceSetting_UsageLimitsSetting) GetLimits() []*InstanceSetting_UsageLimitsSetting_UsageLimit {
@@ -2037,7 +1970,7 @@ type InstanceSetting_GeneralSetting_CustomProfile struct {
func (x *InstanceSetting_GeneralSetting_CustomProfile) Reset() {
*x = InstanceSetting_GeneralSetting_CustomProfile{}
mi := &file_api_instance_service_proto_msgTypes[25]
mi := &file_api_instance_service_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2049,7 +1982,7 @@ func (x *InstanceSetting_GeneralSetting_CustomProfile) String() string {
func (*InstanceSetting_GeneralSetting_CustomProfile) ProtoMessage() {}
func (x *InstanceSetting_GeneralSetting_CustomProfile) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[25]
mi := &file_api_instance_service_proto_msgTypes[24]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2112,7 +2045,7 @@ type InstanceSetting_StorageSetting_S3Config struct {
func (x *InstanceSetting_StorageSetting_S3Config) Reset() {
*x = InstanceSetting_StorageSetting_S3Config{}
mi := &file_api_instance_service_proto_msgTypes[26]
mi := &file_api_instance_service_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2124,7 +2057,7 @@ func (x *InstanceSetting_StorageSetting_S3Config) String() string {
func (*InstanceSetting_StorageSetting_S3Config) ProtoMessage() {}
func (x *InstanceSetting_StorageSetting_S3Config) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[26]
mi := &file_api_instance_service_proto_msgTypes[25]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2215,7 +2148,7 @@ type InstanceSetting_Storage_S3Config struct {
func (x *InstanceSetting_Storage_S3Config) Reset() {
*x = InstanceSetting_Storage_S3Config{}
mi := &file_api_instance_service_proto_msgTypes[27]
mi := &file_api_instance_service_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2227,7 +2160,7 @@ func (x *InstanceSetting_Storage_S3Config) String() string {
func (*InstanceSetting_Storage_S3Config) ProtoMessage() {}
func (x *InstanceSetting_Storage_S3Config) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[27]
mi := &file_api_instance_service_proto_msgTypes[26]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2322,7 +2255,7 @@ type InstanceSetting_NotificationSetting_EmailSetting struct {
func (x *InstanceSetting_NotificationSetting_EmailSetting) Reset() {
*x = InstanceSetting_NotificationSetting_EmailSetting{}
mi := &file_api_instance_service_proto_msgTypes[29]
mi := &file_api_instance_service_proto_msgTypes[28]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2334,7 +2267,7 @@ func (x *InstanceSetting_NotificationSetting_EmailSetting) String() string {
func (*InstanceSetting_NotificationSetting_EmailSetting) ProtoMessage() {}
func (x *InstanceSetting_NotificationSetting_EmailSetting) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[29]
mi := &file_api_instance_service_proto_msgTypes[28]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2347,7 +2280,7 @@ func (x *InstanceSetting_NotificationSetting_EmailSetting) ProtoReflect() protor
// Deprecated: Use InstanceSetting_NotificationSetting_EmailSetting.ProtoReflect.Descriptor instead.
func (*InstanceSetting_NotificationSetting_EmailSetting) Descriptor() ([]byte, []int) {
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 6, 0}
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 5, 0}
}
func (x *InstanceSetting_NotificationSetting_EmailSetting) GetEnabled() bool {
@@ -2446,7 +2379,7 @@ type InstanceSetting_UsageLimitsSetting_UsageLimit struct {
func (x *InstanceSetting_UsageLimitsSetting_UsageLimit) Reset() {
*x = InstanceSetting_UsageLimitsSetting_UsageLimit{}
mi := &file_api_instance_service_proto_msgTypes[30]
mi := &file_api_instance_service_proto_msgTypes[29]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2458,7 +2391,7 @@ func (x *InstanceSetting_UsageLimitsSetting_UsageLimit) String() string {
func (*InstanceSetting_UsageLimitsSetting_UsageLimit) ProtoMessage() {}
func (x *InstanceSetting_UsageLimitsSetting_UsageLimit) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[30]
mi := &file_api_instance_service_proto_msgTypes[29]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2471,7 +2404,7 @@ func (x *InstanceSetting_UsageLimitsSetting_UsageLimit) ProtoReflect() protorefl
// Deprecated: Use InstanceSetting_UsageLimitsSetting_UsageLimit.ProtoReflect.Descriptor instead.
func (*InstanceSetting_UsageLimitsSetting_UsageLimit) Descriptor() ([]byte, []int) {
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 11, 0}
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 10, 0}
}
func (x *InstanceSetting_UsageLimitsSetting_UsageLimit) GetUsers() []string {
@@ -2529,7 +2462,7 @@ type InstanceStats_DatabaseStats struct {
func (x *InstanceStats_DatabaseStats) Reset() {
*x = InstanceStats_DatabaseStats{}
mi := &file_api_instance_service_proto_msgTypes[31]
mi := &file_api_instance_service_proto_msgTypes[30]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2541,7 +2474,7 @@ func (x *InstanceStats_DatabaseStats) String() string {
func (*InstanceStats_DatabaseStats) ProtoMessage() {}
func (x *InstanceStats_DatabaseStats) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[31]
mi := &file_api_instance_service_proto_msgTypes[30]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2589,7 +2522,7 @@ type ConfigurationStatus_ManagedResource struct {
func (x *ConfigurationStatus_ManagedResource) Reset() {
*x = ConfigurationStatus_ManagedResource{}
mi := &file_api_instance_service_proto_msgTypes[32]
mi := &file_api_instance_service_proto_msgTypes[31]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2601,7 +2534,7 @@ func (x *ConfigurationStatus_ManagedResource) String() string {
func (*ConfigurationStatus_ManagedResource) ProtoMessage() {}
func (x *ConfigurationStatus_ManagedResource) ProtoReflect() protoreflect.Message {
mi := &file_api_instance_service_proto_msgTypes[32]
mi := &file_api_instance_service_proto_msgTypes[31]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2664,12 +2597,11 @@ const file_api_instance_service_proto_rawDesc = "" +
"\tChallenge\x12\x1a\n" +
"\bprovider\x18\x01 \x01(\tR\bprovider\x12\x19\n" +
"\bsite_key\x18\x02 \x01(\tR\asiteKey\"\x1b\n" +
"\x19GetInstanceProfileRequest\"\xfc$\n" +
"\x19GetInstanceProfileRequest\"\x83$\n" +
"\x0fInstanceSetting\x12\x17\n" +
"\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12T\n" +
"\x0fgeneral_setting\x18\x02 \x01(\v2).memos.api.InstanceSetting.GeneralSettingH\x00R\x0egeneralSetting\x12T\n" +
"\x0fstorage_setting\x18\x03 \x01(\v2).memos.api.InstanceSetting.StorageSettingH\x00R\x0estorageSetting\x12a\n" +
"\x14memo_related_setting\x18\x04 \x01(\v2-.memos.api.InstanceSetting.MemoRelatedSettingH\x00R\x12memoRelatedSetting\x12K\n" +
"\x0fstorage_setting\x18\x03 \x01(\v2).memos.api.InstanceSetting.StorageSettingH\x00R\x0estorageSetting\x12K\n" +
"\ftags_setting\x18\x05 \x01(\v2&.memos.api.InstanceSetting.TagsSettingH\x00R\vtagsSetting\x12c\n" +
"\x14notification_setting\x18\x06 \x01(\v2..memos.api.InstanceSetting.NotificationSettingH\x00R\x13notificationSetting\x12E\n" +
"\n" +
@@ -2721,9 +2653,7 @@ const file_api_instance_service_proto_rawDesc = "" +
"\x11access_key_secret\x18\x05 \x01(\tB\x03\xe0A\x04R\x0faccessKeySecret\x12$\n" +
"\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\x127\n" +
"\x18insecure_skip_tls_verify\x18\a \x01(\bR\x15insecureSkipTlsVerifyB\b\n" +
"\x06config\x1a2\n" +
"\x12MemoRelatedSetting\x12\x1c\n" +
"\treactions\x18\x01 \x03(\tR\treactions\x1a\xb4\x01\n" +
"\x06config\x1a\xb4\x01\n" +
"\vTagsSetting\x12D\n" +
"\x04tags\x18\x01 \x03(\v20.memos.api.InstanceSetting.TagsSetting.TagsEntryR\x04tags\x1a_\n" +
"\tTagsEntry\x12\x10\n" +
@@ -2783,18 +2713,17 @@ const file_api_instance_service_proto_rawDesc = "" +
"\v_memo_countB\x15\n" +
"\x13_memo_content_bytesB\x10\n" +
"\x0e_storage_bytesB\x0f\n" +
"\r_upload_bytes\"\x88\x01\n" +
"\r_upload_bytes\"\x8a\x01\n" +
"\x03Key\x12\x13\n" +
"\x0fKEY_UNSPECIFIED\x10\x00\x12\v\n" +
"\aGENERAL\x10\x01\x12\v\n" +
"\aSTORAGE\x10\x02\x12\x10\n" +
"\fMEMO_RELATED\x10\x03\x12\b\n" +
"\aSTORAGE\x10\x02\x12\b\n" +
"\x04TAGS\x10\x04\x12\x10\n" +
"\fNOTIFICATION\x10\x05\x12\x06\n" +
"\x02AI\x10\x06\x12\n" +
"\n" +
"\x06ACCESS\x10\a\x12\x10\n" +
"\fUSAGE_LIMITS\x10\b\"L\n" +
"\fUSAGE_LIMITS\x10\b\"\x04\b\x03\x10\x03*\fMEMO_RELATED\"L\n" +
"\vStorageType\x12\x1c\n" +
"\x18STORAGE_TYPE_UNSPECIFIED\x10\x00\x12\f\n" +
"\bDATABASE\x10\x01\x12\t\n" +
@@ -2807,7 +2736,7 @@ const file_api_instance_service_proto_rawDesc = "" +
"\n" +
"\x06GEMINI\x10\x02:^\xeaA[\n" +
"\x19memos.api/InstanceSetting\x12\x1binstance/settings/{setting}*\x10instanceSettings2\x0finstanceSettingB\a\n" +
"\x05value\"R\n" +
"\x05valueJ\x04\b\x04\x10\x05R\x14memo_related_setting\"R\n" +
"\x19GetInstanceSettingRequest\x125\n" +
"\x04name\x18\x01 \x01(\tB!\xe0A\x02\xfaA\x1b\n" +
"\x19memos.api/InstanceSettingR\x04name\"Z\n" +
@@ -2875,7 +2804,7 @@ func file_api_instance_service_proto_rawDescGZIP() []byte {
}
var file_api_instance_service_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
var file_api_instance_service_proto_msgTypes = make([]protoimpl.MessageInfo, 33)
var file_api_instance_service_proto_msgTypes = make([]protoimpl.MessageInfo, 32)
var file_api_instance_service_proto_goTypes = []any{
(InstanceAccessMode)(0), // 0: memos.api.InstanceAccessMode
(InstanceSetting_Key)(0), // 1: memos.api.InstanceSetting.Key
@@ -2898,83 +2827,81 @@ var file_api_instance_service_proto_goTypes = []any{
(*InstanceSetting_GeneralSetting)(nil), // 18: memos.api.InstanceSetting.GeneralSetting
(*InstanceSetting_StorageSetting)(nil), // 19: memos.api.InstanceSetting.StorageSetting
(*InstanceSetting_Storage)(nil), // 20: memos.api.InstanceSetting.Storage
(*InstanceSetting_MemoRelatedSetting)(nil), // 21: memos.api.InstanceSetting.MemoRelatedSetting
(*InstanceSetting_TagsSetting)(nil), // 22: memos.api.InstanceSetting.TagsSetting
(*InstanceSetting_TagMetadata)(nil), // 23: memos.api.InstanceSetting.TagMetadata
(*InstanceSetting_NotificationSetting)(nil), // 24: memos.api.InstanceSetting.NotificationSetting
(*InstanceSetting_AISetting)(nil), // 25: memos.api.InstanceSetting.AISetting
(*InstanceSetting_AIProviderConfig)(nil), // 26: memos.api.InstanceSetting.AIProviderConfig
(*InstanceSetting_TranscriptionConfig)(nil), // 27: memos.api.InstanceSetting.TranscriptionConfig
(*InstanceSetting_AccessSetting)(nil), // 28: memos.api.InstanceSetting.AccessSetting
(*InstanceSetting_UsageLimitsSetting)(nil), // 29: memos.api.InstanceSetting.UsageLimitsSetting
(*InstanceSetting_GeneralSetting_CustomProfile)(nil), // 30: memos.api.InstanceSetting.GeneralSetting.CustomProfile
(*InstanceSetting_StorageSetting_S3Config)(nil), // 31: memos.api.InstanceSetting.StorageSetting.S3Config
(*InstanceSetting_Storage_S3Config)(nil), // 32: memos.api.InstanceSetting.Storage.S3Config
nil, // 33: memos.api.InstanceSetting.TagsSetting.TagsEntry
(*InstanceSetting_NotificationSetting_EmailSetting)(nil), // 34: memos.api.InstanceSetting.NotificationSetting.EmailSetting
(*InstanceSetting_UsageLimitsSetting_UsageLimit)(nil), // 35: memos.api.InstanceSetting.UsageLimitsSetting.UsageLimit
(*InstanceStats_DatabaseStats)(nil), // 36: memos.api.InstanceStats.DatabaseStats
(*ConfigurationStatus_ManagedResource)(nil), // 37: memos.api.ConfigurationStatus.ManagedResource
(*User)(nil), // 38: memos.api.User
(*fieldmaskpb.FieldMask)(nil), // 39: google.protobuf.FieldMask
(*timestamppb.Timestamp)(nil), // 40: google.protobuf.Timestamp
(*color.Color)(nil), // 41: google.type.Color
(*emptypb.Empty)(nil), // 42: google.protobuf.Empty
(*InstanceSetting_TagsSetting)(nil), // 21: memos.api.InstanceSetting.TagsSetting
(*InstanceSetting_TagMetadata)(nil), // 22: memos.api.InstanceSetting.TagMetadata
(*InstanceSetting_NotificationSetting)(nil), // 23: memos.api.InstanceSetting.NotificationSetting
(*InstanceSetting_AISetting)(nil), // 24: memos.api.InstanceSetting.AISetting
(*InstanceSetting_AIProviderConfig)(nil), // 25: memos.api.InstanceSetting.AIProviderConfig
(*InstanceSetting_TranscriptionConfig)(nil), // 26: memos.api.InstanceSetting.TranscriptionConfig
(*InstanceSetting_AccessSetting)(nil), // 27: memos.api.InstanceSetting.AccessSetting
(*InstanceSetting_UsageLimitsSetting)(nil), // 28: memos.api.InstanceSetting.UsageLimitsSetting
(*InstanceSetting_GeneralSetting_CustomProfile)(nil), // 29: memos.api.InstanceSetting.GeneralSetting.CustomProfile
(*InstanceSetting_StorageSetting_S3Config)(nil), // 30: memos.api.InstanceSetting.StorageSetting.S3Config
(*InstanceSetting_Storage_S3Config)(nil), // 31: memos.api.InstanceSetting.Storage.S3Config
nil, // 32: memos.api.InstanceSetting.TagsSetting.TagsEntry
(*InstanceSetting_NotificationSetting_EmailSetting)(nil), // 33: memos.api.InstanceSetting.NotificationSetting.EmailSetting
(*InstanceSetting_UsageLimitsSetting_UsageLimit)(nil), // 34: memos.api.InstanceSetting.UsageLimitsSetting.UsageLimit
(*InstanceStats_DatabaseStats)(nil), // 35: memos.api.InstanceStats.DatabaseStats
(*ConfigurationStatus_ManagedResource)(nil), // 36: memos.api.ConfigurationStatus.ManagedResource
(*User)(nil), // 37: memos.api.User
(*fieldmaskpb.FieldMask)(nil), // 38: google.protobuf.FieldMask
(*timestamppb.Timestamp)(nil), // 39: google.protobuf.Timestamp
(*color.Color)(nil), // 40: google.type.Color
(*emptypb.Empty)(nil), // 41: google.protobuf.Empty
}
var file_api_instance_service_proto_depIdxs = []int32{
0, // 0: memos.api.InstanceProfile.access_mode:type_name -> memos.api.InstanceAccessMode
38, // 1: memos.api.InstanceProfile.admin:type_name -> memos.api.User
37, // 1: memos.api.InstanceProfile.admin:type_name -> memos.api.User
17, // 2: memos.api.InstanceProfile.challenge:type_name -> memos.api.InstanceProfile.Challenge
18, // 3: memos.api.InstanceSetting.general_setting:type_name -> memos.api.InstanceSetting.GeneralSetting
19, // 4: memos.api.InstanceSetting.storage_setting:type_name -> memos.api.InstanceSetting.StorageSetting
21, // 5: memos.api.InstanceSetting.memo_related_setting:type_name -> memos.api.InstanceSetting.MemoRelatedSetting
22, // 6: memos.api.InstanceSetting.tags_setting:type_name -> memos.api.InstanceSetting.TagsSetting
24, // 7: memos.api.InstanceSetting.notification_setting:type_name -> memos.api.InstanceSetting.NotificationSetting
25, // 8: memos.api.InstanceSetting.ai_setting:type_name -> memos.api.InstanceSetting.AISetting
28, // 9: memos.api.InstanceSetting.access_setting:type_name -> memos.api.InstanceSetting.AccessSetting
29, // 10: memos.api.InstanceSetting.usage_limits_setting:type_name -> memos.api.InstanceSetting.UsageLimitsSetting
7, // 11: memos.api.BatchGetInstanceSettingsResponse.instance_settings:type_name -> memos.api.InstanceSetting
7, // 12: memos.api.UpdateInstanceSettingRequest.instance_setting:type_name -> memos.api.InstanceSetting
39, // 13: memos.api.UpdateInstanceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
34, // 14: memos.api.TestInstanceEmailSettingRequest.email:type_name -> memos.api.InstanceSetting.NotificationSetting.EmailSetting
36, // 15: memos.api.InstanceStats.database:type_name -> memos.api.InstanceStats.DatabaseStats
40, // 16: memos.api.InstanceStats.generated_time:type_name -> google.protobuf.Timestamp
37, // 17: memos.api.ConfigurationStatus.managed_resources:type_name -> memos.api.ConfigurationStatus.ManagedResource
40, // 18: memos.api.ConfigurationStatus.apply_time:type_name -> google.protobuf.Timestamp
30, // 19: memos.api.InstanceSetting.GeneralSetting.custom_profile:type_name -> memos.api.InstanceSetting.GeneralSetting.CustomProfile
20, // 20: memos.api.InstanceSetting.StorageSetting.storages:type_name -> memos.api.InstanceSetting.Storage
4, // 21: memos.api.InstanceSetting.StorageSetting.storage_type:type_name -> memos.api.InstanceSetting.StorageSetting.StorageType
31, // 22: memos.api.InstanceSetting.StorageSetting.s3_config:type_name -> memos.api.InstanceSetting.StorageSetting.S3Config
2, // 23: memos.api.InstanceSetting.Storage.type:type_name -> memos.api.InstanceSetting.StorageType
32, // 24: memos.api.InstanceSetting.Storage.s3_config:type_name -> memos.api.InstanceSetting.Storage.S3Config
33, // 25: memos.api.InstanceSetting.TagsSetting.tags:type_name -> memos.api.InstanceSetting.TagsSetting.TagsEntry
41, // 26: memos.api.InstanceSetting.TagMetadata.background_color:type_name -> google.type.Color
34, // 27: memos.api.InstanceSetting.NotificationSetting.email:type_name -> memos.api.InstanceSetting.NotificationSetting.EmailSetting
26, // 28: memos.api.InstanceSetting.AISetting.providers:type_name -> memos.api.InstanceSetting.AIProviderConfig
27, // 29: memos.api.InstanceSetting.AISetting.transcription:type_name -> memos.api.InstanceSetting.TranscriptionConfig
3, // 30: memos.api.InstanceSetting.AIProviderConfig.type:type_name -> memos.api.InstanceSetting.AIProviderType
0, // 31: memos.api.InstanceSetting.AccessSetting.access_mode:type_name -> memos.api.InstanceAccessMode
35, // 32: memos.api.InstanceSetting.UsageLimitsSetting.limits:type_name -> memos.api.InstanceSetting.UsageLimitsSetting.UsageLimit
23, // 33: memos.api.InstanceSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.InstanceSetting.TagMetadata
6, // 34: memos.api.InstanceService.GetInstanceProfile:input_type -> memos.api.GetInstanceProfileRequest
8, // 35: memos.api.InstanceService.GetInstanceSetting:input_type -> memos.api.GetInstanceSettingRequest
9, // 36: memos.api.InstanceService.BatchGetInstanceSettings:input_type -> memos.api.BatchGetInstanceSettingsRequest
11, // 37: memos.api.InstanceService.UpdateInstanceSetting:input_type -> memos.api.UpdateInstanceSettingRequest
12, // 38: memos.api.InstanceService.TestInstanceEmailSetting:input_type -> memos.api.TestInstanceEmailSettingRequest
14, // 39: memos.api.InstanceService.GetInstanceStats:input_type -> memos.api.GetInstanceStatsRequest
15, // 40: memos.api.InstanceService.GetConfigurationStatus:input_type -> memos.api.GetConfigurationStatusRequest
5, // 41: memos.api.InstanceService.GetInstanceProfile:output_type -> memos.api.InstanceProfile
7, // 42: memos.api.InstanceService.GetInstanceSetting:output_type -> memos.api.InstanceSetting
10, // 43: memos.api.InstanceService.BatchGetInstanceSettings:output_type -> memos.api.BatchGetInstanceSettingsResponse
7, // 44: memos.api.InstanceService.UpdateInstanceSetting:output_type -> memos.api.InstanceSetting
42, // 45: memos.api.InstanceService.TestInstanceEmailSetting:output_type -> google.protobuf.Empty
13, // 46: memos.api.InstanceService.GetInstanceStats:output_type -> memos.api.InstanceStats
16, // 47: memos.api.InstanceService.GetConfigurationStatus:output_type -> memos.api.ConfigurationStatus
41, // [41:48] is the sub-list for method output_type
34, // [34:41] is the sub-list for method input_type
34, // [34:34] is the sub-list for extension type_name
34, // [34:34] is the sub-list for extension extendee
0, // [0:34] is the sub-list for field type_name
21, // 5: memos.api.InstanceSetting.tags_setting:type_name -> memos.api.InstanceSetting.TagsSetting
23, // 6: memos.api.InstanceSetting.notification_setting:type_name -> memos.api.InstanceSetting.NotificationSetting
24, // 7: memos.api.InstanceSetting.ai_setting:type_name -> memos.api.InstanceSetting.AISetting
27, // 8: memos.api.InstanceSetting.access_setting:type_name -> memos.api.InstanceSetting.AccessSetting
28, // 9: memos.api.InstanceSetting.usage_limits_setting:type_name -> memos.api.InstanceSetting.UsageLimitsSetting
7, // 10: memos.api.BatchGetInstanceSettingsResponse.instance_settings:type_name -> memos.api.InstanceSetting
7, // 11: memos.api.UpdateInstanceSettingRequest.instance_setting:type_name -> memos.api.InstanceSetting
38, // 12: memos.api.UpdateInstanceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
33, // 13: memos.api.TestInstanceEmailSettingRequest.email:type_name -> memos.api.InstanceSetting.NotificationSetting.EmailSetting
35, // 14: memos.api.InstanceStats.database:type_name -> memos.api.InstanceStats.DatabaseStats
39, // 15: memos.api.InstanceStats.generated_time:type_name -> google.protobuf.Timestamp
36, // 16: memos.api.ConfigurationStatus.managed_resources:type_name -> memos.api.ConfigurationStatus.ManagedResource
39, // 17: memos.api.ConfigurationStatus.apply_time:type_name -> google.protobuf.Timestamp
29, // 18: memos.api.InstanceSetting.GeneralSetting.custom_profile:type_name -> memos.api.InstanceSetting.GeneralSetting.CustomProfile
20, // 19: memos.api.InstanceSetting.StorageSetting.storages:type_name -> memos.api.InstanceSetting.Storage
4, // 20: memos.api.InstanceSetting.StorageSetting.storage_type:type_name -> memos.api.InstanceSetting.StorageSetting.StorageType
30, // 21: memos.api.InstanceSetting.StorageSetting.s3_config:type_name -> memos.api.InstanceSetting.StorageSetting.S3Config
2, // 22: memos.api.InstanceSetting.Storage.type:type_name -> memos.api.InstanceSetting.StorageType
31, // 23: memos.api.InstanceSetting.Storage.s3_config:type_name -> memos.api.InstanceSetting.Storage.S3Config
32, // 24: memos.api.InstanceSetting.TagsSetting.tags:type_name -> memos.api.InstanceSetting.TagsSetting.TagsEntry
40, // 25: memos.api.InstanceSetting.TagMetadata.background_color:type_name -> google.type.Color
33, // 26: memos.api.InstanceSetting.NotificationSetting.email:type_name -> memos.api.InstanceSetting.NotificationSetting.EmailSetting
25, // 27: memos.api.InstanceSetting.AISetting.providers:type_name -> memos.api.InstanceSetting.AIProviderConfig
26, // 28: memos.api.InstanceSetting.AISetting.transcription:type_name -> memos.api.InstanceSetting.TranscriptionConfig
3, // 29: memos.api.InstanceSetting.AIProviderConfig.type:type_name -> memos.api.InstanceSetting.AIProviderType
0, // 30: memos.api.InstanceSetting.AccessSetting.access_mode:type_name -> memos.api.InstanceAccessMode
34, // 31: memos.api.InstanceSetting.UsageLimitsSetting.limits:type_name -> memos.api.InstanceSetting.UsageLimitsSetting.UsageLimit
22, // 32: memos.api.InstanceSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.InstanceSetting.TagMetadata
6, // 33: memos.api.InstanceService.GetInstanceProfile:input_type -> memos.api.GetInstanceProfileRequest
8, // 34: memos.api.InstanceService.GetInstanceSetting:input_type -> memos.api.GetInstanceSettingRequest
9, // 35: memos.api.InstanceService.BatchGetInstanceSettings:input_type -> memos.api.BatchGetInstanceSettingsRequest
11, // 36: memos.api.InstanceService.UpdateInstanceSetting:input_type -> memos.api.UpdateInstanceSettingRequest
12, // 37: memos.api.InstanceService.TestInstanceEmailSetting:input_type -> memos.api.TestInstanceEmailSettingRequest
14, // 38: memos.api.InstanceService.GetInstanceStats:input_type -> memos.api.GetInstanceStatsRequest
15, // 39: memos.api.InstanceService.GetConfigurationStatus:input_type -> memos.api.GetConfigurationStatusRequest
5, // 40: memos.api.InstanceService.GetInstanceProfile:output_type -> memos.api.InstanceProfile
7, // 41: memos.api.InstanceService.GetInstanceSetting:output_type -> memos.api.InstanceSetting
10, // 42: memos.api.InstanceService.BatchGetInstanceSettings:output_type -> memos.api.BatchGetInstanceSettingsResponse
7, // 43: memos.api.InstanceService.UpdateInstanceSetting:output_type -> memos.api.InstanceSetting
41, // 44: memos.api.InstanceService.TestInstanceEmailSetting:output_type -> google.protobuf.Empty
13, // 45: memos.api.InstanceService.GetInstanceStats:output_type -> memos.api.InstanceStats
16, // 46: memos.api.InstanceService.GetConfigurationStatus:output_type -> memos.api.ConfigurationStatus
40, // [40:47] is the sub-list for method output_type
33, // [33:40] is the sub-list for method input_type
33, // [33:33] is the sub-list for extension type_name
33, // [33:33] is the sub-list for extension extendee
0, // [0:33] is the sub-list for field type_name
}
func init() { file_api_instance_service_proto_init() }
@@ -2986,7 +2913,6 @@ func file_api_instance_service_proto_init() {
file_api_instance_service_proto_msgTypes[2].OneofWrappers = []any{
(*InstanceSetting_GeneralSetting_)(nil),
(*InstanceSetting_StorageSetting_)(nil),
(*InstanceSetting_MemoRelatedSetting_)(nil),
(*InstanceSetting_TagsSetting_)(nil),
(*InstanceSetting_NotificationSetting_)(nil),
(*InstanceSetting_AiSetting)(nil),
@@ -2996,14 +2922,14 @@ func file_api_instance_service_proto_init() {
file_api_instance_service_proto_msgTypes[15].OneofWrappers = []any{
(*InstanceSetting_Storage_S3Config_)(nil),
}
file_api_instance_service_proto_msgTypes[30].OneofWrappers = []any{}
file_api_instance_service_proto_msgTypes[29].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_instance_service_proto_rawDesc), len(file_api_instance_service_proto_rawDesc)),
NumEnums: 5,
NumMessages: 33,
NumMessages: 32,
NumExtensions: 0,
NumServices: 1,
},
-13
View File
@@ -3943,10 +3943,6 @@ components:
allOf:
- $ref: '#/components/schemas/InstanceSetting_StorageSetting'
description: The value of the STORAGE setting.
memoRelatedSetting:
allOf:
- $ref: '#/components/schemas/InstanceSetting_MemoRelatedSetting'
description: The value of the MEMO_RELATED setting.
tagsSetting:
allOf:
- $ref: '#/components/schemas/InstanceSetting_TagsSetting'
@@ -4062,15 +4058,6 @@ components:
type: string
description: Custom JavaScript injected into the web app.
description: GeneralSetting is the general instance configuration.
InstanceSetting_MemoRelatedSetting:
type: object
properties:
reactions:
type: array
items:
type: string
description: The reactions users can choose from. Defaults to a built-in emoji set when empty.
description: MemoRelatedSetting is the memo-related instance configuration.
InstanceSetting_NotificationSetting:
type: object
properties:
+86 -158
View File
@@ -32,8 +32,6 @@ const (
InstanceSettingKey_GENERAL InstanceSettingKey = 2
// STORAGE is the key for storage settings.
InstanceSettingKey_STORAGE InstanceSettingKey = 3
// MEMO_RELATED is the key for memo related settings.
InstanceSettingKey_MEMO_RELATED InstanceSettingKey = 4
// TAGS is the key for tag metadata.
InstanceSettingKey_TAGS InstanceSettingKey = 5
// NOTIFICATION is the key for notification transport settings.
@@ -58,7 +56,6 @@ var (
1: "BASIC",
2: "GENERAL",
3: "STORAGE",
4: "MEMO_RELATED",
5: "TAGS",
6: "NOTIFICATION",
7: "AI",
@@ -71,7 +68,6 @@ var (
"BASIC": 1,
"GENERAL": 2,
"STORAGE": 3,
"MEMO_RELATED": 4,
"TAGS": 5,
"NOTIFICATION": 6,
"AI": 7,
@@ -325,7 +321,6 @@ type InstanceSetting struct {
// *InstanceSetting_BasicSetting
// *InstanceSetting_GeneralSetting
// *InstanceSetting_StorageSetting
// *InstanceSetting_MemoRelatedSetting
// *InstanceSetting_TagsSetting
// *InstanceSetting_NotificationSetting
// *InstanceSetting_AiSetting
@@ -407,15 +402,6 @@ func (x *InstanceSetting) GetStorageSetting() *InstanceStorageSetting {
return nil
}
func (x *InstanceSetting) GetMemoRelatedSetting() *InstanceMemoRelatedSetting {
if x != nil {
if x, ok := x.Value.(*InstanceSetting_MemoRelatedSetting); ok {
return x.MemoRelatedSetting
}
}
return nil
}
func (x *InstanceSetting) GetTagsSetting() *InstanceTagsSetting {
if x != nil {
if x, ok := x.Value.(*InstanceSetting_TagsSetting); ok {
@@ -477,10 +463,6 @@ type InstanceSetting_StorageSetting struct {
StorageSetting *InstanceStorageSetting `protobuf:"bytes,4,opt,name=storage_setting,json=storageSetting,proto3,oneof"`
}
type InstanceSetting_MemoRelatedSetting struct {
MemoRelatedSetting *InstanceMemoRelatedSetting `protobuf:"bytes,5,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"`
}
type InstanceSetting_TagsSetting struct {
TagsSetting *InstanceTagsSetting `protobuf:"bytes,6,opt,name=tags_setting,json=tagsSetting,proto3,oneof"`
}
@@ -507,8 +489,6 @@ func (*InstanceSetting_GeneralSetting) isInstanceSetting_Value() {}
func (*InstanceSetting_StorageSetting) isInstanceSetting_Value() {}
func (*InstanceSetting_MemoRelatedSetting) isInstanceSetting_Value() {}
func (*InstanceSetting_TagsSetting) isInstanceSetting_Value() {}
func (*InstanceSetting_NotificationSetting) isInstanceSetting_Value() {}
@@ -1025,51 +1005,6 @@ func (x *StorageS3Config) GetInsecureSkipTlsVerify() bool {
return false
}
type InstanceMemoRelatedSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
// reactions is the list of reactions.
Reactions []string `protobuf:"bytes,1,rep,name=reactions,proto3" json:"reactions,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *InstanceMemoRelatedSetting) Reset() {
*x = InstanceMemoRelatedSetting{}
mi := &file_store_instance_setting_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *InstanceMemoRelatedSetting) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InstanceMemoRelatedSetting) ProtoMessage() {}
func (x *InstanceMemoRelatedSetting) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use InstanceMemoRelatedSetting.ProtoReflect.Descriptor instead.
func (*InstanceMemoRelatedSetting) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{7}
}
func (x *InstanceMemoRelatedSetting) GetReactions() []string {
if x != nil {
return x.Reactions
}
return nil
}
type InstanceTagMetadata struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Optional background color for the tag label.
@@ -1083,7 +1018,7 @@ type InstanceTagMetadata struct {
func (x *InstanceTagMetadata) Reset() {
*x = InstanceTagMetadata{}
mi := &file_store_instance_setting_proto_msgTypes[8]
mi := &file_store_instance_setting_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1095,7 +1030,7 @@ func (x *InstanceTagMetadata) String() string {
func (*InstanceTagMetadata) ProtoMessage() {}
func (x *InstanceTagMetadata) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[8]
mi := &file_store_instance_setting_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1108,7 +1043,7 @@ func (x *InstanceTagMetadata) ProtoReflect() protoreflect.Message {
// Deprecated: Use InstanceTagMetadata.ProtoReflect.Descriptor instead.
func (*InstanceTagMetadata) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{8}
return file_store_instance_setting_proto_rawDescGZIP(), []int{7}
}
func (x *InstanceTagMetadata) GetBackgroundColor() *color.Color {
@@ -1140,7 +1075,7 @@ type InstanceTagsSetting struct {
func (x *InstanceTagsSetting) Reset() {
*x = InstanceTagsSetting{}
mi := &file_store_instance_setting_proto_msgTypes[9]
mi := &file_store_instance_setting_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1152,7 +1087,7 @@ func (x *InstanceTagsSetting) String() string {
func (*InstanceTagsSetting) ProtoMessage() {}
func (x *InstanceTagsSetting) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[9]
mi := &file_store_instance_setting_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1165,7 +1100,7 @@ func (x *InstanceTagsSetting) ProtoReflect() protoreflect.Message {
// Deprecated: Use InstanceTagsSetting.ProtoReflect.Descriptor instead.
func (*InstanceTagsSetting) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{9}
return file_store_instance_setting_proto_rawDescGZIP(), []int{8}
}
func (x *InstanceTagsSetting) GetTags() map[string]*InstanceTagMetadata {
@@ -1184,7 +1119,7 @@ type InstanceNotificationSetting struct {
func (x *InstanceNotificationSetting) Reset() {
*x = InstanceNotificationSetting{}
mi := &file_store_instance_setting_proto_msgTypes[10]
mi := &file_store_instance_setting_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1196,7 +1131,7 @@ func (x *InstanceNotificationSetting) String() string {
func (*InstanceNotificationSetting) ProtoMessage() {}
func (x *InstanceNotificationSetting) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[10]
mi := &file_store_instance_setting_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1209,7 +1144,7 @@ func (x *InstanceNotificationSetting) ProtoReflect() protoreflect.Message {
// Deprecated: Use InstanceNotificationSetting.ProtoReflect.Descriptor instead.
func (*InstanceNotificationSetting) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{10}
return file_store_instance_setting_proto_rawDescGZIP(), []int{9}
}
func (x *InstanceNotificationSetting) GetEmail() *InstanceNotificationSetting_EmailSetting {
@@ -1232,7 +1167,7 @@ type InstanceAISetting struct {
func (x *InstanceAISetting) Reset() {
*x = InstanceAISetting{}
mi := &file_store_instance_setting_proto_msgTypes[11]
mi := &file_store_instance_setting_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1244,7 +1179,7 @@ func (x *InstanceAISetting) String() string {
func (*InstanceAISetting) ProtoMessage() {}
func (x *InstanceAISetting) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[11]
mi := &file_store_instance_setting_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1257,7 +1192,7 @@ func (x *InstanceAISetting) ProtoReflect() protoreflect.Message {
// Deprecated: Use InstanceAISetting.ProtoReflect.Descriptor instead.
func (*InstanceAISetting) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{11}
return file_store_instance_setting_proto_rawDescGZIP(), []int{10}
}
func (x *InstanceAISetting) GetProviders() []*AIProviderConfig {
@@ -1288,7 +1223,7 @@ type AIProviderConfig struct {
func (x *AIProviderConfig) Reset() {
*x = AIProviderConfig{}
mi := &file_store_instance_setting_proto_msgTypes[12]
mi := &file_store_instance_setting_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1300,7 +1235,7 @@ func (x *AIProviderConfig) String() string {
func (*AIProviderConfig) ProtoMessage() {}
func (x *AIProviderConfig) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[12]
mi := &file_store_instance_setting_proto_msgTypes[11]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1313,7 +1248,7 @@ func (x *AIProviderConfig) ProtoReflect() protoreflect.Message {
// Deprecated: Use AIProviderConfig.ProtoReflect.Descriptor instead.
func (*AIProviderConfig) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{12}
return file_store_instance_setting_proto_rawDescGZIP(), []int{11}
}
func (x *AIProviderConfig) GetId() string {
@@ -1382,7 +1317,7 @@ type TranscriptionConfig struct {
func (x *TranscriptionConfig) Reset() {
*x = TranscriptionConfig{}
mi := &file_store_instance_setting_proto_msgTypes[13]
mi := &file_store_instance_setting_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1394,7 +1329,7 @@ func (x *TranscriptionConfig) String() string {
func (*TranscriptionConfig) ProtoMessage() {}
func (x *TranscriptionConfig) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[13]
mi := &file_store_instance_setting_proto_msgTypes[12]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1407,7 +1342,7 @@ func (x *TranscriptionConfig) ProtoReflect() protoreflect.Message {
// Deprecated: Use TranscriptionConfig.ProtoReflect.Descriptor instead.
func (*TranscriptionConfig) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{13}
return file_store_instance_setting_proto_rawDescGZIP(), []int{12}
}
func (x *TranscriptionConfig) GetProviderId() string {
@@ -1447,7 +1382,7 @@ type InstanceAccessSetting struct {
func (x *InstanceAccessSetting) Reset() {
*x = InstanceAccessSetting{}
mi := &file_store_instance_setting_proto_msgTypes[14]
mi := &file_store_instance_setting_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1459,7 +1394,7 @@ func (x *InstanceAccessSetting) String() string {
func (*InstanceAccessSetting) ProtoMessage() {}
func (x *InstanceAccessSetting) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[14]
mi := &file_store_instance_setting_proto_msgTypes[13]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1472,7 +1407,7 @@ func (x *InstanceAccessSetting) ProtoReflect() protoreflect.Message {
// Deprecated: Use InstanceAccessSetting.ProtoReflect.Descriptor instead.
func (*InstanceAccessSetting) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{14}
return file_store_instance_setting_proto_rawDescGZIP(), []int{13}
}
func (x *InstanceAccessSetting) GetAccessMode() InstanceAccessMode {
@@ -1494,7 +1429,7 @@ type InstanceUsageLimitsSetting struct {
func (x *InstanceUsageLimitsSetting) Reset() {
*x = InstanceUsageLimitsSetting{}
mi := &file_store_instance_setting_proto_msgTypes[15]
mi := &file_store_instance_setting_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1506,7 +1441,7 @@ func (x *InstanceUsageLimitsSetting) String() string {
func (*InstanceUsageLimitsSetting) ProtoMessage() {}
func (x *InstanceUsageLimitsSetting) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[15]
mi := &file_store_instance_setting_proto_msgTypes[14]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1519,7 +1454,7 @@ func (x *InstanceUsageLimitsSetting) ProtoReflect() protoreflect.Message {
// Deprecated: Use InstanceUsageLimitsSetting.ProtoReflect.Descriptor instead.
func (*InstanceUsageLimitsSetting) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{15}
return file_store_instance_setting_proto_rawDescGZIP(), []int{14}
}
func (x *InstanceUsageLimitsSetting) GetLimits() []*InstanceUsageLimitsSetting_UsageLimit {
@@ -1553,7 +1488,7 @@ type InstanceConfigurationState struct {
func (x *InstanceConfigurationState) Reset() {
*x = InstanceConfigurationState{}
mi := &file_store_instance_setting_proto_msgTypes[16]
mi := &file_store_instance_setting_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1565,7 +1500,7 @@ func (x *InstanceConfigurationState) String() string {
func (*InstanceConfigurationState) ProtoMessage() {}
func (x *InstanceConfigurationState) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[16]
mi := &file_store_instance_setting_proto_msgTypes[15]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1578,7 +1513,7 @@ func (x *InstanceConfigurationState) ProtoReflect() protoreflect.Message {
// Deprecated: Use InstanceConfigurationState.ProtoReflect.Descriptor instead.
func (*InstanceConfigurationState) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{16}
return file_store_instance_setting_proto_rawDescGZIP(), []int{15}
}
func (x *InstanceConfigurationState) GetSerial() int64 {
@@ -1641,7 +1576,7 @@ type InstanceNotificationSetting_EmailSetting struct {
func (x *InstanceNotificationSetting_EmailSetting) Reset() {
*x = InstanceNotificationSetting_EmailSetting{}
mi := &file_store_instance_setting_proto_msgTypes[18]
mi := &file_store_instance_setting_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1653,7 +1588,7 @@ func (x *InstanceNotificationSetting_EmailSetting) String() string {
func (*InstanceNotificationSetting_EmailSetting) ProtoMessage() {}
func (x *InstanceNotificationSetting_EmailSetting) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[18]
mi := &file_store_instance_setting_proto_msgTypes[17]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1666,7 +1601,7 @@ func (x *InstanceNotificationSetting_EmailSetting) ProtoReflect() protoreflect.M
// Deprecated: Use InstanceNotificationSetting_EmailSetting.ProtoReflect.Descriptor instead.
func (*InstanceNotificationSetting_EmailSetting) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{10, 0}
return file_store_instance_setting_proto_rawDescGZIP(), []int{9, 0}
}
func (x *InstanceNotificationSetting_EmailSetting) GetEnabled() bool {
@@ -1762,7 +1697,7 @@ type InstanceUsageLimitsSetting_UsageLimit struct {
func (x *InstanceUsageLimitsSetting_UsageLimit) Reset() {
*x = InstanceUsageLimitsSetting_UsageLimit{}
mi := &file_store_instance_setting_proto_msgTypes[19]
mi := &file_store_instance_setting_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1774,7 +1709,7 @@ func (x *InstanceUsageLimitsSetting_UsageLimit) String() string {
func (*InstanceUsageLimitsSetting_UsageLimit) ProtoMessage() {}
func (x *InstanceUsageLimitsSetting_UsageLimit) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[19]
mi := &file_store_instance_setting_proto_msgTypes[18]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1787,7 +1722,7 @@ func (x *InstanceUsageLimitsSetting_UsageLimit) ProtoReflect() protoreflect.Mess
// Deprecated: Use InstanceUsageLimitsSetting_UsageLimit.ProtoReflect.Descriptor instead.
func (*InstanceUsageLimitsSetting_UsageLimit) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{15, 0}
return file_store_instance_setting_proto_rawDescGZIP(), []int{14, 0}
}
func (x *InstanceUsageLimitsSetting_UsageLimit) GetUserIds() []int32 {
@@ -1867,7 +1802,7 @@ type InstanceConfigurationState_ManagedResource struct {
func (x *InstanceConfigurationState_ManagedResource) Reset() {
*x = InstanceConfigurationState_ManagedResource{}
mi := &file_store_instance_setting_proto_msgTypes[20]
mi := &file_store_instance_setting_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1879,7 +1814,7 @@ func (x *InstanceConfigurationState_ManagedResource) String() string {
func (*InstanceConfigurationState_ManagedResource) ProtoMessage() {}
func (x *InstanceConfigurationState_ManagedResource) ProtoReflect() protoreflect.Message {
mi := &file_store_instance_setting_proto_msgTypes[20]
mi := &file_store_instance_setting_proto_msgTypes[19]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1892,7 +1827,7 @@ func (x *InstanceConfigurationState_ManagedResource) ProtoReflect() protoreflect
// Deprecated: Use InstanceConfigurationState_ManagedResource.ProtoReflect.Descriptor instead.
func (*InstanceConfigurationState_ManagedResource) Descriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{16, 0}
return file_store_instance_setting_proto_rawDescGZIP(), []int{15, 0}
}
func (x *InstanceConfigurationState_ManagedResource) GetName() string {
@@ -1969,13 +1904,12 @@ var File_store_instance_setting_proto protoreflect.FileDescriptor
const file_store_instance_setting_proto_rawDesc = "" +
"\n" +
"\x1cstore/instance_setting.proto\x12\vmemos.store\x1a\x17google/type/color.proto\"\xa5\x06\n" +
"\x1cstore/instance_setting.proto\x12\vmemos.store\x1a\x17google/type/color.proto\"\xe4\x05\n" +
"\x0fInstanceSetting\x121\n" +
"\x03key\x18\x01 \x01(\x0e2\x1f.memos.store.InstanceSettingKeyR\x03key\x12H\n" +
"\rbasic_setting\x18\x02 \x01(\v2!.memos.store.InstanceBasicSettingH\x00R\fbasicSetting\x12N\n" +
"\x0fgeneral_setting\x18\x03 \x01(\v2#.memos.store.InstanceGeneralSettingH\x00R\x0egeneralSetting\x12N\n" +
"\x0fstorage_setting\x18\x04 \x01(\v2#.memos.store.InstanceStorageSettingH\x00R\x0estorageSetting\x12[\n" +
"\x14memo_related_setting\x18\x05 \x01(\v2'.memos.store.InstanceMemoRelatedSettingH\x00R\x12memoRelatedSetting\x12E\n" +
"\x0fstorage_setting\x18\x04 \x01(\v2#.memos.store.InstanceStorageSettingH\x00R\x0estorageSetting\x12E\n" +
"\ftags_setting\x18\x06 \x01(\v2 .memos.store.InstanceTagsSettingH\x00R\vtagsSetting\x12]\n" +
"\x14notification_setting\x18\a \x01(\v2(.memos.store.InstanceNotificationSettingH\x00R\x13notificationSetting\x12?\n" +
"\n" +
@@ -1983,7 +1917,7 @@ const file_store_instance_setting_proto_rawDesc = "" +
"\x0eaccess_setting\x18\t \x01(\v2\".memos.store.InstanceAccessSettingH\x00R\raccessSetting\x12[\n" +
"\x14usage_limits_setting\x18\n" +
" \x01(\v2'.memos.store.InstanceUsageLimitsSettingH\x00R\x12usageLimitsSettingB\a\n" +
"\x05value\"\x85\x01\n" +
"\x05valueJ\x04\b\x05\x10\x06R\x14memo_related_setting\"\x85\x01\n" +
"\x14InstanceBasicSetting\x12\x1d\n" +
"\n" +
"secret_key\x18\x01 \x01(\tR\tsecretKey\x12%\n" +
@@ -2026,9 +1960,7 @@ const file_store_instance_setting_proto_rawDesc = "" +
"\x06region\x18\x04 \x01(\tR\x06region\x12\x16\n" +
"\x06bucket\x18\x05 \x01(\tR\x06bucket\x12$\n" +
"\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\x127\n" +
"\x18insecure_skip_tls_verify\x18\a \x01(\bR\x15insecureSkipTlsVerify\":\n" +
"\x1aInstanceMemoRelatedSetting\x12\x1c\n" +
"\treactions\x18\x01 \x03(\tR\treactions\"w\n" +
"\x18insecure_skip_tls_verify\x18\a \x01(\bR\x15insecureSkipTlsVerify\"w\n" +
"\x13InstanceTagMetadata\x12=\n" +
"\x10background_color\x18\x01 \x01(\v2\x12.google.type.ColorR\x0fbackgroundColor\x12!\n" +
"\fblur_content\x18\x02 \x01(\bR\vblurContent\"\xb0\x01\n" +
@@ -2108,13 +2040,12 @@ const file_store_instance_setting_proto_rawDesc = "" +
"\n" +
"references\x18\n" +
" \x03(\tR\n" +
"references*\xcc\x01\n" +
"references*\xce\x01\n" +
"\x12InstanceSettingKey\x12$\n" +
" INSTANCE_SETTING_KEY_UNSPECIFIED\x10\x00\x12\t\n" +
"\x05BASIC\x10\x01\x12\v\n" +
"\aGENERAL\x10\x02\x12\v\n" +
"\aSTORAGE\x10\x03\x12\x10\n" +
"\fMEMO_RELATED\x10\x04\x12\b\n" +
"\aSTORAGE\x10\x03\x12\b\n" +
"\x04TAGS\x10\x05\x12\x10\n" +
"\fNOTIFICATION\x10\x06\x12\x06\n" +
"\x02AI\x10\a\x12\n" +
@@ -2122,7 +2053,7 @@ const file_store_instance_setting_proto_rawDesc = "" +
"\x06ACCESS\x10\b\x12\x10\n" +
"\fUSAGE_LIMITS\x10\t\x12\x17\n" +
"\x13CONFIGURATION_STATE\x10\n" +
"*s\n" +
"\"\x04\b\x04\x10\x04*\fMEMO_RELATED*s\n" +
"\vStorageType\x12\x1c\n" +
"\x18STORAGE_TYPE_UNSPECIFIED\x10\x00\x12\x19\n" +
"\x15STORAGE_TYPE_DATABASE\x10\x01\x12\x16\n" +
@@ -2153,7 +2084,7 @@ func file_store_instance_setting_proto_rawDescGZIP() []byte {
}
var file_store_instance_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
var file_store_instance_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 21)
var file_store_instance_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 20)
var file_store_instance_setting_proto_goTypes = []any{
(InstanceSettingKey)(0), // 0: memos.store.InstanceSettingKey
(StorageType)(0), // 1: memos.store.StorageType
@@ -2167,54 +2098,52 @@ var file_store_instance_setting_proto_goTypes = []any{
(*Storage)(nil), // 9: memos.store.Storage
(*InstanceStorageSetting)(nil), // 10: memos.store.InstanceStorageSetting
(*StorageS3Config)(nil), // 11: memos.store.StorageS3Config
(*InstanceMemoRelatedSetting)(nil), // 12: memos.store.InstanceMemoRelatedSetting
(*InstanceTagMetadata)(nil), // 13: memos.store.InstanceTagMetadata
(*InstanceTagsSetting)(nil), // 14: memos.store.InstanceTagsSetting
(*InstanceNotificationSetting)(nil), // 15: memos.store.InstanceNotificationSetting
(*InstanceAISetting)(nil), // 16: memos.store.InstanceAISetting
(*AIProviderConfig)(nil), // 17: memos.store.AIProviderConfig
(*TranscriptionConfig)(nil), // 18: memos.store.TranscriptionConfig
(*InstanceAccessSetting)(nil), // 19: memos.store.InstanceAccessSetting
(*InstanceUsageLimitsSetting)(nil), // 20: memos.store.InstanceUsageLimitsSetting
(*InstanceConfigurationState)(nil), // 21: memos.store.InstanceConfigurationState
nil, // 22: memos.store.InstanceTagsSetting.TagsEntry
(*InstanceNotificationSetting_EmailSetting)(nil), // 23: memos.store.InstanceNotificationSetting.EmailSetting
(*InstanceUsageLimitsSetting_UsageLimit)(nil), // 24: memos.store.InstanceUsageLimitsSetting.UsageLimit
(*InstanceConfigurationState_ManagedResource)(nil), // 25: memos.store.InstanceConfigurationState.ManagedResource
(*color.Color)(nil), // 26: google.type.Color
(*InstanceTagMetadata)(nil), // 12: memos.store.InstanceTagMetadata
(*InstanceTagsSetting)(nil), // 13: memos.store.InstanceTagsSetting
(*InstanceNotificationSetting)(nil), // 14: memos.store.InstanceNotificationSetting
(*InstanceAISetting)(nil), // 15: memos.store.InstanceAISetting
(*AIProviderConfig)(nil), // 16: memos.store.AIProviderConfig
(*TranscriptionConfig)(nil), // 17: memos.store.TranscriptionConfig
(*InstanceAccessSetting)(nil), // 18: memos.store.InstanceAccessSetting
(*InstanceUsageLimitsSetting)(nil), // 19: memos.store.InstanceUsageLimitsSetting
(*InstanceConfigurationState)(nil), // 20: memos.store.InstanceConfigurationState
nil, // 21: memos.store.InstanceTagsSetting.TagsEntry
(*InstanceNotificationSetting_EmailSetting)(nil), // 22: memos.store.InstanceNotificationSetting.EmailSetting
(*InstanceUsageLimitsSetting_UsageLimit)(nil), // 23: memos.store.InstanceUsageLimitsSetting.UsageLimit
(*InstanceConfigurationState_ManagedResource)(nil), // 24: memos.store.InstanceConfigurationState.ManagedResource
(*color.Color)(nil), // 25: google.type.Color
}
var file_store_instance_setting_proto_depIdxs = []int32{
0, // 0: memos.store.InstanceSetting.key:type_name -> memos.store.InstanceSettingKey
6, // 1: memos.store.InstanceSetting.basic_setting:type_name -> memos.store.InstanceBasicSetting
7, // 2: memos.store.InstanceSetting.general_setting:type_name -> memos.store.InstanceGeneralSetting
10, // 3: memos.store.InstanceSetting.storage_setting:type_name -> memos.store.InstanceStorageSetting
12, // 4: memos.store.InstanceSetting.memo_related_setting:type_name -> memos.store.InstanceMemoRelatedSetting
14, // 5: memos.store.InstanceSetting.tags_setting:type_name -> memos.store.InstanceTagsSetting
15, // 6: memos.store.InstanceSetting.notification_setting:type_name -> memos.store.InstanceNotificationSetting
16, // 7: memos.store.InstanceSetting.ai_setting:type_name -> memos.store.InstanceAISetting
19, // 8: memos.store.InstanceSetting.access_setting:type_name -> memos.store.InstanceAccessSetting
20, // 9: memos.store.InstanceSetting.usage_limits_setting:type_name -> memos.store.InstanceUsageLimitsSetting
8, // 10: memos.store.InstanceGeneralSetting.custom_profile:type_name -> memos.store.InstanceCustomProfile
1, // 11: memos.store.Storage.type:type_name -> memos.store.StorageType
11, // 12: memos.store.Storage.s3_config:type_name -> memos.store.StorageS3Config
4, // 13: memos.store.InstanceStorageSetting.storage_type:type_name -> memos.store.InstanceStorageSetting.StorageType
11, // 14: memos.store.InstanceStorageSetting.s3_config:type_name -> memos.store.StorageS3Config
9, // 15: memos.store.InstanceStorageSetting.storages:type_name -> memos.store.Storage
26, // 16: memos.store.InstanceTagMetadata.background_color:type_name -> google.type.Color
22, // 17: memos.store.InstanceTagsSetting.tags:type_name -> memos.store.InstanceTagsSetting.TagsEntry
23, // 18: memos.store.InstanceNotificationSetting.email:type_name -> memos.store.InstanceNotificationSetting.EmailSetting
17, // 19: memos.store.InstanceAISetting.providers:type_name -> memos.store.AIProviderConfig
18, // 20: memos.store.InstanceAISetting.transcription:type_name -> memos.store.TranscriptionConfig
2, // 21: memos.store.AIProviderConfig.type:type_name -> memos.store.AIProviderType
3, // 22: memos.store.InstanceAccessSetting.access_mode:type_name -> memos.store.InstanceAccessMode
24, // 23: memos.store.InstanceUsageLimitsSetting.limits:type_name -> memos.store.InstanceUsageLimitsSetting.UsageLimit
25, // 24: memos.store.InstanceConfigurationState.resources:type_name -> memos.store.InstanceConfigurationState.ManagedResource
13, // 25: memos.store.InstanceTagsSetting.TagsEntry.value:type_name -> memos.store.InstanceTagMetadata
26, // [26:26] is the sub-list for method output_type
26, // [26:26] is the sub-list for method input_type
26, // [26:26] is the sub-list for extension type_name
26, // [26:26] is the sub-list for extension extendee
0, // [0:26] is the sub-list for field type_name
13, // 4: memos.store.InstanceSetting.tags_setting:type_name -> memos.store.InstanceTagsSetting
14, // 5: memos.store.InstanceSetting.notification_setting:type_name -> memos.store.InstanceNotificationSetting
15, // 6: memos.store.InstanceSetting.ai_setting:type_name -> memos.store.InstanceAISetting
18, // 7: memos.store.InstanceSetting.access_setting:type_name -> memos.store.InstanceAccessSetting
19, // 8: memos.store.InstanceSetting.usage_limits_setting:type_name -> memos.store.InstanceUsageLimitsSetting
8, // 9: memos.store.InstanceGeneralSetting.custom_profile:type_name -> memos.store.InstanceCustomProfile
1, // 10: memos.store.Storage.type:type_name -> memos.store.StorageType
11, // 11: memos.store.Storage.s3_config:type_name -> memos.store.StorageS3Config
4, // 12: memos.store.InstanceStorageSetting.storage_type:type_name -> memos.store.InstanceStorageSetting.StorageType
11, // 13: memos.store.InstanceStorageSetting.s3_config:type_name -> memos.store.StorageS3Config
9, // 14: memos.store.InstanceStorageSetting.storages:type_name -> memos.store.Storage
25, // 15: memos.store.InstanceTagMetadata.background_color:type_name -> google.type.Color
21, // 16: memos.store.InstanceTagsSetting.tags:type_name -> memos.store.InstanceTagsSetting.TagsEntry
22, // 17: memos.store.InstanceNotificationSetting.email:type_name -> memos.store.InstanceNotificationSetting.EmailSetting
16, // 18: memos.store.InstanceAISetting.providers:type_name -> memos.store.AIProviderConfig
17, // 19: memos.store.InstanceAISetting.transcription:type_name -> memos.store.TranscriptionConfig
2, // 20: memos.store.AIProviderConfig.type:type_name -> memos.store.AIProviderType
3, // 21: memos.store.InstanceAccessSetting.access_mode:type_name -> memos.store.InstanceAccessMode
23, // 22: memos.store.InstanceUsageLimitsSetting.limits:type_name -> memos.store.InstanceUsageLimitsSetting.UsageLimit
24, // 23: memos.store.InstanceConfigurationState.resources:type_name -> memos.store.InstanceConfigurationState.ManagedResource
12, // 24: memos.store.InstanceTagsSetting.TagsEntry.value:type_name -> memos.store.InstanceTagMetadata
25, // [25:25] is the sub-list for method output_type
25, // [25:25] is the sub-list for method input_type
25, // [25:25] is the sub-list for extension type_name
25, // [25:25] is the sub-list for extension extendee
0, // [0:25] is the sub-list for field type_name
}
func init() { file_store_instance_setting_proto_init() }
@@ -2226,7 +2155,6 @@ func file_store_instance_setting_proto_init() {
(*InstanceSetting_BasicSetting)(nil),
(*InstanceSetting_GeneralSetting)(nil),
(*InstanceSetting_StorageSetting)(nil),
(*InstanceSetting_MemoRelatedSetting)(nil),
(*InstanceSetting_TagsSetting)(nil),
(*InstanceSetting_NotificationSetting)(nil),
(*InstanceSetting_AiSetting)(nil),
@@ -2236,14 +2164,14 @@ func file_store_instance_setting_proto_init() {
file_store_instance_setting_proto_msgTypes[4].OneofWrappers = []any{
(*Storage_S3Config)(nil),
}
file_store_instance_setting_proto_msgTypes[19].OneofWrappers = []any{}
file_store_instance_setting_proto_msgTypes[18].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_instance_setting_proto_rawDesc), len(file_store_instance_setting_proto_rawDesc)),
NumEnums: 5,
NumMessages: 21,
NumMessages: 20,
NumExtensions: 0,
NumServices: 0,
},
+4 -8
View File
@@ -14,8 +14,8 @@ enum InstanceSettingKey {
GENERAL = 2;
// STORAGE is the key for storage settings.
STORAGE = 3;
// MEMO_RELATED is the key for memo related settings.
MEMO_RELATED = 4;
reserved 4;
reserved "MEMO_RELATED";
// TAGS is the key for tag metadata.
TAGS = 5;
// NOTIFICATION is the key for notification transport settings.
@@ -34,12 +34,13 @@ enum InstanceSettingKey {
}
message InstanceSetting {
reserved 5;
reserved "memo_related_setting";
InstanceSettingKey key = 1;
oneof value {
InstanceBasicSetting basic_setting = 2;
InstanceGeneralSetting general_setting = 3;
InstanceStorageSetting storage_setting = 4;
InstanceMemoRelatedSetting memo_related_setting = 5;
InstanceTagsSetting tags_setting = 6;
InstanceNotificationSetting notification_setting = 7;
InstanceAISetting ai_setting = 8;
@@ -147,11 +148,6 @@ message StorageS3Config {
bool insecure_skip_tls_verify = 7;
}
message InstanceMemoRelatedSetting {
// reactions is the list of reactions.
repeated string reactions = 1;
}
message InstanceTagMetadata {
// Optional background color for the tag label.
// When unset, the default tag color is used.
-4
View File
@@ -118,10 +118,6 @@ func (s *APIService) getInstanceSettingByName(ctx context.Context, name string,
var setting *storepb.InstanceGeneralSetting
setting, err = s.Store.GetInstanceGeneralSetting(ctx)
instanceSetting = &storepb.InstanceSetting{Key: instanceSettingKey, Value: &storepb.InstanceSetting_GeneralSetting{GeneralSetting: setting}}
case storepb.InstanceSettingKey_MEMO_RELATED:
var setting *storepb.InstanceMemoRelatedSetting
setting, err = s.Store.GetInstanceMemoRelatedSetting(ctx)
instanceSetting = &storepb.InstanceSetting{Key: instanceSettingKey, Value: &storepb.InstanceSetting_MemoRelatedSetting{MemoRelatedSetting: setting}}
case storepb.InstanceSettingKey_STORAGE:
var setting *storepb.InstanceStorageSetting
setting, err = s.Store.GetInstanceStorageSetting(ctx)
@@ -109,8 +109,8 @@ func TestConfigurationGuard(t *testing.T) {
// Unmanaged resources are not guarded.
_, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{InstanceSetting: &apipb.InstanceSetting{
Name: "instance/settings/MEMO_RELATED",
Value: &apipb.InstanceSetting_MemoRelatedSetting_{MemoRelatedSetting: &apipb.InstanceSetting_MemoRelatedSetting{Reactions: []string{"👍"}}},
Name: "instance/settings/NOTIFICATION",
Value: &apipb.InstanceSetting_NotificationSetting_{NotificationSetting: &apipb.InstanceSetting_NotificationSetting{}},
}})
require.NoError(t, err)
}
+7 -16
View File
@@ -225,25 +225,16 @@ func TestGetInstanceSetting(t *testing.T) {
require.NotNil(t, storageSetting)
})
t.Run("GetInstanceSetting - memo related setting", func(t *testing.T) {
t.Run("GetInstanceSetting - retired reaction setting", func(t *testing.T) {
// Create test service for this specific test
ts := NewTestService(t)
defer ts.Cleanup()
// Call GetInstanceSetting for memo related setting
req := &apipb.GetInstanceSettingRequest{
_, err := ts.Service.GetInstanceSetting(ctx, &apipb.GetInstanceSettingRequest{
Name: "instance/settings/MEMO_RELATED",
}
resp, err := ts.Service.GetInstanceSetting(ctx, req)
})
require.Error(t, err)
// Verify response
require.NoError(t, err)
require.NotNil(t, resp)
require.Equal(t, "instance/settings/MEMO_RELATED", resp.Name)
// The memo related setting should have a memo_related_setting field
memoRelatedSetting := resp.GetMemoRelatedSetting()
require.NotNil(t, memoRelatedSetting)
})
t.Run("GetInstanceSetting - tags setting", func(t *testing.T) {
@@ -366,7 +357,7 @@ func TestBatchGetInstanceSettings(t *testing.T) {
Names: []string{
"instance/settings/TAGS",
"instance/settings/GENERAL",
"instance/settings/MEMO_RELATED",
"instance/settings/ACCESS",
},
})
@@ -377,8 +368,8 @@ func TestBatchGetInstanceSettings(t *testing.T) {
require.NotNil(t, resp.InstanceSettings[0].GetTagsSetting())
require.Equal(t, "instance/settings/GENERAL", resp.InstanceSettings[1].Name)
require.NotNil(t, resp.InstanceSettings[1].GetGeneralSetting())
require.Equal(t, "instance/settings/MEMO_RELATED", resp.InstanceSettings[2].Name)
require.NotNil(t, resp.InstanceSettings[2].GetMemoRelatedSetting())
require.Equal(t, "instance/settings/ACCESS", resp.InstanceSettings[2].Name)
require.NotNil(t, resp.InstanceSettings[2].GetAccessSetting())
})
t.Run("BatchGetInstanceSettings - admin-only setting requires admin", func(t *testing.T) {
+10 -15
View File
@@ -26,32 +26,27 @@ func (d *DB) UpsertReaction(ctx context.Context, upsert *store.Reaction) (*store
}
}
result, err := tx.ExecContext(ctx, `
_, err = tx.ExecContext(ctx, `
INSERT INTO reaction (creator_id, memo_id, reaction_type)
SELECT ?, memo.id, ?
FROM memo
WHERE memo.id = ?
LOCK IN SHARE MODE
ON DUPLICATE KEY UPDATE id = reaction.id
`, upsert.CreatorID, upsert.ReactionType, upsert.MemoID)
if err != nil {
return nil, err
}
rowsAffected, err := result.RowsAffected()
if err != nil {
return nil, err
}
if rowsAffected == 0 {
return nil, errors.Wrap(store.ErrReactionMemoNotFound, "failed to create reaction")
if err := tx.QueryRowContext(ctx, `
SELECT id, UNIX_TIMESTAMP(created_ts) FROM reaction
WHERE creator_id = ? AND memo_id = ? AND reaction_type = ?
`, upsert.CreatorID, upsert.MemoID, upsert.ReactionType).Scan(&upsert.ID, &upsert.CreatedTs); err != nil {
if errors.Is(err, sql.ErrNoRows) {
return nil, errors.Wrap(store.ErrReactionMemoNotFound, "failed to create reaction")
}
return nil, errors.Wrap(err, "failed to read reaction")
}
rawID, err := result.LastInsertId()
if err != nil {
return nil, err
}
upsert.ID = int32(rawID)
if err := tx.QueryRowContext(ctx, "SELECT UNIX_TIMESTAMP(created_ts) FROM reaction WHERE id = ?", upsert.ID).Scan(&upsert.CreatedTs); err != nil {
return nil, errors.Wrap(err, "failed to read created reaction")
}
if err := tx.Commit(); err != nil {
return nil, errors.Wrap(err, "failed to commit reaction upsert transaction")
}
+1
View File
@@ -43,6 +43,7 @@ func upsertPostgresReaction(ctx context.Context, querier postgresReactionUpsertQ
FROM memo
WHERE memo.id = $3
FOR KEY SHARE OF memo
ON CONFLICT (creator_id, memo_id, reaction_type) DO UPDATE SET reaction_type = EXCLUDED.reaction_type
RETURNING id, created_ts
`, upsert.CreatorID, upsert.ReactionType, upsert.MemoID).Scan(
&upsert.ID,
+1
View File
@@ -42,6 +42,7 @@ func upsertSQLiteReaction(ctx context.Context, querier sqliteReactionUpsertQueri
SELECT ?, memo.id, ?
FROM memo
WHERE memo.id = ?
ON CONFLICT (creator_id, memo_id, reaction_type) DO UPDATE SET reaction_type = excluded.reaction_type
RETURNING id, created_ts
`, upsert.CreatorID, upsert.ReactionType, upsert.MemoID).Scan(
&upsert.ID,
+38 -3
View File
@@ -8,8 +8,10 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/crypto/bcrypt"
"google.golang.org/protobuf/proto"
"github.com/usememos/memos/internal/profile"
"github.com/usememos/memos/markdown"
"github.com/usememos/memos/store"
"github.com/usememos/memos/store/db/sqlite"
)
@@ -63,7 +65,12 @@ func TestDemoSeed(t *testing.T) {
require.GreaterOrEqual(t, len(memos), 20)
var hasPublic, hasProtected, hasLocation, hasNestedTag, hasMention bool
markdownService := markdown.NewService(markdown.WithTagExtension(), markdown.WithMentionExtension())
for _, memo := range memos {
derived, err := markdownService.ExtractAll([]byte(memo.Content))
require.NoError(t, err)
require.ElementsMatch(t, derived.Tags, memo.Payload.GetTags(), "seed tags match %s", memo.UID)
require.True(t, proto.Equal(derived.Property, memo.Payload.GetProperty()), "seed properties match %s", memo.UID)
hasPublic = hasPublic || memo.Visibility == store.Public
hasProtected = hasProtected || memo.Visibility == store.Protected
hasLocation = hasLocation || memo.Payload.GetLocation() != nil
@@ -77,6 +84,9 @@ func TestDemoSeed(t *testing.T) {
require.True(t, hasLocation, "demo should include location metadata")
require.True(t, hasNestedTag, "demo should include nested tags")
require.True(t, hasMention, "demo should include a mention")
rootMemos, err := stores.ListMemos(ctx, &store.FindMemo{ExcludeComments: true})
require.NoError(t, err)
require.Equal(t, "welcome0000001", rootMemos[0].UID, "Explore opens with the welcome memo")
relations, err := stores.ListMemoRelations(ctx, &store.FindMemoRelation{})
require.NoError(t, err)
@@ -91,22 +101,47 @@ func TestDemoSeed(t *testing.T) {
reactions, err := stores.ListReactions(ctx, &store.FindReaction{})
require.NoError(t, err)
require.NotEmpty(t, reactions, "demo should include reactions")
for _, reaction := range reactions {
reaction.Policy = &store.ReactionWritePolicy{ActorUserID: reaction.CreatorID}
_, err := stores.UpsertReaction(ctx, reaction)
require.NoError(t, err, "seed reactor can participate in memo %d", reaction.MemoID)
}
attachments, err := stores.ListAttachments(ctx, &store.FindAttachment{HasRelatedMemo: true})
require.NoError(t, err)
require.NotEmpty(t, attachments, "demo should include a memo attachment")
// The seed holds content only: settings, including the reaction list, come
// The seed holds content only: settings come
// from the demo's declarative configuration, and no account carries a
// seeded credential.
memoRelated, err := stores.GetUncachedInstanceSetting(ctx, &store.FindInstanceSetting{Name: "MEMO_RELATED"})
notification, err := stores.GetUncachedInstanceSetting(ctx, &store.FindInstanceSetting{Name: "NOTIFICATION"})
require.NoError(t, err)
require.Nil(t, memoRelated, "the seed does not set instance settings")
require.Nil(t, notification, "the seed does not set instance settings")
userSettings, err := stores.ListUserSettings(ctx, &store.FindUserSetting{})
require.NoError(t, err)
require.Empty(t, userSettings, "the seed does not set user settings or access tokens")
}
func TestDemoSeedVisitorParticipation(t *testing.T) {
ctx := context.Background()
stores := newDemoStore(t)
require.NoError(t, stores.Seed(ctx))
visitor, err := stores.CreateUser(ctx, &store.User{Username: "demo-visitor", Role: store.RoleUser, PasswordHash: "hash"})
require.NoError(t, err)
for _, uid := range []string{"welcome0000001", "goldenhour0001", "johnnygitcheat1", "protectedintro"} {
memo, err := stores.GetMemo(ctx, &store.FindMemo{UID: &uid})
require.NoError(t, err)
require.NotNil(t, memo)
require.Nil(t, memo.SpaceID, "visitors can participate without sample Space membership")
_, err = stores.UpsertReaction(ctx, &store.Reaction{
CreatorID: visitor.ID, MemoID: memo.ID, ReactionType: "👍",
Policy: &store.ReactionWritePolicy{ActorUserID: visitor.ID},
})
require.NoError(t, err, "new visitors can react to %s", uid)
}
}
// The server seeds after the declarative configuration is applied, so the
// administrator may already exist: the seed keeps that row, fills only the
// profile fields left empty, and attaches its content to it.
+1 -33
View File
@@ -39,8 +39,7 @@ func encodeInstanceSetting(upsert *storepb.InstanceSetting) (*InstanceSetting, e
} else if upsert.Key == storepb.InstanceSettingKey_STORAGE {
NormalizeInstanceStorageSetting(upsert.GetStorageSetting())
valueBytes, err = protojson.Marshal(upsert.GetStorageSetting())
} else if upsert.Key == storepb.InstanceSettingKey_MEMO_RELATED {
valueBytes, err = protojson.Marshal(upsert.GetMemoRelatedSetting())
} else if upsert.Key == storepb.InstanceSettingKey_TAGS {
valueBytes, err = protojson.Marshal(upsert.GetTagsSetting())
} else if upsert.Key == storepb.InstanceSettingKey_NOTIFICATION {
@@ -229,31 +228,6 @@ func (s *Store) AllowsAnonymousAccess(ctx context.Context) (bool, error) {
return setting.AccessMode == storepb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC, nil
}
// DefaultReactions is the default reactions for memo related setting.
var DefaultReactions = []string{"👍", "👎", "❤️", "🎉", "😄", "😕", "😢", "😡"}
func (s *Store) GetInstanceMemoRelatedSetting(ctx context.Context) (*storepb.InstanceMemoRelatedSetting, error) {
instanceSetting, err := s.GetInstanceSetting(ctx, &FindInstanceSetting{
Name: storepb.InstanceSettingKey_MEMO_RELATED.String(),
})
if err != nil {
return nil, errors.Wrap(err, "failed to get instance general setting")
}
instanceMemoRelatedSetting := &storepb.InstanceMemoRelatedSetting{}
if instanceSetting != nil {
instanceMemoRelatedSetting = instanceSetting.GetMemoRelatedSetting()
}
if len(instanceMemoRelatedSetting.Reactions) == 0 {
instanceMemoRelatedSetting.Reactions = append(instanceMemoRelatedSetting.Reactions, DefaultReactions...)
}
s.cacheInstanceSetting(ctx, &storepb.InstanceSetting{
Key: storepb.InstanceSettingKey_MEMO_RELATED,
Value: &storepb.InstanceSetting_MemoRelatedSetting{MemoRelatedSetting: instanceMemoRelatedSetting},
})
return instanceMemoRelatedSetting, nil
}
func (s *Store) GetInstanceTagsSetting(ctx context.Context) (*storepb.InstanceTagsSetting, error) {
instanceSetting, err := s.GetInstanceSetting(ctx, &FindInstanceSetting{
Name: storepb.InstanceSettingKey_TAGS.String(),
@@ -379,12 +353,6 @@ func convertInstanceSettingFromRaw(instanceSettingRaw *InstanceSetting) (*storep
return nil, err
}
instanceSetting.Value = &storepb.InstanceSetting_StorageSetting{StorageSetting: storageSetting}
case storepb.InstanceSettingKey_MEMO_RELATED.String():
memoRelatedSetting := &storepb.InstanceMemoRelatedSetting{}
if err := protojsonUnmarshaler.Unmarshal([]byte(instanceSettingRaw.Value), memoRelatedSetting); err != nil {
return nil, err
}
instanceSetting.Value = &storepb.InstanceSetting_MemoRelatedSetting{MemoRelatedSetting: memoRelatedSetting}
case storepb.InstanceSettingKey_TAGS.String():
tagsSetting := &storepb.InstanceTagsSetting{}
if err := protojsonUnmarshaler.Unmarshal([]byte(instanceSettingRaw.Value), tagsSetting); err != nil {
+74 -69
View File
@@ -16,20 +16,20 @@
-- or access their Space memberships
--
-- Cast (passwords were random and discarded — seed users are NPCs):
-- 1 steven (ADMIN) — Memos maintainer; welcome, sponsors, changelog, tips
-- 1 steven (ADMIN) — Memos maintainer; welcome, sponsors, release notes, tips
-- 2 johnny (USER) — backend dev & reader; TILs, cheat sheets, weekly review
-- 3 bob (USER) — traveling photographer; locations, photo attachment
-- 4 sam (USER) — reader & cook; books, recipes, movie lists
-- ============================================================================
INSERT OR IGNORE INTO user (username,role,nickname,description,password_hash) VALUES('steven','ADMIN','Steven','Creator & maintainer of Memos. Product updates and notes from building it 🪴','$2y$12$A/8h4XS6hQmRVVSRFQHsR.wWVJbSG40avhuphOBdK5ws99W1kunr6');
UPDATE user SET nickname = CASE WHEN nickname = '' THEN 'Steven' ELSE nickname END, description = CASE WHEN description = '' THEN 'Creator & maintainer of Memos. Product updates and notes from building it 🪴' ELSE description END WHERE username = 'steven';
INSERT OR IGNORE INTO user (username,role,nickname,description,password_hash) VALUES('johnny','USER','Johnny','Backend dev. Notes about Git, Go, and whatever I broke today 🔧','$2y$12$CaqLYlvpHjL1qbVNny0lre59ctT2doIvVLh4Pn1yipsDUtbcbeum6');
UPDATE user SET nickname = CASE WHEN nickname = '' THEN 'Johnny' ELSE nickname END, description = CASE WHEN description = '' THEN 'Backend dev. Notes about Git, Go, and whatever I broke today 🔧' ELSE description END WHERE username = 'johnny';
INSERT OR IGNORE INTO user (username,role,nickname,description,password_hash) VALUES('bob','USER','Bob','Traveling photographer. Writing places down before I forget them 🌍','$2y$12$A/8h4XS6hQmRVVSRFQHsR.wWVJbSG40avhuphOBdK5ws99W1kunr6');
UPDATE user SET nickname = CASE WHEN nickname = '' THEN 'Bob' ELSE nickname END, description = CASE WHEN description = '' THEN 'Traveling photographer. Writing places down before I forget them 🌍' ELSE description END WHERE username = 'bob';
INSERT OR IGNORE INTO user (username,role,nickname,description,password_hash) VALUES('sam','USER','Sam','Reader, cook, maker of lists 📚🍜','$2y$12$CaqLYlvpHjL1qbVNny0lre59ctT2doIvVLh4Pn1yipsDUtbcbeum6');
UPDATE user SET nickname = CASE WHEN nickname = '' THEN 'Sam' ELSE nickname END, description = CASE WHEN description = '' THEN 'Reader, cook, maker of lists 📚🍜' ELSE description END WHERE username = 'sam';
INSERT OR IGNORE INTO user (username,role,nickname,description,password_hash) VALUES('steven','ADMIN','Steven','Building Memos. Product notes and the occasional release checklist.','$2y$12$A/8h4XS6hQmRVVSRFQHsR.wWVJbSG40avhuphOBdK5ws99W1kunr6');
UPDATE user SET nickname = CASE WHEN nickname = '' THEN 'Steven' ELSE nickname END, description = CASE WHEN description = '' THEN 'Building Memos. Product notes and the occasional release checklist.' ELSE description END WHERE username = 'steven';
INSERT OR IGNORE INTO user (username,role,nickname,description,password_hash) VALUES('johnny','USER','Johnny','Backend developer. Git notes, side projects, and a growing reading list.','$2y$12$CaqLYlvpHjL1qbVNny0lre59ctT2doIvVLh4Pn1yipsDUtbcbeum6');
UPDATE user SET nickname = CASE WHEN nickname = '' THEN 'Johnny' ELSE nickname END, description = CASE WHEN description = '' THEN 'Backend developer. Git notes, side projects, and a growing reading list.' ELSE description END WHERE username = 'johnny';
INSERT OR IGNORE INTO user (username,role,nickname,description,password_hash) VALUES('bob','USER','Bob','Walks, train journeys, and sketches from the way home.','$2y$12$A/8h4XS6hQmRVVSRFQHsR.wWVJbSG40avhuphOBdK5ws99W1kunr6');
UPDATE user SET nickname = CASE WHEN nickname = '' THEN 'Bob' ELSE nickname END, description = CASE WHEN description = '' THEN 'Walks, train journeys, and sketches from the way home.' ELSE description END WHERE username = 'bob';
INSERT OR IGNORE INTO user (username,role,nickname,description,password_hash) VALUES('sam','USER','Sam','Books to read, films to watch, and things to cook.','$2y$12$CaqLYlvpHjL1qbVNny0lre59ctT2doIvVLh4Pn1yipsDUtbcbeum6');
UPDATE user SET nickname = CASE WHEN nickname = '' THEN 'Sam' ELSE nickname END, description = CASE WHEN description = '' THEN 'Books to read, films to watch, and things to cook.' ELSE description END WHERE username = 'sam';
-- ============================================================================
-- Spaces — placement and audience are independent. Public and protected memos
@@ -63,114 +63,115 @@ INSERT INTO space_member (space_id,user_id,status,role) VALUES(4,(SELECT id FROM
INSERT INTO space_member (space_id,user_id,status,role) VALUES(4,(SELECT id FROM user WHERE username='steven'),'ACTIVE','USER');
INSERT INTO space_member (space_id,user_id,status,role) VALUES(4,(SELECT id FROM user WHERE username='johnny'),'ACTIVE','USER');
-- Recipes and movies stay unassigned; a memo does not need a Space.
-- Most examples stay unassigned so any signed-in visitor can react and comment.
-- A few notes remain in each sample Space to demonstrate placement.
-- ============================================================================
-- Pinned memos (Welcome leads — newest created_ts in the pinned section)
-- Pinned memos (Welcome is also the newest root memo, so it leads Explore)
-- ============================================================================
-- 1. Welcome (steven, pinned) — orientation + SSO call-to-action + protected teaser
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,pinned,payload,space_id) VALUES(1,'welcome0000001',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-2 days'),strftime('%s','now','-2 days'),replace('# Welcome to Memos 👋\n\nHi, I''m Steven — I build Memos. Welcome to our shared home for product updates, projects, trips, and reading notes.\n\nMemos is an open-source, self-hosted home for short-form thoughts. Capture quickly, organize lightly, own everything.\n\n> Most apps treat notes like documents. Memos treats them like thoughts — small, timestamped, searchable.\n\n## Make yourself at home\n\n- [ ] Scroll this Explore feed — everything here was written with Memos\n- [ ] React to a memo you like (🎉 works great on this one)\n- [ ] **Sign in** to write your own memos. Create a Space for a project or a group.\n- [ ] Write your first memo. One sentence is plenty. That''s the point.\n- [ ] Like it? Star [the repo](https://github.com/usememos/memos) ⭐\n\n🔒 *Psst — a few memos on this instance are hidden until you sign in. Anyone signed in can read them.*\n\n## What Memos can do\n\n| Feature | Where to see it |\n|---------|-----------------|\n| **Markdown** | Everywhere — tables, `code`, task lists, quotes |\n| **Tags** | `#dev/git` — nested tags grow a tree in the sidebar |\n| **Spaces** | Group related memos and invite people to contribute |\n| **Space icons** | Choose an emoji or a symbol for each Space |\n| **Comments & reactions** | Right under this memo 👇 |\n| **Memo references** | Johnny''s weekly review links back to his week |\n| **Attachments** | Bob''s golden-hour art from the coastal trail |\n| **Locations** | Look for the 📍 pins |\n| **Visibility** | Public, protected, private, or Space members — chosen per memo |\n\n## Take it home\n\n```bash\ndocker run -d -p 5230:5230 -v ~/.memos:/var/opt/memos neosmemo/memos:stable\n```\n\nYour data lives in one SQLite file, on your machine. #welcome #getting-started','\n',char(10)),'PUBLIC',1,'{"tags":["welcome","getting-started"],"property":{"hasLink":true,"hasCode":true,"hasTaskList":true,"hasIncompleteTasks":true}}',1);
-- 1. Welcome (steven, pinned) — a short introduction and a route into the examples
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,pinned,payload,space_id) VALUES(1,'welcome0000001',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-10 minutes'),strftime('%s','now','-10 minutes'),replace('# Welcome to Memos\n\nMemos 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.\n\nThis Explore feed contains sample memos from four people. Sign in to write on your own timeline. You can also add reactions and comments to the unassigned examples here.\n\nTry [Bob’s coastal sketch](/memos/goldenhour0001), [Sam’s watchlist](/memos/sammovies00001), or the references in [Johnny’s weekly review](/memos/johnnyweekly001). A few Protected memos appear after sign-in. The sample spaces belong to the demo accounts; you can create a space of your own.\n\n[Documentation](https://usememos.com/docs) · [Source code](https://github.com/usememos/memos)\n\n#welcome #getting-started','\n',char(10)),'PUBLIC',1,'{"property":{"hasLink":true,"title":"Welcome to Memos"},"tags":["welcome","getting-started"]}',NULL);
-- 2. Sponsors (steven, pinned) — sits below Welcome (older created_ts)
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,pinned,payload,space_id) VALUES(2,'sponsors000001',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-6 days'),strftime('%s','now','-6 days'),replace('Memos is free and open source, kept independent by its sponsors — no ads, no telemetry, no paywalls. 🙏 If you build with Memos, please consider supporting them in return.\n\n## ⭐ Sponsors\n\n<a href="https://coderabbit.link/usememos" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/usememos/.github/refs/heads/main/assets/sponsors/coderabbit/orange-typemark.svg" alt="CodeRabbit" height="44" /></a>\n\nCut code review time & bugs in half, instantly. [coderabbit.link/usememos →](https://coderabbit.link/usememos)\n\n---\n\n**TestMu AI** — The world’s first full-stack Agentic AI Quality Engineering platform. [testmuai.com →](https://www.testmuai.com/?utm_medium=sponsor&utm_source=memos)\n\n---\n\nWant to see your company here? Reach out via [GitHub Sponsors](https://github.com/sponsors/usememos).\n\n#sponsors','\n',char(10)),'PUBLIC',1,'{"tags":["sponsors"],"property":{"hasLink":true}}',1);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,pinned,payload,space_id) VALUES(2,'sponsors000001',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-6 days'),strftime('%s','now','-6 days'),replace('Memos is free and open source, kept independent by its sponsors — no ads, no telemetry, no paywalls. 🙏 If you build with Memos, please consider supporting them in return.\n\n## ⭐ Sponsors\n\n<a href="https://coderabbit.link/usememos" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/usememos/.github/refs/heads/main/assets/sponsors/coderabbit/orange-typemark.svg" alt="CodeRabbit" height="44" /></a>\n\nCut code review time & bugs in half, instantly. [coderabbit.link/usememos →](https://coderabbit.link/usememos)\n\n---\n\n**TestMu AI** — The world’s first full-stack Agentic AI Quality Engineering platform. [testmuai.com →](https://www.testmuai.com/?utm_medium=sponsor&utm_source=memos)\n\n---\n\nWant to see your company here? Reach out via [GitHub Sponsors](https://github.com/sponsors/usememos).\n\n#sponsors','\n',char(10)),'PUBLIC',1,'{"property":{"hasLink":true},"tags":["sponsors"]}',1);
-- ============================================================================
-- Public timeline — mixed lengths, four voices, dense in the last 48 hours
-- and thinning out toward -22 days so the feed reads as a living instance
-- ============================================================================
-- 10. Steven: official Chrome extension launch (featured first in Explore)
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(10,'webclipper0001',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-30 minutes'),strftime('%s','now','-30 minutes'),replace('# ✂️ Memos Web Clipper for Chrome\n\nThe ***official*** Memos Web Clipper turns the page you''re reading into a source-linked memo in under five seconds.\n\n[Add Memos Web Clipper to Chrome →](https://chromewebstore.google.com/detail/memos-web-clipper/nebaoebnljalfegiidibihhkebeiklbl)\n\n| Capture from Chrome | What lands in Memos |\n|---------------------|---------------------|\n| Current page | Title, summary, and source link |\n| Text selection | Quoted excerpt with its source |\n| Selected image | A real attachment on your instance |\n\nEdit the generated memo, choose its visibility, or customize the template and default tags before saving.\n\n### Private by design\n\nThe clipper sends captured content only to the self-hosted Memos instance you connect — and only when you save. No analytics, third-party servers, or tracking. #memos/extensions','\n',char(10)),'PUBLIC','{"tags":["memos","memos/extensions"],"property":{"hasLink":true}}',1);
-- 10. Steven: a browser bookmark and the web clipper (first in the timeline)
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(10,'webclipper0001',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-30 minutes'),strftime('%s','now','-30 minutes'),replace('## Saving things from the browser\n\nI keep a #read-later tag for pages I don’t have time to finish. A link and one sentence about why I saved it are usually enough.\n\nThe [Memos Web Clipper for Chrome](https://chromewebstore.google.com/detail/memos-web-clipper/nebaoebnljalfegiidibihhkebeiklbl) can save a page to your instance. I still add that sentence myself; otherwise I forget what caught my attention.\n\n#memos/extensions','\n',char(10)),'PUBLIC','{"property":{"hasLink":true},"tags":["read-later","memos","memos/extensions"]}',NULL);
-- 3. Bob: photo memo with an image attachment + location
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(3,'goldenhour0001',(SELECT id FROM user WHERE username='bob'),strftime('%s','now','-3 hours'),strftime('%s','now','-3 hours'),'Golden hour on the coastal trail tonight. The camera couldn''t hold the colors, so here''s my minimal-art rendition instead 🎨 #travel/hikes','PUBLIC','{"tags":["travel","travel/hikes"],"property":{"hasLink":false},"location":{"placeholder":"Point Reyes, California, United States","latitude":37.9954,"longitude":-123.0204}}',3);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(3,'goldenhour0001',(SELECT id FROM user WHERE username='bob'),strftime('%s','now','-3 hours'),strftime('%s','now','-3 hours'),replace('Point Reyes, from memory.\n\nI made this little sketch after the walk. The sky was still pink when we reached the car. Next time: bring a warmer layer and stay another half hour.\n\n#travel/hikes','\n',char(10)),'PUBLIC','{"property":{},"location":{"placeholder":"Point Reyes, California, United States","latitude":37.9954,"longitude":-123.0204},"tags":["travel","travel/hikes"]}',NULL);
-- 27. Steven: introducing Spaces and custom icons
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(27,'v030changelog1',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-6 hours'),strftime('%s','now','-6 hours'),replace('## Spaces for the things we share\n\nWe''ve organized our memos into four Spaces:\n\n- **Updates** — announcements and tips\n- **Dev** — projects and technical notes\n- **Travel** — trips and photography\n- **Reading** — books and quotes\n\nEach Space has its own members and an emoji or symbol to help you recognize it. Tags still work inside Spaces, and memos can stay unassigned.\n\nA public memo remains public when placed in a Space. Choose Space visibility to share it only with that Space''s members.\n\nCreate your own Space, or accept an invitation to join an existing one.\n\nMore updates: [release notes](https://github.com/usememos/memos/releases). #memos/changelog','\n',char(10)),'PUBLIC','{"tags":["memos","memos/changelog"],"property":{"hasLink":true}}',1);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(27,'v030changelog1',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-5 days'),strftime('%s','now','-5 days'),replace('## Keeping shared notes in spaces\n\nThe sample accounts use Updates, Dev, Travel, and Reading to keep their shared memos together. Each space has its own members and an icon.\n\nYou can create a space for your own project and invite people to join. Memos can also stay unassigned, like the welcome memo and most of the examples in this feed.\n\nPlacement doesn’t decide the audience: a Public memo stays public inside a space. Choose Space visibility for members-only notes.\n\n#memos/spaces','\n',char(10)),'PUBLIC','{"property":{},"tags":["memos","memos/spaces"]}',1);
-- 4. Sam: one-line book quote
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(4,'samquote000001',(SELECT id FROM user WHERE username='sam'),strftime('%s','now','-7 hours'),strftime('%s','now','-7 hours'),replace('> "We tell ourselves stories in order to live." — Joan Didion\n\nBeen thinking about this all morning. #books','\n',char(10)),'PUBLIC','{"tags":["books"],"property":{"hasLink":false}}',4);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(4,'samquote000001',(SELECT id FROM user WHERE username='sam'),strftime('%s','now','-7 hours'),strftime('%s','now','-7 hours'),replace('> "We tell ourselves stories in order to live." — Joan Didion\n\nBeen thinking about this all morning. #books','\n',char(10)),'PUBLIC','{"property":{},"tags":["books"]}',NULL);
-- 5. Johnny: weekly review — REFERENCES his memos from the past week (see memo_relation)
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(5,'johnnyweekly001',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-22 hours'),strftime('%s','now','-22 hours'),replace('## 🗓️ Weekly review\n\n**Shipped:** v0.2 of the side project finally went out.\n\n**Learned:** the single-file branch diff trick — small thing, saves me daily.\n\n**Reading:** still working through *Deep Work*. The no-Slack-before-11am rule survived its second week.\n\n**Next week:** actually write the digest CLI I keep talking about, or stop talking about it.\n\nLinked the memos below so future me can retrace the week. #weekly','\n',char(10)),'PUBLIC','{"tags":["weekly"],"property":{"hasLink":false}}',2);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(5,'johnnyweekly001',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-22 hours'),strftime('%s','now','-22 hours'),replace('## This week\n\nShipped the sync rewrite. The startup delay is finally gone.\n\nKept three mornings free for coding. On the other two, I opened email first and never quite got back to it.\n\nThe branch diff command is in the linked memo below. I have already needed it twice.\n\nNext week: make a first version of the digest script. A text file is enough for now.\n\n#weekly','\n',char(10)),'PUBLIC','{"property":{},"tags":["weekly"]}',NULL);
-- 6. Steven: short product tip
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(6,'tagtipmemo0001',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-26 hours'),strftime('%s','now','-26 hours'),'Tip: tags are just typed inline — `#like/this` — and nested ones grow a tree in the sidebar. No setup, no tag manager. #getting-started','PUBLIC','{"tags":["getting-started"],"property":{"hasLink":false}}',1);
-- 6. Steven: a short reaction tip
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(6,'tagtipmemo0001',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-26 hours'),strftime('%s','now','-26 hours'),replace('I’ve been using 👀 on memos I want to come back to. Search “eyes” in the reaction picker to find it.\n\n#getting-started','\n',char(10)),'PUBLIC','{"property":{},"tags":["getting-started"]}',NULL);
-- 7. Johnny: shipped-it note
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(7,'johnnyshipped01',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-2 days','+3 hours'),strftime('%s','now','-2 days','+3 hours'),'Shipped v0.2 of my side project tonight 🚀 Rewrote the sync engine and cut startup time in half. Scrolling back through my own #dev/til memos made the changelog write itself.','PUBLIC','{"tags":["dev","dev/til"],"property":{"hasLink":false}}',2);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(7,'johnnyshipped01',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-2 days','+3 hours'),strftime('%s','now','-2 days','+3 hours'),replace('The sync rewrite is out. It now loads the local cache before checking the server, so I can start reading straight away.\n\nLeaving the old branch around until Monday. Just in case.\n\n#dev/til','\n',char(10)),'PUBLIC','{"property":{},"tags":["dev","dev/til"]}',NULL);
-- 8. Johnny: short TIL with a code block (referenced by the weekly review)
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(8,'johnnytilgit001',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-3 days'),strftime('%s','now','-3 days'),replace('TIL you can diff a single file between branches — no checkout, no stash dance:\n\n```bash\ngit diff main..feature -- path/to/file.go\n```\n\n#dev/til #dev/git','\n',char(10)),'PUBLIC','{"tags":["dev","dev/til","dev/git"],"property":{"hasLink":false,"hasCode":true}}',2);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(8,'johnnytilgit001',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-3 days'),strftime('%s','now','-3 days'),replace('Compare one file across branches without switching branches:\n\n```bash\ngit diff main..feature -- path/to/file.go\n```\n\nUsed this to check what I had changed in the sync code without disturbing the work in my editor.\n\n#dev/til #dev/git','\n',char(10)),'PUBLIC','{"property":{"hasCode":true},"tags":["dev","dev/til","dev/git"]}',NULL);
-- 29. Johnny: link/bookmark capture — a core Memos use case
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(29,'johnnybookmark1',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-32 hours'),strftime('%s','now','-32 hours'),'Weekend read, bookmarking before I lose it: [SQLite: 35% faster than the filesystem](https://sqlite.org/fasterthanfs.html) — makes me feel better about my entire digital life being one .db file 😄 #dev/reading','PUBLIC','{"tags":["dev","dev/reading"],"property":{"hasLink":true}}',2);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(29,'johnnybookmark1',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-32 hours'),strftime('%s','now','-32 hours'),replace('Saved for the weekend: [SQLite’s filesystem comparison](https://sqlite.org/fasterthanfs.html).\n\nI want to try the benchmark with the small files from the sync project before deciding where to keep them.\n\n#dev/reading','\n',char(10)),'PUBLIC','{"property":{"hasLink":true},"tags":["dev","dev/reading"]}',2);
-- 9. Sam: recipe with a task list
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload) VALUES(9,'samramen000001',(SELECT id FROM user WHERE username='sam'),strftime('%s','now','-4 days'),strftime('%s','now','-4 days'),replace('## 🍜 Midnight miso ramen (15 minutes)\n\nFor nights when the book was too good to stop reading.\n\n- [x] Dashi or veg stock, 500ml\n- [x] Miso paste, 2 big spoons\n- [x] Noodles, one nest\n- [x] Soft egg — 6½ minutes, exactly\n- [ ] Scallions (always forget the scallions)\n\nSteep the miso, don''t boil it. That''s the whole secret. #cooking','\n',char(10)),'PUBLIC','{"tags":["cooking"],"property":{"hasLink":false,"hasTaskList":true,"hasIncompleteTasks":true}}');
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload) VALUES(9,'samramen000001',(SELECT id FROM user WHERE username='sam'),strftime('%s','now','-4 days'),strftime('%s','now','-4 days'),replace('## Miso noodles for one\n\nShopping list for the late-night version:\n\n- [x] Vegetable stock, 500 ml\n- [x] Miso paste\n- [x] Noodles\n- [x] Eggs\n- [ ] Spring onions\n\nCook the noodles and egg separately. Take the stock off the heat before stirring in the miso. Start with one spoonful and taste before adding more.\n\nI keep forgetting the spring onions. They make a difference.\n\n#cooking','\n',char(10)),'PUBLIC','{"property":{"hasTaskList":true,"hasIncompleteTasks":true},"tags":["cooking"]}');
-- 30. Steven: compact Markdown rendering check framed as maintainer dogfooding
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(30,'rendertest0001',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-10 days'),strftime('%s','now','-10 days'),replace('## 🧪 Markdown rendering check #memos/dev\n\nA quick smoke test I open after releases:\n\n**Bold**, *italic*, ~~strikethrough~~, `inline code`, and a [docs link](https://www.usememos.com/docs).\n\n> Simple notes should render beautifully.\n\n```go\nfmt.Println("syntax highlighting ✓")\n```\n\n| Check | Status |\n|-------|--------|\n| Text styles | ✅ |\n| Code blocks | ✅ |\n| Tables | ✅ |\n\n- [x] Check desktop\n- [x] Check mobile\n- [ ] Ship the next release','\n',char(10)),'PUBLIC','{"tags":["memos","memos/dev"],"property":{"hasLink":true,"hasCode":true,"hasTaskList":true,"hasIncompleteTasks":true}}',1);
-- 30. Steven: a release checklist with Markdown formatting
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(30,'rendertest0001',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-10 days'),strftime('%s','now','-10 days'),replace('## Before the next release\n\n**Check the upgrade path**, then try a fresh install. ~~Desktop only~~ Remember the phone this time.\n\nQuick check that code blocks still render:\n\n```go\nfmt.Println("ready for another test run")\n```\n\n| Check | Result |\n| --- | --- |\n| Fresh install | Passed |\n| Existing data | Passed |\n| Narrow screen | Still to do |\n\n- [x] Read through the [release notes](https://github.com/usememos/memos/releases)\n- [x] Open the sample image\n- [ ] Finish the phone check\n\n#memos/dev','\n',char(10)),'PUBLIC','{"property":{"hasLink":true,"hasTaskList":true,"hasCode":true,"hasIncompleteTasks":true},"tags":["memos","memos/dev"]}',NULL);
-- 11. Sam: movie watchlist with a table
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload) VALUES(11,'sammovies00001',(SELECT id FROM user WHERE username='sam'),strftime('%s','now','-9 days'),strftime('%s','now','-9 days'),replace('## 🎬 Movie catch-up #movies\n\nWorking through films I''ve been meaning to watch for, uh, years.\n\n| Movie | Status | Rating |\n|-------|--------|--------|\n| The Grand Budapest Hotel | ✅ Watched | ⭐⭐⭐⭐⭐ |\n| Spirited Away | ✅ Watched | ⭐⭐⭐⭐⭐ |\n| Everything Everywhere All at Once | ✅ Watched | ⭐⭐⭐⭐⭐ |\n| Dune: Part Two | 📅 This weekend | — |\n| Oppenheimer | 📋 Queued | — |\n\n**Spirited Away**: cried twice, no regrets. **Everything Everywhere**: went in cold, did not expect the bagel.\n\nNext month: full Miyazaki marathon 🎨 Taking suggestions for where to start.','\n',char(10)),'PUBLIC','{"tags":["movies"],"property":{"hasLink":false}}');
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload) VALUES(11,'sammovies00001',(SELECT id FROM user WHERE username='sam'),strftime('%s','now','-9 days'),strftime('%s','now','-9 days'),replace('## Weekend watchlist\n\n| Film | Status | Note |\n| --- | --- | --- |\n| Spirited Away | Watched | The train scene. Still thinking about it. |\n| The Grand Budapest Hotel | Watched | Want to pause every frame. |\n| Everything Everywhere All at Once | Watched | Glad I knew very little going in. |\n| Porco Rosso | Next | Johnny’s recommendation. |\n| Dune: Part Two | Later | Save for a night with no interruptions. |\n\nMight make this a Miyazaki month. What should come after *Porco Rosso*?\n\n#movies','\n',char(10)),'PUBLIC','{"property":{},"tags":["movies"]}');
-- 12. Bob: short travel journal + location
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(12,'bobnighttrain1',(SELECT id FROM user WHERE username='bob'),strftime('%s','now','-12 days'),strftime('%s','now','-12 days'),'Overnight train from Oslo to Bergen. Woke at 5am to fjords in fog and couldn''t go back to sleep. Some views are worth the bad coffee ☕ #travel','PUBLIC','{"tags":["travel"],"property":{"hasLink":false},"location":{"placeholder":"Bergen, Vestland, Norway","latitude":60.3913,"longitude":5.3221}}',3);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(12,'bobnighttrain1',(SELECT id FROM user WHERE username='bob'),strftime('%s','now','-12 days'),strftime('%s','now','-12 days'),replace('Night train to Bergen. Woke before everyone else and watched the mountains go past with a cup of very bad coffee.\n\nDidn’t take a single photo for the first hour.\n\n#travel','\n',char(10)),'PUBLIC','{"property":{},"location":{"placeholder":"Bergen, Vestland, Norway","latitude":60.3913,"longitude":5.3221},"tags":["travel"]}',NULL);
-- 13. Bob: travel bucket list + location
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(13,'bobbucketlist1',(SELECT id FROM user WHERE username='bob'),strftime('%s','now','-13 days'),strftime('%s','now','-13 days'),replace('## 🌍 My travel bucket list #travel/bucketlist\n\n> Writing this from a tiny café near the Seine. Will keep updating after each trip. 📍\n\n### Been\n- [x] Paris, France — the croissants ruined every croissant after\n- [x] Shanghai, China — modern skyline next to thousand-year-old temples, somehow it works\n- [x] Grand Canyon, USA — photos do not do it justice, and I say that professionally\n- [x] Barcelona, Spain — Gaudí''s buildings look grown, not built\n\n### Next\n- [ ] Northern Lights in Iceland — booking for winter, *finally*\n- [ ] Safari in Tanzania\n- [ ] Great Barrier Reef, before it gets worse\n- [ ] New Zealand road trip — south island, two weeks minimum','\n',char(10)),'PUBLIC','{"tags":["travel","travel/bucketlist"],"property":{"hasTaskList":true,"hasIncompleteTasks":true},"location":{"placeholder":"Paris, Île-de-France, France","latitude":48.8566,"longitude":2.3522}}',3);
-- 13. Bob: return-trip plans + location
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(13,'bobbucketlist1',(SELECT id FROM user WHERE username='bob'),strftime('%s','now','-13 days'),strftime('%s','now','-13 days'),replace('## Places to go back to\n\n- [x] Paris: the bookshop I found on the last afternoon\n- [x] Barcelona: a full day with no route planned\n- [ ] Point Reyes: walk the coastal trail in winter\n- [ ] Bergen: take the train in daylight this time\n\nStill want to do a two-week road trip around New Zealand’s South Island. Leaving that one on the list until I can take the time off.\n\n#travel/plans','\n',char(10)),'PUBLIC','{"property":{"hasTaskList":true,"hasIncompleteTasks":true},"location":{"placeholder":"Paris, Île-de-France, France","latitude":48.8566,"longitude":2.3522},"tags":["travel","travel/plans"]}',3);
-- 14. Johnny: git cheat sheet — long-form anchor with code blocks
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(14,'johnnygitcheat1',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-17 days'),strftime('%s','now','-17 days'),replace('## ⚡ Git commands I keep forgetting #dev/git #dev/cheatsheet\n\nWriting these down so I stop googling the same things every week.\n\n```bash\n# Show the last commit in detail\ngit show --stat HEAD\n\n# Undo the last commit, keep changes staged\ngit reset --soft HEAD~1\n\n# Stash including untracked files\ngit stash push -u -m "wip: before refactor"\n\n# Find which commit introduced a string\ngit log -S "function_name" --source --all\n```\n\nThe `-S` one is gold for archaeology — way better than scrolling blame.','\n',char(10)),'PUBLIC','{"tags":["dev","dev/git","dev/cheatsheet"],"property":{"hasLink":false,"hasCode":true}}',2);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(14,'johnnygitcheat1',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-17 days'),strftime('%s','now','-17 days'),replace('## Git commands I keep looking up\n\n```bash\n# Summarize the last commit\ngit show --stat HEAD\n\n# Undo the last commit, keeping its changes staged\ngit reset --soft HEAD~1\n\n# Stash tracked and untracked files\ngit stash push -u -m "before the sync refactor"\n\n# Find commits that changed the number of occurrences of a string\ngit log -S "loadCache" --all\n```\n\n`git log -S` found the commit where I removed the cache check. It was mine, of course.\n\n#dev/git #dev/cheatsheet','\n',char(10)),'PUBLIC','{"property":{"hasCode":true},"tags":["dev","dev/git","dev/cheatsheet"]}',NULL);
-- 15. Johnny: reading note + café location (oldest memo — the back of the feed)
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(15,'johnnyreading01',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-22 days'),strftime('%s','now','-22 days'),replace('## 📖 Reading: Deep Work #books\n\nStarted Cal Newport''s *Deep Work* this week. This passage stopped me:\n\n> "Human beings, it seems, are at their best when immersed deeply in something challenging."\n\nThat''s the whole pitch in one sentence. The rest of the book is evidence.\n\nExperiment for the next two weeks: no Slack or email before 11am. See what shifts when the morning is mine.','\n',char(10)),'PUBLIC','{"tags":["books"],"property":{"hasLink":false},"location":{"placeholder":"Sightglass Coffee, San Francisco, California, United States","latitude":37.7726,"longitude":-122.4099}}',4);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(15,'johnnyreading01',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-22 days'),strftime('%s','now','-22 days'),replace('## Reading: Deep Work\n\nTrying one idea from Cal Newport’s book: keep the first part of the morning free for work that needs concentration.\n\nMy rule for the next two weeks:\n\n> No email before 11. Leave a note about where to start tomorrow before closing the laptop today.\n\nThe second part might be more useful than the first. Starting is easier when I left myself something specific to do.\n\n#books','\n',char(10)),'PUBLIC','{"property":{},"location":{"placeholder":"Sightglass Coffee, San Francisco, California, United States","latitude":37.7726,"longitude":-122.4099},"tags":["books"]}',NULL);
-- ============================================================================
-- Protected memos — invisible when logged out; Explore gains these after SSO
-- sign-in, which is how visitors *experience* the visibility model
-- ============================================================================
-- 16. Steven: self-referential visibility explainer
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(16,'protectedintro',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-20 hours'),strftime('%s','now','-20 hours'),replace('🔓 **If you can read this, you''re signed in.**\n\nThis memo uses **Protected** visibility: anyone signed in to this instance can read it.\n\nEach memo has its own audience:\n\n- **Public** — anyone, including visitors who aren''t signed in.\n- **Protected** — anyone signed in to this instance.\n- **Private** — only its author.\n- **Space** — active members of the Space where the memo is placed.\n\nPlacing a memo in a Space doesn''t automatically make it members-only. Choose **Space** visibility when that''s the audience you want. #getting-started','\n',char(10)),'PROTECTED','{"tags":["getting-started"],"property":{"hasLink":false}}',1);
-- 16. Steven: visibility examples for signed-in visitors
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(16,'protectedintro',(SELECT id FROM user WHERE username='steven'),strftime('%s','now','-20 hours'),strftime('%s','now','-20 hours'),replace('## A note for signed-in readers\n\nThis memo uses **Protected** visibility. Anyone signed in to this instance can read it; signed-out visitors cannot.\n\nPublic memos are readable without signing in. Private memos are for their author. Space visibility is for active members of that space. Instance administrators can access memos across these audiences.\n\nA memo’s space and its visibility are separate choices. Moving a Public memo into a space keeps it public. Choose Space visibility when you want it to be members-only.\n\n#getting-started','\n',char(10)),'PROTECTED','{"property":{},"tags":["getting-started"]}',NULL);
-- 17. Johnny: half-formed idea — protected memos are naturally rougher
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(17,'johnnydigestcli',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-9 hours'),strftime('%s','now','-9 hours'),'Half-formed idea: a tiny CLI that collects my #dev/til memos into a weekly digest. Memos has a full API with access tokens, so this is one evening of work. Parking it here so future me has no excuses.','PROTECTED','{"tags":["dev","dev/til"],"property":{"hasLink":false}}',2);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(17,'johnnydigestcli',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-9 hours'),strftime('%s','now','-9 hours'),replace('Idea for the weekend: turn my #dev/til memos into a weekly digest.\n\nFirst version:\n\n- [ ] Fetch this week’s memos through the API\n- [ ] Keep the ones tagged #dev/til\n- [ ] Write them to a Markdown file\n\nNo scheduling yet. I want to run it by hand a few times before deciding what to automate.','\n',char(10)),'PROTECTED','{"property":{"hasTaskList":true,"hasIncompleteTasks":true},"tags":["dev","dev/til"]}',NULL);
-- 18. Bob: packing list for signed-in readers
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(18,'bobpacklist001',(SELECT id FROM user WHERE username='bob'),strftime('%s','now','-5 days'),strftime('%s','now','-5 days'),replace('Coast trip packing list — sharing this with everyone signed in, because you deserve to know how much coffee gear I carry:\n\n- [x] Camera + the one lens I''ll actually use\n- [x] AeroPress, hand grinder, scale ☕\n- [x] Rain shell\n- [ ] The second lens I won''t use but will pack anyway\n\n#travel/hikes','\n',char(10)),'PROTECTED','{"tags":["travel","travel/hikes"],"property":{"hasLink":false,"hasTaskList":true,"hasIncompleteTasks":true}}',3);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(18,'bobpacklist001',(SELECT id FROM user WHERE username='bob'),strftime('%s','now','-5 days'),strftime('%s','now','-5 days'),replace('## Coast trip packing list\n\n- [x] Camera and one lens\n- [x] Spare battery and an empty memory card\n- [x] Rain shell\n- [x] Coffee flask\n- [ ] A warmer layer for the walk back\n- [ ] Check the forecast the night before\n\nThe last trip is why the warm layer is on here.\n\n#travel/hikes','\n',char(10)),'PROTECTED','{"property":{"hasTaskList":true,"hasIncompleteTasks":true},"tags":["travel","travel/hikes"]}',NULL);
-- 19. Sam: confession
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(19,'sambookpile001',(SELECT id FROM user WHERE username='sam'),strftime('%s','now','-30 hours'),strftime('%s','now','-30 hours'),'Note to self: stop buying books faster than I read them. Current pile: 9. Keeping this memo protected so only people signed in witness my shame 📚 #books','PROTECTED','{"tags":["books"],"property":{"hasLink":false}}',4);
-- 19. Sam: the unread book pile
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(19,'sambookpile001',(SELECT id FROM user WHERE username='sam'),strftime('%s','now','-30 hours'),strftime('%s','now','-30 hours'),replace('Nine books in the unread pile. Borrowed another one today.\n\nFinishing the one on my bedside table before I start it. Writing that down so Johnny can hold me to it.\n\n#books','\n',char(10)),'PROTECTED','{"property":{},"tags":["books"]}',4);
-- ============================================================================
-- Comments (memos linked via memo_relation COMMENT)
-- ============================================================================
-- 20. Sam on Welcome
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(20,'cmtwelcome0001',(SELECT id FROM user WHERE username='sam'),strftime('%s','now','-21 hours'),strftime('%s','now','-21 hours'),'Signed in with SSO and posted my first memo inside a minute. Lowest-friction note app I''ve used 👏','PUBLIC','{"property":{"hasLink":false}}',1);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(20,'cmtwelcome0001',(SELECT id FROM user WHERE username='sam'),strftime('%s','now','-7 minutes'),strftime('%s','now','-7 minutes'),replace('I started with a reading list. Now half my memos are just things I don’t want to forget before I get home.','\n',char(10)),'PUBLIC','{"property":{}}',NULL);
-- 21–22. Thread on Johnny's git cheat sheet
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(21,'cmtgitcheat001',(SELECT id FROM user WHERE username='bob'),strftime('%s','now','-17 days','+5 hours'),strftime('%s','now','-17 days','+5 hours'),'Saving the `git log -S` one. Code archaeology mode unlocked 🔥','PUBLIC','{"property":{"hasLink":false}}',2);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(22,'cmtgitcheat002',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-17 days','+6 hours'),strftime('%s','now','-17 days','+6 hours'),'Also try `git log -p -- path/to/file` when you want the actual content changes for one file. Same archaeology vibe.','PUBLIC','{"property":{"hasLink":false}}',2);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(21,'cmtgitcheat001',(SELECT id FROM user WHERE username='bob'),strftime('%s','now','-17 days','+5 hours'),strftime('%s','now','-17 days','+5 hours'),replace('The `-S` command found a setting I thought we had lost. Adding this to my own notes.','\n',char(10)),'PUBLIC','{"property":{"hasCode":true}}',NULL);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(22,'cmtgitcheat002',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-17 days','+6 hours'),strftime('%s','now','-17 days','+6 hours'),replace('For the full history of one file, I use `git log -p -- path/to/file`. Useful alongside this.','\n',char(10)),'PUBLIC','{"property":{"hasCode":true}}',NULL);
-- 23–24. Thread on Bob's golden-hour memo
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(23,'cmtgolden00001',(SELECT id FROM user WHERE username='sam'),strftime('%s','now','-2 hours'),strftime('%s','now','-2 hours'),'Okay, the gradient sky is gorgeous. Which trail is this?','PUBLIC','{"property":{"hasLink":false}}',3);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(24,'cmtgolden00002',(SELECT id FROM user WHERE username='bob'),strftime('%s','now','-1 hours'),strftime('%s','now','-1 hours'),'Point Reyes, the stretch north of the lighthouse — tap the 📍 on the memo. Golden hour there never misses.','PUBLIC','{"property":{"hasLink":false}}',3);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(23,'cmtgolden00001',(SELECT id FROM user WHERE username='sam'),strftime('%s','now','-2 hours'),strftime('%s','now','-2 hours'),replace('Was this the walk where you forgot your jacket? I like the pink strip above the water.','\n',char(10)),'PUBLIC','{"property":{}}',NULL);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(24,'cmtgolden00002',(SELECT id FROM user WHERE username='bob'),strftime('%s','now','-1 hours'),strftime('%s','now','-1 hours'),replace('That’s the one. Point Reyes, near the lighthouse. The location is attached to the memo if you want to find it.','\n',char(10)),'PUBLIC','{"property":{}}',NULL);
-- 25. Johnny on Sam's movie list
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload) VALUES(25,'cmtmovies00001',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-8 days'),strftime('%s','now','-8 days'),'Start the Miyazaki marathon with *Porco Rosso*. Trust me.','PUBLIC','{"property":{"hasLink":false}}');
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload) VALUES(25,'cmtmovies00001',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-8 days'),strftime('%s','now','-8 days'),replace('Start with *Porco Rosso*. Then *Kiki’s Delivery Service* if you want something gentler.','\n',char(10)),'PUBLIC','{"property":{}}');
-- 28. Johnny on Steven's changelog note
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(28,'cmtchangelog01',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-4 hours'),strftime('%s','now','-4 hours'),'Gave Dev a wrench icon. Much easier to spot when switching between coding notes and Reading 🔧','PUBLIC','{"property":{"hasLink":false}}',1);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(28,'cmtchangelog01',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-4 hours'),strftime('%s','now','-4 hours'),replace('Moved my Git notes into Dev and left the book notes in Reading. The wrench icon helps when I’m switching between them.','\n',char(10)),'PUBLIC','{"property":{}}',1);
-- 31. Johnny on the rendering test memo (includes an @mention)
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(31,'cmtrendertest1',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-10 days','+4 hours'),strftime('%s','now','-10 days','+4 hours'),'Keeping a Markdown checklist right alongside the release notes makes sense, @steven 😄','PUBLIC','{"property":{"hasLink":false}}',1);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(31,'cmtrendertest1',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-10 days','+4 hours'),strftime('%s','now','-10 days','+4 hours'),replace('The image looks right on my phone, @steven. The table is readable too.','\n',char(10)),'PUBLIC','{"property":{}}',NULL);
-- 26. Johnny on the protected explainer (protected too — consistent visibility)
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(26,'cmtprotected01',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-18 hours'),strftime('%s','now','-18 hours'),'Can confirm: this memo did not exist for me until I signed in. Neat trick 👀','PROTECTED','{"property":{"hasLink":false}}',1);
INSERT INTO memo (id,uid,creator_id,created_ts,updated_ts,content,visibility,payload,space_id) VALUES(26,'cmtprotected01',(SELECT id FROM user WHERE username='johnny'),strftime('%s','now','-18 hours'),strftime('%s','now','-18 hours'),replace('I use Protected for book-club recommendations I want everyone here to read, and Private for the rough notes I’m still writing.','\n',char(10)),'PROTECTED','{"property":{}}',NULL);
-- ============================================================================
-- Relations
@@ -193,44 +194,48 @@ INSERT INTO memo_relation VALUES(5,8,'REFERENCE'); -- weekly review → git di
INSERT INTO memo_relation VALUES(5,15,'REFERENCE'); -- weekly review → Deep Work note
-- ============================================================================
-- Reactions (types must appear in the configured MEMO_RELATED reactions list)
-- Reactions
-- ============================================================================
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(1,(SELECT id FROM user WHERE username='johnny'),1,'🎉');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(2,(SELECT id FROM user WHERE username='bob'),1,'🎉');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(3,(SELECT id FROM user WHERE username='sam'),1,'👍');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(4,(SELECT id FROM user WHERE username='johnny'),2,'🚀');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(5,(SELECT id FROM user WHERE username='bob'),2,'👍');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(6,(SELECT id FROM user WHERE username='johnny'),3,'🔥');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(7,(SELECT id FROM user WHERE username='sam'),3,'💛');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(4,(SELECT id FROM user WHERE username='johnny'),2,'❤️');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(5,(SELECT id FROM user WHERE username='bob'),2,'🙏');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(6,(SELECT id FROM user WHERE username='johnny'),3,'🤩');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(7,(SELECT id FROM user WHERE username='sam'),3,'👏');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(8,(SELECT id FROM user WHERE username='steven'),3,'👏');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(9,(SELECT id FROM user WHERE username='johnny'),4,'💛');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(10,(SELECT id FROM user WHERE username='bob'),4,'👀');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(11,(SELECT id FROM user WHERE username='steven'),5,'👏');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(12,(SELECT id FROM user WHERE username='sam'),5,'💡');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(9,(SELECT id FROM user WHERE username='johnny'),4,'❤️');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(10,(SELECT id FROM user WHERE username='bob'),4,'❤️');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(11,(SELECT id FROM user WHERE username='steven'),5,'✅');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(12,(SELECT id FROM user WHERE username='sam'),5,'👍🏽');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(13,(SELECT id FROM user WHERE username='steven'),7,'🚀');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(14,(SELECT id FROM user WHERE username='sam'),7,'🎉');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(15,(SELECT id FROM user WHERE username='bob'),7,'🔥');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(15,(SELECT id FROM user WHERE username='bob'),7,'🚀');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(16,(SELECT id FROM user WHERE username='bob'),8,'💡');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(17,(SELECT id FROM user WHERE username='sam'),8,'+1');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(18,(SELECT id FROM user WHERE username='bob'),9,'👌');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(19,(SELECT id FROM user WHERE username='johnny'),9,'💛');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(17,(SELECT id FROM user WHERE username='sam'),8,'👍');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(18,(SELECT id FROM user WHERE username='bob'),9,'🍜');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(19,(SELECT id FROM user WHERE username='johnny'),9,'🍜');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(20,(SELECT id FROM user WHERE username='steven'),11,'👍');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(21,(SELECT id FROM user WHERE username='sam'),12,'💛');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(21,(SELECT id FROM user WHERE username='sam'),12,'🇳🇴');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(22,(SELECT id FROM user WHERE username='bob'),14,'🔥');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(23,(SELECT id FROM user WHERE username='sam'),14,'💡');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(24,(SELECT id FROM user WHERE username='sam'),10,'💡');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(25,(SELECT id FROM user WHERE username='steven'),6,'👍');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(24,(SELECT id FROM user WHERE username='sam'),10,'📎');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(25,(SELECT id FROM user WHERE username='johnny'),6,'👀');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(26,(SELECT id FROM user WHERE username='johnny'),16,'👀');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(27,(SELECT id FROM user WHERE username='bob'),16,'✅');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(28,(SELECT id FROM user WHERE username='sam'),18,'😂');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(29,(SELECT id FROM user WHERE username='bob'),19,'😂');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(28,(SELECT id FROM user WHERE username='sam'),18,'🧳');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(29,(SELECT id FROM user WHERE username='johnny'),19,'📚');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(30,(SELECT id FROM user WHERE username='johnny'),27,'🎉');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(31,(SELECT id FROM user WHERE username='sam'),27,'🚀');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(32,(SELECT id FROM user WHERE username='bob'),27,'🔥');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(33,(SELECT id FROM user WHERE username='steven'),29,'👀');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(34,(SELECT id FROM user WHERE username='johnny'),30,'😂');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(35,(SELECT id FROM user WHERE username='sam'),30,'💡');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(34,(SELECT id FROM user WHERE username='johnny'),30,'✅');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(35,(SELECT id FROM user WHERE username='sam'),30,'👀');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(36,(SELECT id FROM user WHERE username='steven'),31,'👍');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(37,(SELECT id FROM user WHERE username='johnny'),24,'🧭');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(38,(SELECT id FROM user WHERE username='sam'),25,'🎬');
INSERT INTO reaction (id,creator_id,memo_id,reaction_type) VALUES(39,(SELECT id FROM user WHERE username='steven'),21,'💡');
-- ============================================================================
-- Attachment: Bob's golden-hour art (stored in the database blob column;
+3 -3
View File
@@ -164,7 +164,7 @@ func TestConfigurationTransactionWrites(t *testing.T) {
general, err := tx.GetUncachedInstanceSetting(ctx, &store.FindInstanceSetting{Name: "GENERAL"})
require.NoError(t, err)
require.Equal(t, "Configured", general.GetGeneralSetting().GetCustomProfile().GetTitle())
require.NoError(t, tx.DeleteInstanceSetting(ctx, storepb.InstanceSettingKey_MEMO_RELATED))
require.NoError(t, tx.DeleteInstanceSetting(ctx, storepb.InstanceSettingKey_NOTIFICATION))
created, err := tx.CreateUser(ctx, &store.User{Username: "admin", Role: store.RoleAdmin, Email: " Admin@Example.com ", PasswordHash: "hash"})
require.NoError(t, err)
@@ -186,9 +186,9 @@ func TestConfigurationTransactionWrites(t *testing.T) {
general, err := ts.GetInstanceGeneralSetting(ctx)
require.NoError(t, err)
require.Equal(t, "Configured", general.GetCustomProfile().GetTitle(), "the commit invalidated the cached setting")
memoRelated, err := ts.GetUncachedInstanceSetting(ctx, &store.FindInstanceSetting{Name: "MEMO_RELATED"})
notification, err := ts.GetUncachedInstanceSetting(ctx, &store.FindInstanceSetting{Name: "NOTIFICATION"})
require.NoError(t, err)
require.Nil(t, memoRelated)
require.Nil(t, notification)
demoted, err := ts.GetUser(ctx, &store.FindUser{ID: &existing.ID})
require.NoError(t, err)
require.Equal(t, store.RoleUser, demoted.Role)
-47
View File
@@ -241,37 +241,6 @@ func TestCreateInstanceSettingIfNotExistsIsFirstWriterWins(t *testing.T) {
require.Equal(t, winner, settings[0].Value, "a later insert attempt must not overwrite the persisted value")
}
func TestInstanceSettingMemoRelatedSetting(t *testing.T) {
t.Parallel()
ctx := context.Background()
ts := NewTestingStore(ctx, t)
// Get default memo related setting (should have defaults)
memoSetting, err := ts.GetInstanceMemoRelatedSetting(ctx)
require.NoError(t, err)
require.NotNil(t, memoSetting)
require.NotEmpty(t, memoSetting.Reactions)
// Set custom memo related setting
customReactions := []string{"👍", "👎", "🚀"}
_, err = ts.UpsertInstanceSetting(ctx, &storepb.InstanceSetting{
Key: storepb.InstanceSettingKey_MEMO_RELATED,
Value: &storepb.InstanceSetting_MemoRelatedSetting{
MemoRelatedSetting: &storepb.InstanceMemoRelatedSetting{
Reactions: customReactions,
},
},
})
require.NoError(t, err)
// Verify
memoSetting, err = ts.GetInstanceMemoRelatedSetting(ctx)
require.NoError(t, err)
require.Equal(t, customReactions, memoSetting.Reactions)
ts.Close()
}
func TestInstanceSettingStorageSetting(t *testing.T) {
t.Parallel()
ctx := context.Background()
@@ -619,21 +588,5 @@ func TestInstanceSettingEdgeCases(t *testing.T) {
require.Equal(t, specialScript, generalSetting.AdditionalScript)
require.Equal(t, specialStyle, generalSetting.AdditionalStyle)
// Case 2: Memo Related Setting with Unicode reactions
unicodeReactions := []string{"🐱", "🐶", "🦊", "🦄"}
_, err = ts.UpsertInstanceSetting(ctx, &storepb.InstanceSetting{
Key: storepb.InstanceSettingKey_MEMO_RELATED,
Value: &storepb.InstanceSetting_MemoRelatedSetting{
MemoRelatedSetting: &storepb.InstanceMemoRelatedSetting{
Reactions: unicodeReactions,
},
},
})
require.NoError(t, err)
memoSetting, err := ts.GetInstanceMemoRelatedSetting(ctx)
require.NoError(t, err)
require.Equal(t, unicodeReactions, memoSetting.Reactions)
ts.Close()
}
+7
View File
@@ -29,6 +29,13 @@ func TestReactionStore(t *testing.T) {
require.NotNil(t, reaction)
require.NotEmpty(t, reaction.ID)
repeated, err := ts.UpsertReaction(ctx, &store.Reaction{
CreatorID: user.ID, MemoID: memo.ID, ReactionType: "💗",
})
require.NoError(t, err)
require.Equal(t, reaction.ID, repeated.ID)
require.Equal(t, reaction.CreatedTs, repeated.CreatedTs)
reactions, err := ts.ListReactions(ctx, &store.FindReaction{
MemoID: &memo.ID,
})
+11
View File
@@ -120,3 +120,14 @@ const output = `// Generated by scripts/generate-tag-unicode-data.mjs. Do not ed
const outputURL = new URL("../src/utils/tag-unicode-data.ts", import.meta.url);
await writeFile(fileURLToPath(outputURL), output);
const namedEmoji = emojiTest.split("\n").flatMap((line) => {
const match = line.match(/^([0-9A-F ]+)\s*;\s*fully-qualified\s*#\s*\S+\s+E[\d.]+\s+(.+)$/);
if (!match) return [];
const glyph = String.fromCodePoint(...match[1].trim().split(/\s+/).map((part) => Number.parseInt(part, 16)));
return [[glyph, match[2]]];
});
await writeFile(
new URL("../src/lib/emoji-data.ts", import.meta.url),
`// Generated by scripts/generate-tag-unicode-data.mjs. Do not edit.\n// Unicode Emoji ${UNICODE_RELEASE}: ${sources.emoji}\n// biome-ignore-all format: generated Unicode names\nexport const EMOJI: readonly (readonly [string, string])[] = [\n${namedEmoji.map((entry) => ` ${JSON.stringify(entry)},`).join("\n")}\n];\n`,
);
@@ -24,8 +24,8 @@ const MemoReactionListView = (props: Props) => {
return (
// Chips are filled surfaces, so their box edge, not their padding, sits on the text edge.
<div className="flex w-full flex-row flex-wrap items-center justify-start gap-1 select-none">
{Array.from(reactionGroup).map(([reactionType, users]) => (
<ReactionView key={`${reactionType.toString()} ${users.length}`} memo={memoData} reactionType={reactionType} users={users} />
{Array.from(reactionGroup).map(([reactionType, group]) => (
<ReactionView key={reactionType} memo={memoData} reactionType={reactionType} count={group.reactions.length} names={group.names} />
))}
{!readonly && currentUser && <ReactionSelector memo={memoData} />}
</div>
@@ -1,42 +1,167 @@
import { Button, Popover, Toggle, Tooltip } from "@usememos/ui";
import { Button, Combobox, Popover, Tooltip } from "@usememos/ui";
import { SmilePlusIcon } from "lucide-react";
import { type ReactElement, useRef, useState } from "react";
import { useInstance } from "@/contexts/InstanceContext";
import { type ReactElement, type RefObject, useLayoutEffect, useMemo, useRef, useState } from "react";
import { findEmoji } from "@/lib/emoji";
import type { Memo } from "@/types/proto/api/memo_service_pb";
import { useTranslate } from "@/utils/i18n";
import { useReactionActions } from "./hooks";
interface Props {
memo: Memo;
/**
* The element that opens the picker. Defaults to the quiet add control that closes a
* strip of reaction pills; a host with its own action grammar (the memo header) passes
* the control that belongs there.
*/
trigger?: ReactElement;
}
/** The emoji picker. It owns only the popover and the grid; the trigger is the host's. */
const COLUMNS = 8;
const OVERSCAN = 2;
interface EmojiGridProps {
searchRef: RefObject<HTMLInputElement | null>;
hasReacted: (emoji: string) => boolean;
onSelect: (emoji: string) => void;
onClose: () => void;
}
function EmojiGrid({ searchRef, hasReacted, onSelect, onClose }: EmojiGridProps) {
const t = useTranslate();
const [query, setQuery] = useState("");
const [scrollRow, setScrollRow] = useState(0);
const [highlightedRow, setHighlightedRow] = useState<number>();
const [layout, setLayout] = useState({ rowSize: 34, height: 240, padding: 0 });
const listRef = useRef<HTMLDivElement>(null);
const options = useMemo(() => findEmoji(query), [query]);
const selected = useMemo(() => options.filter(({ emoji }) => hasReacted(emoji)), [options, hasReacted]);
const rowCount = Math.ceil(options.length / COLUMNS);
const windowSize = Math.ceil(layout.height / layout.rowSize) + OVERSCAN * 2;
const start = Math.max(0, Math.min(scrollRow - OVERSCAN, rowCount - windowSize));
const rows = new Set(Array.from({ length: Math.min(windowSize, rowCount) }, (_, index) => start + index));
// Keep the active cell and its neighbors mounted when a pointer scrolls away from it.
if (highlightedRow !== undefined) {
for (let row = highlightedRow - 1; row <= highlightedRow + 1; row++) {
if (row >= 0 && row < rowCount) rows.add(row);
}
}
useLayoutEffect(() => {
const list = listRef.current;
if (!list) return;
const measure = () => {
const row = list.querySelector<HTMLElement>('[role="row"]');
const height = row?.getBoundingClientRect().height ?? 0;
const rowSize = height > 0 && row ? height + Number.parseFloat(getComputedStyle(row).rowGap) : 34;
const next = {
rowSize,
height: list.clientHeight || 240,
padding: Number.parseFloat(getComputedStyle(list).paddingTop) || 0,
};
setLayout((previous) =>
previous.rowSize === next.rowSize && previous.height === next.height && previous.padding === next.padding ? previous : next,
);
};
measure();
const observer = new ResizeObserver(measure);
observer.observe(list);
return () => observer.disconnect();
}, []);
return (
<Combobox.Root
items={options}
filter={null}
inline
grid
virtualized
autoHighlight
multiple
value={selected}
itemToStringLabel={(item) => item.name}
inputValue={query}
onInputValueChange={(next, { reason }) => {
if (reason !== "input-change" && reason !== "input-clear") return;
setQuery(next);
setScrollRow(0);
setHighlightedRow(undefined);
if (listRef.current) listRef.current.scrollTop = 0;
}}
onItemHighlighted={(_, { index, reason }) => {
const row = index >= 0 ? Math.floor(index / COLUMNS) : undefined;
setHighlightedRow(row);
const list = listRef.current;
if (!list || row === undefined || reason === "pointer") return;
const top = row * layout.rowSize;
if (top < list.scrollTop) list.scrollTop = top;
else if (top + layout.rowSize > list.scrollTop + layout.height - layout.padding * 2) {
list.scrollTop = top + layout.rowSize - layout.height + layout.padding * 2;
}
setScrollRow(Math.floor(list.scrollTop / layout.rowSize));
}}
onOpenChange={(next, { reason }) => {
if (!next && reason === "escape-key") onClose();
}}
>
<div className="flex min-w-0 flex-col gap-2">
<Combobox.Input ref={searchRef} aria-label={t("space.icon.search-emoji")} placeholder={t("space.icon.search-emoji")} />
<Combobox.List
ref={listRef}
aria-label={t("space.icon.emoji")}
aria-rowcount={rowCount}
aria-colcount={COLUMNS}
className="h-60 p-0"
onScroll={(event) => setScrollRow(Math.floor(event.currentTarget.scrollTop / layout.rowSize))}
>
<Combobox.Empty>{t("space.icon.no-results")}</Combobox.Empty>
<div role="presentation" className="relative" style={{ height: rowCount * layout.rowSize }}>
{Array.from(rows)
.sort((a, b) => a - b)
.map((rowIndex) => (
<Combobox.Row
key={rowIndex}
aria-rowindex={rowIndex + 1}
className="absolute inset-x-0 grid"
style={{ top: rowIndex * layout.rowSize, marginTop: 0, gridTemplateColumns: `repeat(${COLUMNS}, minmax(0, 1fr))` }}
>
{options.slice(rowIndex * COLUMNS, (rowIndex + 1) * COLUMNS).map((option, columnIndex) => (
<Combobox.Item
key={option.emoji}
value={option}
index={rowIndex * COLUMNS + columnIndex}
aria-colindex={columnIndex + 1}
aria-label={option.name}
aria-description={t(hasReacted(option.emoji) ? "memo.remove-reaction" : "memo.add-reaction")}
style={{ width: "100%" }}
onClick={() => onSelect(option.emoji)}
>
<span className="inline-flex size-5 items-center justify-center text-xl" aria-hidden>
{option.emoji}
</span>
</Combobox.Item>
))}
</Combobox.Row>
))}
</div>
</Combobox.List>
</div>
</Combobox.Root>
);
}
const ReactionSelector = ({ memo, trigger }: Props) => {
const t = useTranslate();
const [open, setOpen] = useState(false);
const triggerRef = useRef<HTMLButtonElement>(null);
const popupRef = useRef<HTMLDivElement>(null);
const { memoRelatedSetting } = useInstance();
const searchRef = useRef<HTMLInputElement>(null);
const { handleReactionClick, isPending, canReact, hasReacted } = useReactionActions({ memo });
const close = () => {
triggerRef.current?.focus({ preventScroll: true });
setOpen(false);
};
const { hasReacted, handleReactionClick } = useReactionActions({
memo,
onComplete: () => {
if (popupRef.current?.contains(document.activeElement)) triggerRef.current?.focus({ preventScroll: true });
setOpen(false);
},
});
if (!canReact) return null;
return (
<Popover.Root
open={open}
onOpenChange={(nextOpen, details) => {
// Focus must reach the header trigger before closing hides its wrapper.
if (nextOpen && isPending) return;
if (!nextOpen && details.reason === "escape-key") triggerRef.current?.focus({ preventScroll: true });
setOpen(nextOpen);
}}
@@ -46,42 +171,31 @@ const ReactionSelector = ({ memo, trigger }: Props) => {
render={
<Popover.Trigger
ref={triggerRef}
aria-label={t("setting.memo.add-reaction")}
aria-label={t("memo.add-reaction")}
aria-disabled={isPending}
render={trigger ?? <Button variant="ghost" shape="pill" size="sm" icon={<SmilePlusIcon />} />}
/>
}
/>
<Tooltip.Popup>{t("setting.memo.add-reaction")}</Tooltip.Popup>
<Tooltip.Popup>{t("memo.add-reaction")}</Tooltip.Popup>
</Tooltip.Root>
{/*
* The header trigger is intentionally hidden once its memo card is no
* longer hovered. An exit transition would therefore outlive its anchor
* and Base UI would briefly reposition the portal at (0, 0). Close this
* picker immediately instead of animating an unanchored popup.
*/}
<Popover.Popup
ref={popupRef}
align="start"
initialFocus={(interactionType) => (interactionType === "keyboard" ? true : popupRef.current)}
aria-label={t("setting.memo.add-reaction")}
className="mu-compact w-max p-[calc(var(--mu-space-2)-1px)] transition-none"
initialFocus={searchRef}
aria-label={t("memo.add-reaction")}
className="max-w-[calc(100vw-2rem)] p-[calc(var(--mu-space-3)-1px)] transition-none"
style={{ width: `calc(${COLUMNS} * var(--mu-row-height) + ${COLUMNS - 1} * var(--mu-inset) + 2 * var(--mu-space-3))` }}
>
<div className="grid max-h-[var(--mu-list-height)] grid-flow-col gap-0.5 overflow-y-auto max-sm:grid-flow-row max-sm:grid-cols-[repeat(4,max-content)]">
{memoRelatedSetting.reactions.map((reactionType) => (
<Toggle
key={reactionType}
variant="ghost"
className="w-[var(--mu-row-height)] p-0 data-pressed:bg-mu-selected"
aria-label={reactionType}
pressed={hasReacted(reactionType)}
onPressedChange={() => handleReactionClick(reactionType)}
>
<span className="mu-body" aria-hidden>
{reactionType}
</span>
</Toggle>
))}
</div>
{open && (
<EmojiGrid
searchRef={searchRef}
hasReacted={hasReacted}
onClose={close}
onSelect={(emoji) => {
if (handleReactionClick(emoji)) close();
}}
/>
)}
</Popover.Popup>
</Popover.Root>
);
@@ -1,64 +1,102 @@
import { Toggle, Tooltip } from "@usememos/ui";
import useCurrentUser from "@/hooks/useCurrentUser";
import { useEffect, useId, useRef, useState } from "react";
import { emojiName } from "@/lib/emoji";
import { cn } from "@/lib/utils";
import { State } from "@/types/proto/api/common_pb";
import type { Memo } from "@/types/proto/api/memo_service_pb";
import type { User } from "@/types/proto/api/user_service_pb";
import { formatReactionTooltip, useReactionActions } from "./hooks";
import { useReactionActions } from "./hooks";
interface Props {
memo: Memo;
reactionType: string;
users: User[];
count: number;
names: string[];
}
const ReactionView = (props: Props) => {
const { memo, reactionType, users } = props;
const currentUser = useCurrentUser();
const readonly = memo.state === State.ARCHIVED;
const { hasReacted, handleReactionClick } = useReactionActions({ memo });
const hasReaction = hasReacted(reactionType);
const isClickable = Boolean(currentUser) && !readonly;
const ReactionView = ({ memo, reactionType, count, names }: Props) => {
const { hasReacted, handleReactionClick, isPending, canReact, canWithdraw } = useReactionActions({ memo });
const pressed = hasReacted(reactionType);
const clickable = canReact || (canWithdraw && pressed);
const [open, setOpen] = useState(false);
const triggerId = useId();
const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
const longPressed = useRef(false);
const clearTimer = () => clearTimeout(timer.current);
useEffect(() => clearTimer, []);
const label = (
<span className="inline-flex items-center gap-1">
<span className="mu-body">{reactionType}</span>
<span className="mu-caption tabular-nums">{users.length}</span>
<span className="mu-caption tabular-nums">{count}</span>
</span>
);
const accessibleName = `${emojiName(reactionType)}: ${count} · ${names.join(", ")}`;
return (
<Tooltip.Provider>
<Tooltip.Root>
<Tooltip.Trigger
render={
isClickable ? (
<Toggle
variant="soft"
shape="pill"
size="sm"
className="shrink-0"
pressed={hasReaction}
onPressedChange={() => handleReactionClick(reactionType)}
/>
) : (
<span
className={cn(
"inline-flex h-6 shrink-0 items-center rounded-mu-full px-2",
hasReaction ? "bg-mu-selected text-mu-text" : "bg-mu-hover text-mu-text-secondary",
)}
/>
)
<Tooltip.Root open={open} onOpenChange={setOpen} triggerId={triggerId}>
<Tooltip.Trigger
id={triggerId}
onPointerDown={(event) => {
if (event.pointerType !== "touch") return;
longPressed.current = false;
clearTimer();
timer.current = setTimeout(() => {
longPressed.current = true;
setOpen(true);
}, 500);
}}
onPointerUp={() => {
clearTimer();
if (longPressed.current) timer.current = setTimeout(() => setOpen(false), 2000);
}}
onPointerCancel={() => {
clearTimer();
longPressed.current = false;
setOpen(false);
}}
onPointerLeave={() => {
clearTimer();
if (longPressed.current) setOpen(false);
}}
onContextMenu={(event) => {
if (longPressed.current) event.preventDefault();
}}
onClickCapture={(event) => {
if (longPressed.current) {
event.preventDefault();
event.stopPropagation();
longPressed.current = false;
}
>
{label}
</Tooltip.Trigger>
<Tooltip.Popup>
<p>{formatReactionTooltip(users, reactionType)}</p>
</Tooltip.Popup>
</Tooltip.Root>
</Tooltip.Provider>
}}
render={
clickable ? (
<Toggle
variant="soft"
shape="pill"
size="sm"
className="shrink-0"
aria-label={accessibleName}
aria-disabled={isPending}
pressed={pressed}
onPressedChange={() => {
handleReactionClick(reactionType);
}}
/>
) : (
<span
aria-label={accessibleName}
className={cn(
"inline-flex h-6 shrink-0 items-center rounded-mu-full px-2",
pressed ? "bg-mu-selected text-mu-text" : "bg-mu-hover text-mu-text-secondary",
)}
/>
)
}
>
{label}
</Tooltip.Trigger>
<Tooltip.Popup className="max-w-64">
<p>{names.join(", ")}</p>
</Tooltip.Popup>
</Tooltip.Root>
);
};
@@ -1,84 +1,49 @@
import { useQueryClient } from "@tanstack/react-query";
import { useMemo } from "react";
import { memoServiceClient } from "@/connect";
import { useResolvedUsersByNames } from "@/contexts/MentionResolutionContext";
import useCurrentUser from "@/hooks/useCurrentUser";
import { memoDetailQueryOptions, memoKeys } from "@/hooks/useMemoQueries";
import type { Memo, Reaction } from "@/types/proto/api/memo_service_pb";
import type { User } from "@/types/proto/api/user_service_pb";
export type ReactionGroup = Map<string, User[]>;
export const useReactionGroups = (reactions: Reaction[]): ReactionGroup => {
const creatorNames = useMemo(() => reactions.map((r) => r.creator), [reactions]);
const userMap = useResolvedUsersByNames(creatorNames);
import { useToggleReaction } from "@/hooks/useReactionQueries";
import { useSpaces } from "@/hooks/useSpaceQueries";
import { extractUsernameFromName } from "@/lib/resource-names";
import { State } from "@/types/proto/api/common_pb";
import { type Memo, type Reaction, Visibility } from "@/types/proto/api/memo_service_pb";
import { SpaceMember_Role } from "@/types/proto/api/space_service_pb";
import { isSuperUser } from "@/utils/user";
export const useReactionGroups = (reactions: Reaction[]) => {
const creatorNames = useMemo(() => reactions.map((reaction) => reaction.creator), [reactions]);
const users = useResolvedUsersByNames(creatorNames);
return useMemo(() => {
const reactionGroup = new Map<string, User[]>();
const groups = new Map<string, { reactions: Reaction[]; names: string[] }>();
for (const reaction of reactions) {
const user = userMap?.get(reaction.creator);
if (!user) continue;
const users = reactionGroup.get(reaction.reactionType) || [];
users.push(user);
reactionGroup.set(reaction.reactionType, users);
const group = groups.get(reaction.reactionType) ?? { reactions: [], names: [] };
const user = users.get(reaction.creator);
group.reactions.push(reaction);
group.names.push(user?.displayName || user?.username || extractUsernameFromName(reaction.creator));
groups.set(reaction.reactionType, group);
}
return reactionGroup;
}, [reactions, userMap]);
return groups;
}, [reactions, users]);
};
interface UseReactionActionsOptions {
memo: Memo;
onComplete?: () => void;
}
export const useReactionActions = ({ memo, onComplete }: UseReactionActionsOptions) => {
export const useReactionActions = ({ memo }: { memo: Memo }) => {
const currentUser = useCurrentUser();
const queryClient = useQueryClient();
const admin = isSuperUser(currentUser);
const { data: spaces } = useSpaces(currentUser?.name, { enabled: Boolean(memo.space) && !admin });
const role = spaces?.find((space) => space.name === memo.space)?.currentUserRole;
const active = Boolean(currentUser) && currentUser?.state !== State.ARCHIVED && memo.state !== State.ARCHIVED;
const canReact =
active &&
(admin ||
((!memo.space || role === SpaceMember_Role.ADMIN || role === SpaceMember_Role.USER) &&
(memo.visibility !== Visibility.PRIVATE || memo.creator === currentUser?.name)));
const { toggleReaction, isPending } = useToggleReaction(memo, currentUser?.name);
const hasReacted = (reactionType: string) =>
memo.reactions.some((reaction) => reaction.reactionType === reactionType && reaction.creator === currentUser?.name);
const hasReacted = (reactionType: string) => {
return memo.reactions.some((r) => r.reactionType === reactionType && r.creator === currentUser?.name);
const handleReactionClick = (reactionType: string) => {
if (!active || (!canReact && !hasReacted(reactionType))) return false;
return toggleReaction(reactionType);
};
const handleReactionClick = async (reactionType: string) => {
if (!currentUser) return;
try {
if (hasReacted(reactionType)) {
const reactions = memo.reactions.filter(
(reaction) => reaction.reactionType === reactionType && reaction.creator === currentUser.name,
);
await Promise.all(reactions.map((reaction) => memoServiceClient.deleteMemoReaction({ name: reaction.name })));
} else {
await memoServiceClient.upsertMemoReaction({
parent: memo.name,
reaction: { reactionType },
});
}
// Fetch the memo into its detail query, which every surface showing the memo reads, a card in a list included.
// Cancelling the fetch in flight first keeps an older copy of the reactions (an earlier click's) from landing
// after this one.
await queryClient.cancelQueries({ queryKey: memoKeys.detail(memo.name) });
await queryClient.fetchQuery({ ...memoDetailQueryOptions(memo.name), staleTime: 0 });
queryClient.invalidateQueries({ queryKey: memoKeys.lists() });
// If this memo is a comment, refresh the parent's comments list so the comment's reactions update in the UI
if (memo.parent) {
queryClient.invalidateQueries({ queryKey: memoKeys.comments(memo.parent) });
}
} catch {
// skip error
}
onComplete?.();
};
return { hasReacted, handleReactionClick };
};
export const formatReactionTooltip = (users: User[], reactionType: string): string => {
if (users.length === 0) return "";
const formatUserName = (user: User) => user.displayName || user.username;
if (users.length < 5) {
return `${users.map(formatUserName).join(", ")} reacted with ${reactionType.toLowerCase()}`;
}
return `${users.slice(0, 4).map(formatUserName).join(", ")} and ${users.length - 4} more reacted with ${reactionType.toLowerCase()}`;
return { hasReacted, handleReactionClick, isPending, canReact, canWithdraw: active };
};
@@ -1,145 +0,0 @@
import { create } from "@bufbuild/protobuf";
import { Badge, Button, Input, Tooltip } from "@usememos/ui";
import { isEqual, uniq } from "lodash-es";
import { CheckIcon, CircleAlertIcon, X } from "lucide-react";
import { useEffect, useState } from "react";
import { useInstance } from "@/contexts/InstanceContext";
import { isFieldManaged, useManagedResource } from "@/hooks/useConfigurationQueries";
import {
InstanceSetting_Key,
InstanceSetting_MemoRelatedSetting,
InstanceSetting_MemoRelatedSettingSchema,
InstanceSettingSchema,
} from "@/types/proto/api/instance_service_pb";
import { useTranslate } from "@/utils/i18n";
import ManagedByConfigurationChip from "./ManagedByConfigurationChip";
import SettingGroup from "./SettingGroup";
import { SettingPanel } from "./SettingList";
import SettingSection from "./SettingSection";
import useInstanceSettingUpdater, { buildInstanceSettingName } from "./useInstanceSettingUpdater";
const MemoRelatedSettings = () => {
const t = useTranslate();
const saveInstanceSetting = useInstanceSettingUpdater();
const { memoRelatedSetting: originalSetting } = useInstance();
const [memoRelatedSetting, setMemoRelatedSetting] = useState<InstanceSetting_MemoRelatedSetting>(originalSetting);
const [editingReaction, setEditingReaction] = useState<string>("");
const managed = useManagedResource(buildInstanceSettingName(InstanceSetting_Key.MEMO_RELATED));
const reactionsLocked = isFieldManaged(managed, "memoRelatedSetting.reactions");
useEffect(() => {
setMemoRelatedSetting(originalSetting);
}, [originalSetting]);
const updatePartialSetting = (partial: Partial<InstanceSetting_MemoRelatedSetting>) => {
const newInstanceMemoRelatedSetting = create(InstanceSetting_MemoRelatedSettingSchema, {
...memoRelatedSetting,
...partial,
});
setMemoRelatedSetting(newInstanceMemoRelatedSetting);
};
const upsertReaction = () => {
const trimmed = editingReaction.trim();
if (!trimmed) {
return;
}
updatePartialSetting({ reactions: uniq([...memoRelatedSetting.reactions, trimmed]) });
setEditingReaction("");
};
const handleUpdateSetting = async () => {
if (memoRelatedSetting.reactions.length === 0) {
return;
}
await saveInstanceSetting({
key: InstanceSetting_Key.MEMO_RELATED,
setting: create(InstanceSettingSchema, {
name: buildInstanceSettingName(InstanceSetting_Key.MEMO_RELATED),
value: {
case: "memoRelatedSetting",
value: memoRelatedSetting,
},
}),
errorContext: "Update memo-related settings",
});
};
return (
<SettingSection title={t("setting.memo.label")}>
<SettingGroup
title={t("setting.memo.reactions")}
description={t("setting.memo.reactions-description")}
actions={reactionsLocked ? <ManagedByConfigurationChip resource={managed} /> : undefined}
>
<SettingPanel
header={
<div className="flex items-center justify-between gap-3">
<span className="mu-label text-mu-text-secondary">{t("setting.memo.configured-reactions")}</span>
<Badge tone="outline">{memoRelatedSetting.reactions.length}</Badge>
</div>
}
footer={
<div className="flex flex-col gap-2 sm:flex-row sm:items-center">
<Input
className="max-w-48 font-mono"
aria-label={t("setting.memo.add-reaction")}
placeholder={t("setting.memo.reaction-placeholder")}
value={editingReaction}
disabled={reactionsLocked}
onChange={(event) => setEditingReaction(event.target.value)}
onKeyDown={(e) => e.key === "Enter" && upsertReaction()}
/>
<Button variant="neutral" onClick={upsertReaction} disabled={reactionsLocked || !editingReaction.trim()} icon={<CheckIcon />}>
{t("setting.memo.add-reaction")}
</Button>
</div>
}
>
<div className="flex min-h-10 flex-wrap gap-2">
{memoRelatedSetting.reactions.map((reactionType) => (
<span key={reactionType} className="inline-flex h-8 items-center gap-2 rounded-mu-md border border-mu-line px-2.5 mu-body">
<span>{reactionType}</span>
<Tooltip.Root>
<Tooltip.Trigger
render={
<Button
variant="ghost"
size="xs"
disabled={reactionsLocked}
onClick={() => updatePartialSetting({ reactions: memoRelatedSetting.reactions.filter((r) => r !== reactionType) })}
aria-label={t("setting.memo.remove-reaction")}
icon={<X />}
/>
}
/>
<Tooltip.Popup>{t("setting.memo.remove-reaction")}</Tooltip.Popup>
</Tooltip.Root>
</span>
))}
</div>
</SettingPanel>
</SettingGroup>
<div className="flex w-full items-center justify-end gap-3">
{memoRelatedSetting.reactions.length === 0 && (
<p role="alert" className="flex items-center gap-1 mu-caption text-mu-danger">
<CircleAlertIcon className="mu-icon" />
{t("setting.memo.reactions-required")}
</p>
)}
<Button
variant="primary"
disabled={isEqual(memoRelatedSetting, originalSetting) || memoRelatedSetting.reactions.length === 0}
onClick={handleUpdateSetting}
>
{t("common.save")}
</Button>
</div>
</SettingSection>
);
};
export default MemoRelatedSettings;
@@ -9,7 +9,6 @@ import {
HeartHandshakeIcon,
KeyIcon,
KeyRoundIcon,
LibraryIcon,
type LucideIcon,
MailIcon,
Settings2Icon,
@@ -27,7 +26,6 @@ import EditorSection from "@/components/Settings/EditorSection";
import InstanceSection from "@/components/Settings/InstanceSection";
import MemberSection from "@/components/Settings/MemberSection";
import MemoExportSection from "@/components/Settings/MemoExportSection";
import MemoRelatedSettings from "@/components/Settings/MemoRelatedSettings";
import MyAccountSection from "@/components/Settings/MyAccountSection";
import NotificationSection from "@/components/Settings/NotificationSection";
import PreferencesSection from "@/components/Settings/PreferencesSection";
@@ -50,7 +48,6 @@ export type SettingSectionKey =
| "webhook"
| "member"
| "system"
| "memo"
| "storage"
| "usage-limits"
| "notification"
@@ -128,13 +125,6 @@ export const SETTINGS_SECTIONS: SettingSectionDefinition[] = [
icon: Settings2Icon,
component: InstanceSection,
},
{
key: "memo",
scope: "admin",
labelKey: "setting.memo.label",
icon: LibraryIcon,
component: MemoRelatedSettings,
},
{
key: "tags",
scope: "basic",
+1 -14
View File
@@ -13,8 +13,6 @@ import {
InstanceSetting_GeneralSetting,
InstanceSetting_GeneralSettingSchema,
InstanceSetting_Key,
InstanceSetting_MemoRelatedSetting,
InstanceSetting_MemoRelatedSettingSchema,
InstanceSetting_NotificationSetting,
InstanceSetting_NotificationSettingSchema,
InstanceSetting_StorageSetting,
@@ -45,7 +43,6 @@ interface InstanceState {
interface InstanceContextValue extends InstanceState {
accessSetting: InstanceSetting_AccessSetting;
generalSetting: InstanceSetting_GeneralSetting;
memoRelatedSetting: InstanceSetting_MemoRelatedSetting;
storageSetting: InstanceSetting_StorageSetting;
notificationSetting: InstanceSetting_NotificationSetting;
aiSetting: InstanceSetting_AISetting;
@@ -87,14 +84,6 @@ export function InstanceProvider({ children }: { children: ReactNode }) {
return create(InstanceSetting_GeneralSettingSchema, {});
}, [state.settings]);
const memoRelatedSetting = useMemo((): InstanceSetting_MemoRelatedSetting => {
const setting = state.settings.find((s) => s.name === `${instanceSettingNamePrefix}MEMO_RELATED`);
if (setting?.value.case === "memoRelatedSetting") {
return setting.value.value;
}
return create(InstanceSetting_MemoRelatedSettingSchema, {});
}, [state.settings]);
const storageSetting = useMemo((): InstanceSetting_StorageSetting => {
const setting = state.settings.find((s) => s.name === `${instanceSettingNamePrefix}STORAGE`);
if (setting?.value.case === "storageSetting") {
@@ -143,7 +132,7 @@ export function InstanceProvider({ children }: { children: ReactNode }) {
const settingsRequest = instanceServiceClient
.batchGetInstanceSettings({
names: [buildInstanceSettingName(InstanceSetting_Key.GENERAL), buildInstanceSettingName(InstanceSetting_Key.MEMO_RELATED)],
names: [buildInstanceSettingName(InstanceSetting_Key.GENERAL)],
})
.then((settingsResponse) => {
for (const setting of settingsResponse.instanceSettings) {
@@ -243,7 +232,6 @@ export function InstanceProvider({ children }: { children: ReactNode }) {
...state,
accessSetting,
generalSetting,
memoRelatedSetting,
storageSetting,
notificationSetting,
aiSetting,
@@ -256,7 +244,6 @@ export function InstanceProvider({ children }: { children: ReactNode }) {
state,
accessSetting,
generalSetting,
memoRelatedSetting,
storageSetting,
notificationSetting,
aiSetting,
-6
View File
@@ -107,9 +107,3 @@ export function useGeneralSetting() {
const generalSetting = setting?.value.case === "generalSetting" ? setting.value.value : undefined;
return { data: generalSetting, ...rest };
}
export function useMemoRelatedSetting() {
const { data: setting, ...rest } = useInstanceSetting(InstanceSetting_Key.MEMO_RELATED);
const memoRelatedSetting = setting?.value.case === "memoRelatedSetting" ? setting.value.value : undefined;
return { data: memoRelatedSetting, ...rest };
}
+15 -2
View File
@@ -19,7 +19,7 @@ import { memoShareKeys } from "@/hooks/useMemoShareQueries";
import { userKeys } from "@/hooks/useUserQueries";
import { DEFAULT_LIST_MEMOS_PAGE_SIZE } from "@/lib/constants";
import { shouldRetry } from "@/lib/query-client";
import type { ListMemosRequest, ListMemosResponse, Memo } from "@/types/proto/api/memo_service_pb";
import type { ListMemosRequest, ListMemosResponse, Memo, Reaction } from "@/types/proto/api/memo_service_pb";
import { ListMemoCommentsRequestSchema, ListMemosRequestSchema, MemoSchema } from "@/types/proto/api/memo_service_pb";
// Query keys factory for consistent cache management
@@ -182,7 +182,7 @@ export function findMemoRecord(queryClient: QueryClient, name: string): Memo | n
let foundAt = -1;
for (const root of MEMO_QUERY_ROOTS) {
for (const query of queryClient.getQueryCache().findAll({ queryKey: root })) {
if (query.state.dataUpdatedAt <= foundAt) continue;
if (query.state.dataUpdatedAt < foundAt || (query.state.dataUpdatedAt === foundAt && !isMemo(query.state.data))) continue;
const memo = findMemoInQueryData(query.state.data, name);
if (memo) {
found = memo;
@@ -199,6 +199,19 @@ function patchMemoInCollectionQueries(queryClient: QueryClient, update: MemoPatc
);
}
/** Updates reactions wherever a memo is cached without replacing its other fields. */
export function updateMemoReactions(queryClient: QueryClient, name: string, update: (reactions: Reaction[]) => Reaction[]) {
const current = findMemoRecord(queryClient, name);
if (!current) return;
const reactions = update(current.reactions);
const patch = (memo: Memo) => (memo.name === name ? { ...memo, reactions } : memo);
for (const root of MEMO_QUERY_ROOTS) {
queryClient.setQueriesData<unknown>({ queryKey: root }, (data: unknown) =>
isMemo(data) ? patch(data) : mapMemoCollection(data, (memos) => memos.map(patch)),
);
}
}
/**
* A memo by name, read from whatever query already holds it, with no request of its
* own: a card in a list reads the list's copy and follows the list's refetches and the
+76
View File
@@ -0,0 +1,76 @@
import { create } from "@bufbuild/protobuf";
import { useIsMutating, useMutation, useQueryClient } from "@tanstack/react-query";
import { memoServiceClient } from "@/connect";
import { findMemoRecord, memoKeys, updateMemoReactions } from "@/hooks/useMemoQueries";
import { memoShareKeys } from "@/hooks/useMemoShareQueries";
import { handleError } from "@/lib/error";
import { showErrorToast } from "@/lib/toast";
import { type Memo, type Reaction, ReactionSchema } from "@/types/proto/api/memo_service_pb";
export function useToggleReaction(memo: Memo, creator: string | undefined) {
const queryClient = useQueryClient();
const mutationKey = ["memo-reaction", memo.name];
const isPending = useIsMutating({ mutationKey }) > 0;
const sharedMemoKey = [...memoShareKeys.all, "by-share"];
const cancelReads = () =>
Promise.all([queryClient.cancelQueries({ queryKey: memoKeys.all }), queryClient.cancelQueries({ queryKey: sharedMemoKey })]);
const mutation = useMutation({
mutationKey,
mutationFn: async ({ reactionType, existing }: { reactionType: string; existing: Reaction[] }) => {
if (existing.length) {
await Promise.all(existing.map(({ name }) => memoServiceClient.deleteMemoReaction({ name })));
return undefined;
}
return memoServiceClient.upsertMemoReaction({ parent: memo.name, reaction: { reactionType } });
},
onMutate: async ({ reactionType, existing }) => {
await cancelReads();
const record = findMemoRecord(queryClient, memo.name);
if (record === null) return;
const current = record ?? memo;
if (!queryClient.getQueryData(memoKeys.detail(memo.name))) queryClient.setQueryData(memoKeys.detail(memo.name), current);
const previous = current.reactions;
updateMemoReactions(queryClient, memo.name, (reactions) =>
existing.length
? reactions.filter((reaction) => reaction.creator !== creator || reaction.reactionType !== reactionType)
: [...reactions, create(ReactionSchema, { name: `${memo.name}/reactions/pending`, creator, reactionType })],
);
return { previous };
},
onSuccess: async (saved, { reactionType }) => {
await cancelReads();
updateMemoReactions(queryClient, memo.name, (reactions) => [
...reactions.filter((reaction) => reaction.creator !== creator || reaction.reactionType !== reactionType),
...(saved ? [saved] : []),
]);
},
onError: async (error, { reactionType }, context) => {
await cancelReads();
if (context) {
updateMemoReactions(queryClient, memo.name, (reactions) => [
...reactions.filter((reaction) => reaction.creator !== creator || reaction.reactionType !== reactionType),
...context.previous.filter((reaction) => reaction.creator === creator && reaction.reactionType === reactionType),
]);
}
handleError(error, showErrorToast);
},
onSettled: () => {
void queryClient.invalidateQueries({ queryKey: memoKeys.detail(memo.name) });
void queryClient.invalidateQueries({ queryKey: memoKeys.lists() });
void queryClient.invalidateQueries({ queryKey: sharedMemoKey });
if (memo.parent) void queryClient.invalidateQueries({ queryKey: memoKeys.comments(memo.parent) });
},
});
const toggleReaction = (reactionType: string) => {
if (!creator || queryClient.isMutating({ mutationKey })) return false;
const record = findMemoRecord(queryClient, memo.name);
if (record === null) return false;
const current = record ?? memo;
const existing = current.reactions.filter((reaction) => reaction.creator === creator && reaction.reactionType === reactionType);
mutation.mutate({ reactionType, existing });
return true;
};
return { toggleReaction, isPending };
}
File diff suppressed because it is too large Load Diff
+28
View File
@@ -0,0 +1,28 @@
import { EMOJI } from "./emoji-data";
const COMMON_EMOJI = ["👍", "❤️", "🎉", "😄", "👀", "🚀", "🙏", "🔥"];
const aliases: Record<string, string> = {
"👍": "thumbsup thumbs up +1 like yes approve",
"👎": "thumbsdown thumbs down -1 dislike no",
"❤️": "love heart",
"🎉": "tada party celebration",
"😄": "smile happy laugh",
"🙏": "thanks thank you please pray",
"💯": "100 hundred",
};
export const EMOJI_OPTIONS = EMOJI.map(([emoji, name]) => ({ emoji, name, search: `${name} ${aliases[emoji] ?? ""}`.toLowerCase() }));
const emojiByGlyph = new Map(EMOJI_OPTIONS.map((option) => [option.emoji, option]));
const defaultOptions = [
...COMMON_EMOJI.flatMap((emoji) => emojiByGlyph.get(emoji) ?? []),
...EMOJI_OPTIONS.filter(({ emoji }) => !COMMON_EMOJI.includes(emoji)),
];
export function findEmoji(query: string) {
const terms = query.trim().toLowerCase().replaceAll(":", "").replaceAll("_", " ").split(/\s+/).filter(Boolean);
if (!terms.length) {
return defaultOptions;
}
return EMOJI_OPTIONS.filter(({ emoji, search }) => emoji === query.trim() || terms.every((term) => search.includes(term)));
}
export const emojiName = (emoji: string) => emojiByGlyph.get(emoji)?.name ?? emoji;
+3 -11
View File
@@ -440,7 +440,9 @@
"uncheck-all": "إلغاء تحديد جميع المهام",
"updated": "تم تحديث المهام"
},
"view-options": "خيارات العرض"
"view-options": "خيارات العرض",
"add-reaction": "إضافة رد فعل",
"remove-reaction": "إزالة التفاعل"
},
"message": {
"archived-successfully": "تمت الأرشفة بنجاح",
@@ -898,16 +900,6 @@
"disallow-user-registration-description": "منع المستخدمين الجدد من إنشاء حسابات من صفحة التسجيل.",
"week-start-day-description": "التحكم في اليوم الأول المعروض في العروض التي تشبه التقويم."
},
"memo": {
"reactions": "تفاعلات",
"label": "مذكرة",
"reactions-required": "يجب ألا تكون قائمة التفاعلات فارغة",
"add-reaction": "إضافة رد فعل",
"configured-reactions": "ردود الفعل المُهيأة",
"reaction-placeholder": "مثال: 👍",
"reactions-description": "حدد خيارات التفاعل التي يمكن للمستخدمين تطبيقها على المذكرات.",
"remove-reaction": "إزالة التفاعل"
},
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "اسم سهل التذكر",
+3 -11
View File
@@ -543,7 +543,9 @@
"public-description": "Hamıya görünür",
"space": "Üzvlər",
"space-description": "{{space}} daxilində hamı"
}
},
"add-reaction": "Reaksiya əlavə et",
"remove-reaction": "Reaksiyanı çıxar"
},
"message": {
"archived-successfully": "Uğurla arxivləndi",
@@ -732,16 +734,6 @@
"create-success": "İstifadəçi yaradıldı",
"update-success": "İstifadəçi yeniləndi"
},
"memo": {
"add-reaction": "Reaksiya əlavə et",
"configured-reactions": "Təyin edilmiş reaksiyalar",
"label": "Qeyd",
"reaction-placeholder": "məs. 👍",
"reactions-description": "İstifadəçilərin qeydlərə tətbiq edə biləcəyi reaksiya variantlarını təyin edin.",
"remove-reaction": "Reaksiyanı çıxar",
"reactions": "Reaksiyalar",
"reactions-required": "Reaksiyalar siyahısı boş ola bilməz"
},
"memo-export": {
"description": "Qeydlərinizi və qoşmalarınızı tək bir ZIP faylı ilə Memos nüsxələri arasında köçürün.",
"export-action": "İxrac et",
+3 -11
View File
@@ -479,7 +479,9 @@
"layout-list-description": "Една колона с ширина за четене",
"on-this-memo": "В тази бележка",
"parent-memo": "Родителска бележка",
"view-options": "Опции за преглед"
"view-options": "Опции за преглед",
"add-reaction": "Добавете реакция",
"remove-reaction": "Премахнете реакцията"
},
"message": {
"archived-successfully": "Архивиран успешно",
@@ -654,16 +656,6 @@
"create-success": "Потребителят е създаден",
"update-success": "Потребителят е обновен"
},
"memo": {
"add-reaction": "Добавете реакция",
"configured-reactions": "Конфигурирани реакции",
"label": "Бележка",
"reaction-placeholder": "напр. 👍",
"reactions-description": "Определете опциите за реакция, които потребителите могат да прилагат към бележките.",
"remove-reaction": "Премахнете реакцията",
"reactions": "Reactions",
"reactions-required": "Списъкът Reactions не трябва да е празен"
},
"my-account": {
"label": "Моят акаунт"
},
+3 -11
View File
@@ -442,7 +442,9 @@
"layout-list-description": "Una sola columna d'amplada de lectura",
"on-this-memo": "En aquesta nota",
"parent-memo": "Nota principal",
"view-options": "Opcions de visualització"
"view-options": "Opcions de visualització",
"add-reaction": "Afegeix reacció",
"remove-reaction": "Elimina la reacció"
},
"message": {
"archived-successfully": "Arxivat correctament",
@@ -574,16 +576,6 @@
"create-success": "S'ha creat l'usuari",
"update-success": "S'ha actualitzat l'usuari"
},
"memo": {
"label": "Nota",
"reactions": "Reaccions",
"reactions-required": "La llista de reaccions no ha d'estar buida",
"add-reaction": "Afegeix reacció",
"configured-reactions": "Reaccions configurades",
"reaction-placeholder": "p. ex. 👍",
"reactions-description": "Definiu les opcions de reacció que els usuaris poden aplicar a les notes.",
"remove-reaction": "Elimina la reacció"
},
"my-account": {
"label": "El meu compte"
},
+3 -11
View File
@@ -443,7 +443,9 @@
"layout-list-description": "Jeden sloupec na šířku pro čtení",
"on-this-memo": "V této poznámkě",
"parent-memo": "Nadřazená poznámka",
"view-options": "Možnosti zobrazení"
"view-options": "Možnosti zobrazení",
"add-reaction": "Přidejte reakci",
"remove-reaction": "Odstraňte reakci"
},
"message": {
"archived-successfully": "Úspěšně archivováno",
@@ -575,16 +577,6 @@
"create-success": "Uživatel byl vytvořen",
"update-success": "Uživatel byl aktualizován"
},
"memo": {
"label": "Poznámky",
"reactions": "Reakce",
"reactions-required": "Seznam reakcí nesmí být prázdný",
"add-reaction": "Přidejte reakci",
"configured-reactions": "Nastavené reakce",
"reaction-placeholder": "např. 👍",
"reactions-description": "Definujte možnosti reakce, které mohou uživatelé použít na poznámky.",
"remove-reaction": "Odstraňte reakci"
},
"my-account": {
"label": "Můj účet"
},
+3 -11
View File
@@ -479,7 +479,9 @@
"layout-list-description": "En enkelt kolonne med læsebredde",
"on-this-memo": "På dette notat",
"parent-memo": "Overordnet notat",
"view-options": "Visningsmuligheder"
"view-options": "Visningsmuligheder",
"add-reaction": "Tilføj reaktion",
"remove-reaction": "Fjern reaktion"
},
"message": {
"archived-successfully": "Arkiveret",
@@ -654,16 +656,6 @@
"create-success": "Bruger oprettet",
"update-success": "Bruger opdateret"
},
"memo": {
"add-reaction": "Tilføj reaktion",
"configured-reactions": "Konfigurerede reaktioner",
"label": "Memo",
"reaction-placeholder": "f.eks. 👍",
"reactions-description": "Definer de reaktionsmuligheder, som brugere kan anvende på notater.",
"remove-reaction": "Fjern reaktion",
"reactions": "Reactions",
"reactions-required": "Reactions-listen må ikke være tom"
},
"my-account": {
"label": "Min konto"
},
+3 -11
View File
@@ -441,7 +441,9 @@
"layout-list-description": "Eine einzelne Spalte in Lesebreite",
"on-this-memo": "Zu diesem Memo",
"parent-memo": "Übergeordnetes Memo",
"view-options": "Ansichtsoptionen"
"view-options": "Ansichtsoptionen",
"add-reaction": "Reaktion hinzufügen",
"remove-reaction": "Reaktion entfernen"
},
"message": {
"archived-successfully": "Erfolgreich archiviert",
@@ -573,16 +575,6 @@
"create-success": "Benutzer erstellt",
"update-success": "Benutzer aktualisiert"
},
"memo": {
"label": "Notiz",
"reactions": "Reaktionen",
"reactions-required": "Die Reaktionsliste darf nicht leer sein",
"add-reaction": "Reaktion hinzufügen",
"configured-reactions": "Konfigurierte Reaktionen",
"reaction-placeholder": "z.B. 👍",
"reactions-description": "Definieren Sie die Reaktionsoptionen, die Benutzer auf Memos anwenden können.",
"remove-reaction": "Reaktion entfernen"
},
"my-account": {
"label": "Mein Konto"
},
+3 -11
View File
@@ -479,7 +479,9 @@
"layout-list-description": "Μία στήλη πλάτους ανάγνωσης",
"on-this-memo": "Σε αυτό το σημείωμα",
"parent-memo": "Γονικό σημείωμα",
"view-options": "Επιλογές προβολής"
"view-options": "Επιλογές προβολής",
"add-reaction": "Προσθέστε την αντίδραση",
"remove-reaction": "Αφαιρέστε την αντίδραση"
},
"message": {
"archived-successfully": "Αρχειοθετήθηκε με επιτυχία",
@@ -654,16 +656,6 @@
"create-success": "Ο χρήστης δημιουργήθηκε",
"update-success": "Ο χρήστης ενημερώθηκε"
},
"memo": {
"add-reaction": "Προσθέστε την αντίδραση",
"configured-reactions": "Διαμορφωμένες αντιδράσεις",
"label": "Σημείωμα",
"reaction-placeholder": "π.χ. 👍",
"reactions-description": "Καθορίστε τις επιλογές αντίδρασης που μπορούν να εφαρμόσουν οι χρήστες σε σημειώσεις.",
"remove-reaction": "Αφαιρέστε την αντίδραση",
"reactions": "Reactions",
"reactions-required": "Η λίστα Reactions δεν πρέπει να είναι κενή"
},
"my-account": {
"label": "Ο λογαριασμός μου"
},
+3 -11
View File
@@ -441,7 +441,9 @@
"new-badge": "New",
"on-this-memo": "On this memo",
"parent-memo": "Parent memo",
"view-options": "View options"
"view-options": "View options",
"add-reaction": "Add reaction",
"remove-reaction": "Remove reaction"
},
"message": {
"archived-successfully": "Archived successfully",
@@ -573,16 +575,6 @@
"create-success": "User created",
"update-success": "User updated"
},
"memo": {
"label": "Memo",
"reactions": "Reactions",
"reactions-required": "Reactions list must not be empty",
"add-reaction": "Add reaction",
"configured-reactions": "Configured reactions",
"reaction-placeholder": "e.g. 👍",
"reactions-description": "Define the reaction options users can apply to memos.",
"remove-reaction": "Remove reaction"
},
"my-account": {
"label": "My Account"
},
+3 -11
View File
@@ -543,7 +543,9 @@
"public-description": "Anyone, even signed out",
"space": "Members",
"space-description": "Everyone in {{space}}"
}
},
"add-reaction": "Add reaction",
"remove-reaction": "Remove reaction"
},
"message": {
"archived-successfully": "Archived successfully",
@@ -732,16 +734,6 @@
"create-success": "User created",
"update-success": "User updated"
},
"memo": {
"add-reaction": "Add reaction",
"configured-reactions": "Configured reactions",
"label": "Memo",
"reaction-placeholder": "e.g. 👍",
"reactions-description": "Define the reaction options users can apply to memos.",
"remove-reaction": "Remove reaction",
"reactions": "Reactions",
"reactions-required": "Reactions list must not be empty"
},
"memo-export": {
"description": "Move your memos and attachments between Memos instances with a single ZIP file.",
"export-action": "Export memos",
+3 -11
View File
@@ -442,7 +442,9 @@
"layout-list-description": "Una sola columna de ancho de lectura",
"on-this-memo": "En este memo",
"parent-memo": "Memo principal",
"view-options": "Opciones de vista"
"view-options": "Opciones de vista",
"add-reaction": "Añadir reacción",
"remove-reaction": "Eliminar reacción"
},
"message": {
"archived-successfully": "Archivado correctamente",
@@ -574,16 +576,6 @@
"create-success": "Usuario creado",
"update-success": "Usuario actualizado"
},
"memo": {
"label": "Memo",
"reactions": "Reacciones",
"reactions-required": "La lista de reacciones no debe estar vacía.",
"add-reaction": "Añadir reacción",
"configured-reactions": "Reacciones configuradas",
"reaction-placeholder": "p.ej. 👍",
"reactions-description": "Defina las opciones de reacción que los usuarios pueden aplicar a las notas.",
"remove-reaction": "Eliminar reacción"
},
"my-account": {
"label": "Mi cuenta"
},
+3 -11
View File
@@ -479,7 +479,9 @@
"layout-list-description": "Üks lugemislaiusega veerg",
"on-this-memo": "Sellel memo peal",
"parent-memo": "Ülemmemo",
"view-options": "Vaate valikud"
"view-options": "Vaate valikud",
"add-reaction": "Lisa reaktsioon",
"remove-reaction": "Eemaldage reaktsioon"
},
"message": {
"archived-successfully": "Arhiveerimine õnnestus",
@@ -654,16 +656,6 @@
"create-success": "Kasutaja loodud",
"update-success": "Kasutaja uuendatud"
},
"memo": {
"add-reaction": "Lisa reaktsioon",
"configured-reactions": "Konfigureeritud reaktsioonid",
"label": "Memo",
"reaction-placeholder": "nt. 👍",
"reactions-description": "Määratlege reaktsioonivalikud, mida kasutajad saavad memodele rakendada.",
"remove-reaction": "Eemaldage reaktsioon",
"reactions": "Reactions",
"reactions-required": "Reactionsi loend ei tohi olla tühi"
},
"my-account": {
"label": "Minu konto"
},
+3 -11
View File
@@ -436,7 +436,9 @@
"uncheck-all": "انتخاب همه وظایف را بردارید",
"updated": "وظایف به‌روزرسانی شدند"
},
"view-options": "گزینه‌های مشاهده"
"view-options": "گزینه‌های مشاهده",
"add-reaction": "افزودن واکنش",
"remove-reaction": "حذف واکنش"
},
"message": {
"archived-successfully": "با موفقیت آرشیو شد",
@@ -894,16 +896,6 @@
"disallow-user-registration-description": "از ایجاد حساب کاربری توسط کاربران جدید از صفحه ثبت‌نام جلوگیری کنید.",
"week-start-day-description": "اولین روزی که در نماهای تقویم مانند نشان داده می‌شود را کنترل می‌کند."
},
"memo": {
"reactions": "واکنش‌ها",
"label": "یادداشت",
"reactions-required": "لیست واکنش ها نباید خالی باشد",
"add-reaction": "افزودن واکنش",
"configured-reactions": "واکنش‌های پیکربندی شده",
"reaction-placeholder": "مثلاً 👍",
"reactions-description": "گزینه‌های واکنشی را که کاربران می‌توانند برای یادداشت‌ها اعمال کنند، تعریف کنید.",
"remove-reaction": "حذف واکنش"
},
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "نامی آسان برای به خاطر سپردن",
+3 -11
View File
@@ -479,7 +479,9 @@
"layout-list-description": "Yksi lukuleveyden sarake",
"on-this-memo": "Tässä muistiossa",
"parent-memo": "Ylämuistio",
"view-options": "Näytä asetukset"
"view-options": "Näytä asetukset",
"add-reaction": "Lisää reaktio",
"remove-reaction": "Poista reaktio"
},
"message": {
"archived-successfully": "Arkistointi onnistui",
@@ -654,16 +656,6 @@
"create-success": "Käyttäjä luotu",
"update-success": "Käyttäjä päivitetty"
},
"memo": {
"add-reaction": "Lisää reaktio",
"configured-reactions": "Konfiguroidut reaktiot",
"label": "Muistio",
"reaction-placeholder": "esim. 👍",
"reactions-description": "Määritä reaktiovaihtoehdot, joita käyttäjät voivat soveltaa muistioihin.",
"remove-reaction": "Poista reaktio",
"reactions": "Reactions",
"reactions-required": "Reactions-luettelo ei saa olla tyhjä"
},
"my-account": {
"label": "Oma tili"
},
+3 -11
View File
@@ -442,7 +442,9 @@
"layout-list-description": "Une seule colonne de largeur lisible",
"on-this-memo": "Sur ce mémo",
"parent-memo": "Mémo parent",
"view-options": "Options d'affichage"
"view-options": "Options d'affichage",
"add-reaction": "Ajouter une réaction",
"remove-reaction": "Supprimer la réaction"
},
"message": {
"archived-successfully": "Archivé avec succès",
@@ -574,16 +576,6 @@
"create-success": "Utilisateur créé",
"update-success": "Utilisateur mis à jour"
},
"memo": {
"label": "Note",
"reactions": "Réactions",
"reactions-required": "La liste des réactions ne doit pas être vide",
"add-reaction": "Ajouter une réaction",
"configured-reactions": "Réactions configurées",
"reaction-placeholder": "par ex. 👍",
"reactions-description": "Définissez les options de réaction que les utilisateurs peuvent appliquer aux mémos.",
"remove-reaction": "Supprimer la réaction"
},
"my-account": {
"label": "Mon compte"
},
+3 -11
View File
@@ -441,7 +441,9 @@
"layout-list-description": "Unha única columna de ancho de lectura",
"on-this-memo": "Nesta nota",
"parent-memo": "Nota principal",
"view-options": "Ver opcións"
"view-options": "Ver opcións",
"add-reaction": "Engadir reacción",
"remove-reaction": "Eliminar a reacción"
},
"message": {
"archived-successfully": "Arquivada correctamente",
@@ -573,16 +575,6 @@
"create-success": "Usuario creado",
"update-success": "Usuario actualizado"
},
"memo": {
"label": "Memo",
"reactions": "Reaccións",
"reactions-required": "A lista de reaccións non debe estar baleira",
"add-reaction": "Engadir reacción",
"configured-reactions": "Reaccións configuradas",
"reaction-placeholder": "p.ex. 👍",
"reactions-description": "Define as opcións de reacción que os usuarios poden aplicar ás notas.",
"remove-reaction": "Eliminar a reacción"
},
"my-account": {
"label": "A miña conta"
},
+3 -11
View File
@@ -512,7 +512,9 @@
"back-to": "חזרה אל {{source}}",
"connections": "חיבורים",
"on-this-memo": "על תזכיר זה",
"parent-memo": "תזכיר אב"
"parent-memo": "תזכיר אב",
"add-reaction": "הוסף תגובה",
"remove-reaction": "הסר תגובה"
},
"message": {
"archived-successfully": "הועבר לארכיון בהצלחה",
@@ -687,16 +689,6 @@
"create-success": "המשתמש נוצר",
"update-success": "המשתמש עודכן"
},
"memo": {
"add-reaction": "הוסף תגובה",
"configured-reactions": "תגובות שהוגדרו",
"label": "פתק",
"reaction-placeholder": "לדוגמה 👍",
"reactions-description": "הגדירו את אפשרויות התגובה שמשתמשים יכולים להחיל על פתקים.",
"remove-reaction": "הסר תגובה",
"reactions": "תגובות",
"reactions-required": "רשימת התגובות לא יכולה להיות ריקה"
},
"my-account": {
"label": "החשבון שלי"
},
+3 -11
View File
@@ -436,7 +436,9 @@
"uncheck-all": "सभी टास्क अनचेक करें",
"updated": "टास्क अपडेट किए गए"
},
"view-options": "ऑप्शन देखें"
"view-options": "ऑप्शन देखें",
"add-reaction": "रिएक्शन जोड़ें",
"remove-reaction": "रिएक्शन हटाएँ"
},
"message": {
"archived-successfully": "सफलतापूर्वक संग्रहीत किया गया",
@@ -894,16 +896,6 @@
"disallow-user-registration-description": "नए यूज़र्स को साइन-अप पेज से अकाउंट बनाने से रोकें।",
"week-start-day-description": "कैलेंडर-स्टाइल व्यू में दिखाए जाने वाले पहले दिन को कंट्रोल करता है।"
},
"memo": {
"reactions": "प्रतिक्रियाएँ",
"label": "मेमो",
"reactions-required": "प्रतिक्रिया सूची खाली नहीं होनी चाहिए",
"add-reaction": "रिएक्शन जोड़ें",
"configured-reactions": "कॉन्फ़िगर किए गए रिएक्शन",
"reaction-placeholder": "जैसे 👍",
"reactions-description": "उन रिएक्शन ऑप्शन को डिफाइन करें जिन्हें यूज़र्स मेमो पर अप्लाई कर सकते हैं।",
"remove-reaction": "रिएक्शन हटाएँ"
},
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "आसान नाम",
+3 -11
View File
@@ -442,7 +442,9 @@
"layout-list-description": "Jedan stupac širine za čitanje",
"on-this-memo": "Na ovom podsjetniku",
"parent-memo": "Nadređeni podsjetnik",
"view-options": "Opcije prikaza"
"view-options": "Opcije prikaza",
"add-reaction": "Dodajte reakciju",
"remove-reaction": "Ukloni reakciju"
},
"message": {
"archived-successfully": "Uspješno arhivirano",
@@ -574,16 +576,6 @@
"create-success": "Korisnik je stvoren",
"update-success": "Korisnik je ažuriran"
},
"memo": {
"label": "Memo",
"reactions": "Reakcije",
"reactions-required": "Popis reakcija ne smije biti prazan",
"add-reaction": "Dodajte reakciju",
"configured-reactions": "Konfigurirane reakcije",
"reaction-placeholder": "npr. 👍",
"reactions-description": "Definirajte opcije reakcije koje korisnici mogu primijeniti na dopise.",
"remove-reaction": "Ukloni reakciju"
},
"my-account": {
"label": "Moj račun"
},
+3 -11
View File
@@ -441,7 +441,9 @@
"layout-list-description": "Egyetlen olvasási szélességű oszlop",
"on-this-memo": "Ezen a feljegyzésen",
"parent-memo": "Szülő feljegyzés",
"view-options": "Megtekintési beállítások"
"view-options": "Megtekintési beállítások",
"add-reaction": "Adja hozzá a reakciót",
"remove-reaction": "Távolítsa el a reakciót"
},
"message": {
"archived-successfully": "Sikeres archiválás",
@@ -573,16 +575,6 @@
"create-success": "Felhasználó létrehozva",
"update-success": "Felhasználó frissítve"
},
"memo": {
"label": "Jegyzet",
"reactions": "Reakciók",
"reactions-required": "A reakciólista nem lehet üres",
"add-reaction": "Adja hozzá a reakciót",
"configured-reactions": "Konfigurált reakciók",
"reaction-placeholder": "például 👍",
"reactions-description": "Határozza meg azokat a reakciólehetőségeket, amelyeket a felhasználók a jegyzetekre alkalmazhatnak.",
"remove-reaction": "Távolítsa el a reakciót"
},
"my-account": {
"label": "Fiókom"
},
+3 -11
View File
@@ -436,7 +436,9 @@
"uncheck-all": "Hapus centang semua tugas",
"updated": "Tugas diperbarui"
},
"view-options": "Opsi tampilan"
"view-options": "Opsi tampilan",
"add-reaction": "Tambahkan reaksi",
"remove-reaction": "Hapus reaksi"
},
"message": {
"archived-successfully": "Berhasil diarsipkan",
@@ -894,16 +896,6 @@
"disallow-user-registration-description": "Cegah pengguna baru membuat akun dari halaman pendaftaran.",
"week-start-day-description": "Mengontrol hari pertama yang ditampilkan dalam tampilan bergaya kalender."
},
"memo": {
"reactions": "Reaksi",
"label": "Memo",
"reactions-required": "Daftar reaksi wajib diisi",
"add-reaction": "Tambahkan reaksi",
"configured-reactions": "Reaksi yang dikonfigurasi",
"reaction-placeholder": "contoh: 👍",
"reactions-description": "Tentukan opsi reaksi yang dapat diterapkan pengguna pada memo.",
"remove-reaction": "Hapus reaksi"
},
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Nama yang mudah diingat",
+3 -11
View File
@@ -442,7 +442,9 @@
"layout-list-description": "Una singola colonna a larghezza di lettura",
"on-this-memo": "Su questo memo",
"parent-memo": "Memo principale",
"view-options": "Opzioni di visualizzazione"
"view-options": "Opzioni di visualizzazione",
"add-reaction": "Aggiungi reazione",
"remove-reaction": "Rimuovi la reazione"
},
"message": {
"archived-successfully": "Archiviato con successo",
@@ -574,16 +576,6 @@
"create-success": "Utente creato",
"update-success": "Utente aggiornato"
},
"memo": {
"label": "Memo",
"reactions": "Reazioni",
"reactions-required": "L'elenco delle reazioni non deve essere vuoto",
"add-reaction": "Aggiungi reazione",
"configured-reactions": "Reazioni configurate",
"reaction-placeholder": "per esempio. 👍",
"reactions-description": "Definire le opzioni di reazione che gli utenti possono applicare ai promemoria.",
"remove-reaction": "Rimuovi la reazione"
},
"my-account": {
"label": "Il mio account"
},
+3 -11
View File
@@ -441,7 +441,9 @@
"back-to": "{{source}}に戻る",
"connections": "接続",
"on-this-memo": "このメモについて",
"parent-memo": "親メモ"
"parent-memo": "親メモ",
"add-reaction": "リアクションを追加",
"remove-reaction": "反応を取り除く"
},
"message": {
"archived-successfully": "アーカイブが完了しました",
@@ -573,16 +575,6 @@
"create-success": "ユーザーを作成しました",
"update-success": "ユーザーを更新しました"
},
"memo": {
"label": "メモ",
"reactions": "リアクション",
"reactions-required": "リアクションリストは空にできません",
"add-reaction": "リアクションを追加",
"configured-reactions": "設定された反応",
"reaction-placeholder": "例えば 👍",
"reactions-description": "ユーザーがメモに適用できる反応オプションを定義します。",
"remove-reaction": "反応を取り除く"
},
"my-account": {
"label": "アカウント設定"
},
+3 -11
View File
@@ -441,7 +441,9 @@
"layout-list-description": "ერთი წაკითხვის სიგანის სვეტი",
"on-this-memo": "ამ მემოზე",
"parent-memo": "მშობელი მემო",
"view-options": "ნახვის პარამეტრები"
"view-options": "ნახვის პარამეტრები",
"add-reaction": "დაამატეთ რეაქცია",
"remove-reaction": "რეაქციის ამოღება"
},
"message": {
"archived-successfully": "წარმატებით დაარქივდა",
@@ -573,16 +575,6 @@
"create-success": "მომხმარებელი შეიქმნა",
"update-success": "მომხმარებელი განახლდა"
},
"memo": {
"label": "მემო",
"reactions": "რეაქციები",
"reactions-required": "რეაქციების სია არ უნდა იყოს ცარიელი",
"add-reaction": "დაამატეთ რეაქცია",
"configured-reactions": "კონფიგურირებული რეაქციები",
"reaction-placeholder": "მაგ. 👍",
"reactions-description": "განსაზღვრეთ რეაქციის ვარიანტები, რომლებიც მომხმარებლებს შეუძლიათ მიმართონ შენიშვნებზე.",
"remove-reaction": "რეაქციის ამოღება"
},
"my-account": {
"label": "ჩემი ანგარიში"
},
+3 -11
View File
@@ -436,7 +436,9 @@
"uncheck-all": "모든 작업 선택 해제",
"updated": "작업 업데이트됨"
},
"view-options": "보기 옵션"
"view-options": "보기 옵션",
"add-reaction": "반응 추가",
"remove-reaction": "반응 제거"
},
"message": {
"archived-successfully": "성공적으로 보관되었습니다",
@@ -894,16 +896,6 @@
"disallow-user-registration-description": "신규 사용자가 가입 페이지에서 계정을 만들지 못하도록 합니다.",
"week-start-day-description": "캘린더 스타일 보기에서 표시되는 첫 번째 날짜를 제어합니다."
},
"memo": {
"reactions": "반응",
"label": "메모",
"reactions-required": "반응 목록은 비워둘 수 없습니다.",
"add-reaction": "반응 추가",
"configured-reactions": "구성된 반응",
"reaction-placeholder": "예: 👍",
"reactions-description": "사용자가 메모에 적용할 수 있는 반응 옵션을 정의합니다.",
"remove-reaction": "반응 제거"
},
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "기억하기 쉬운 이름",
+3 -11
View File
@@ -481,7 +481,9 @@
"layout-list-description": "Vienas skaitymo pločio stulpelis",
"on-this-memo": "Šiame priminime",
"parent-memo": "Pagrindinis priminimas",
"view-options": "Peržiūros parinktys"
"view-options": "Peržiūros parinktys",
"add-reaction": "Pridėti reakciją",
"remove-reaction": "Pašalinti reakciją"
},
"message": {
"archived-successfully": "Sėkmingai suarchyvuota",
@@ -656,16 +658,6 @@
"create-success": "Vartotojas sukurtas",
"update-success": "Vartotojas atnaujintas"
},
"memo": {
"add-reaction": "Pridėti reakciją",
"configured-reactions": "Sukonfigūruotos reakcijos",
"label": "Atmintinė",
"reaction-placeholder": "pvz. 👍",
"reactions-description": "Apibrėžkite reakcijos parinktis, kurias vartotojai gali pritaikyti atmintinėms.",
"remove-reaction": "Pašalinti reakciją",
"reactions": "Reactions",
"reactions-required": "Reactions sąrašas negali būti tuščias"
},
"my-account": {
"label": "Mano paskyra"
},
+3 -11
View File
@@ -480,7 +480,9 @@
"layout-list-description": "Viena lasīšanas platuma kolonna",
"on-this-memo": "Šajā piezīmē",
"parent-memo": "Galvenā piezīme",
"view-options": "Skata opcijas"
"view-options": "Skata opcijas",
"add-reaction": "Pievienojiet reakciju",
"remove-reaction": "Noņemiet reakciju"
},
"message": {
"archived-successfully": "Veiksmīgi arhivēts",
@@ -655,16 +657,6 @@
"create-success": "Lietotājs izveidots",
"update-success": "Lietotājs atjaunināts"
},
"memo": {
"add-reaction": "Pievienojiet reakciju",
"configured-reactions": "Konfigurētas reakcijas",
"label": "Piezīme",
"reaction-placeholder": "piem. 👍",
"reactions-description": "Definējiet reakcijas opcijas, kuras lietotāji var lietot piezīmēm.",
"remove-reaction": "Noņemiet reakciju",
"reactions": "Reactions",
"reactions-required": "Reactions saraksts nedrīkst būt tukšs"
},
"my-account": {
"label": "Mans konts"
},
+3 -11
View File
@@ -436,7 +436,9 @@
"uncheck-all": "सर्व कार्ये निवड रद्द करा",
"updated": "कार्ये अद्यतनित केली"
},
"view-options": "पाहण्याचे पर्याय"
"view-options": "पाहण्याचे पर्याय",
"add-reaction": "प्रतिक्रिया जोडा",
"remove-reaction": "प्रतिक्रिया काढून टाका"
},
"message": {
"archived-successfully": "यशस्वीरित्या संग्रहित केले",
@@ -894,16 +896,6 @@
"disallow-user-registration-description": "नवीन वापरकर्त्यांना साइन-अप पेजवरून खाती तयार करण्यापासून प्रतिबंधित करा.",
"week-start-day-description": "कॅलेंडर-शैलीतील दृश्यांमध्ये दर्शविल्या जाणाऱ्या पहिल्या दिवसावर नियंत्रण ठेवते."
},
"memo": {
"reactions": "प्रतिक्रिया",
"label": "मेमो",
"reactions-required": "प्रतिक्रियांची यादी रिकामी असू नये",
"add-reaction": "प्रतिक्रिया जोडा",
"configured-reactions": "कॉन्फिगर केलेल्या प्रतिक्रिया",
"reaction-placeholder": "उदा. 👍",
"reactions-description": "वापरकर्ते मेमोंवर लागू करू शकतील असे प्रतिक्रिया पर्याय परिभाषित करा.",
"remove-reaction": "प्रतिक्रिया काढून टाका"
},
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "स्मरणात राहणारे नाव",
+3 -11
View File
@@ -441,7 +441,9 @@
"layout-list-description": "En enkelt kolonne med lesebredde",
"on-this-memo": "På dette notatet",
"parent-memo": "Overordnet notat",
"view-options": "Visningsalternativer"
"view-options": "Visningsalternativer",
"add-reaction": "Legg til reaksjon",
"remove-reaction": "Fjern reaksjonen"
},
"message": {
"archived-successfully": "Arkivering vellykket",
@@ -573,16 +575,6 @@
"create-success": "Bruker opprettet",
"update-success": "Bruker oppdatert"
},
"memo": {
"label": "Memo",
"reactions": "Reaksjoner",
"reactions-required": "Reaksjonslisten må ikke være tom",
"add-reaction": "Legg til reaksjon",
"configured-reactions": "Konfigurerte reaksjoner",
"reaction-placeholder": "f.eks. 👍",
"reactions-description": "Definer reaksjonsalternativene brukere kan bruke på notater.",
"remove-reaction": "Fjern reaksjonen"
},
"my-account": {
"label": "Min konto"
},
+3 -11
View File
@@ -441,7 +441,9 @@
"layout-list-description": "Een enkele kolom met leesbreedte",
"on-this-memo": "In deze memo",
"parent-memo": "Hoofdmemo",
"view-options": "Weergaveopties"
"view-options": "Weergaveopties",
"add-reaction": "Reactie toevoegen",
"remove-reaction": "Reactie verwijderen"
},
"message": {
"archived-successfully": "Succesvol gearchiveerd",
@@ -573,16 +575,6 @@
"create-success": "Gebruiker aangemaakt",
"update-success": "Gebruiker bijgewerkt"
},
"memo": {
"label": "Memo",
"reactions": "Reacties",
"reactions-required": "Reactielijst mag niet leeg zijn",
"add-reaction": "Reactie toevoegen",
"configured-reactions": "Geconfigureerde reacties",
"reaction-placeholder": "bijv. 👍",
"reactions-description": "Definieer de reactieopties die gebruikers op memo's kunnen toepassen.",
"remove-reaction": "Reactie verwijderen"
},
"my-account": {
"label": "Mijn account"
},
+3 -11
View File
@@ -543,7 +543,9 @@
"public-description": "Synleg for alle",
"space": "Medlemer",
"space-description": "Alle i {{space}}"
}
},
"add-reaction": "Legg til reaksjon",
"remove-reaction": "Fjern reaksjon"
},
"message": {
"archived-successfully": "Arkivert",
@@ -732,16 +734,6 @@
"create-success": "Brukaren er oppretta",
"update-success": "Brukaren er oppdatert"
},
"memo": {
"add-reaction": "Legg til reaksjon",
"configured-reactions": "Oppsette reaksjonar",
"label": "Notat",
"reaction-placeholder": "t.d. 👍",
"reactions": "Reaksjonar",
"reactions-description": "Fastset kva reaksjonar brukarane kan leggje til på notat.",
"reactions-required": "Reaksjonslista kan ikkje vera tom",
"remove-reaction": "Fjern reaksjon"
},
"memo-export": {
"description": "Flytt notata og vedlegga dine mellom Memos-instansar med éi ZIP-fil.",
"export-action": "Eksporter notat",
+3 -11
View File
@@ -443,7 +443,9 @@
"layout-list-description": "Pojedyncza kolumna o szerokości odczytu",
"on-this-memo": "W tej notatce",
"parent-memo": "Notatka nadrzędna",
"view-options": "Opcje widoku"
"view-options": "Opcje widoku",
"add-reaction": "Dodaj reakcję",
"remove-reaction": "Usuń reakcję"
},
"message": {
"archived-successfully": "Zarchiwizowano pomyślnie",
@@ -575,16 +577,6 @@
"create-success": "Utworzono użytkownika",
"update-success": "Zaktualizowano użytkownika"
},
"memo": {
"label": "Notatki",
"reactions": "Reakcje",
"reactions-required": "Lista reakcji nie może być pusta",
"add-reaction": "Dodaj reakcję",
"configured-reactions": "Skonfigurowane reakcje",
"reaction-placeholder": "np. 👍",
"reactions-description": "Zdefiniuj opcje reakcji, które użytkownicy mogą zastosować do notatek.",
"remove-reaction": "Usuń reakcję"
},
"my-account": {
"label": "Moje konto"
},
+3 -11
View File
@@ -437,7 +437,9 @@
"uncheck-all": "Desmarcar todas as tarefas",
"updated": "Tarefas atualizadas"
},
"view-options": "Opções de visualização"
"view-options": "Opções de visualização",
"add-reaction": "Adicionar reação",
"remove-reaction": "Remover reação"
},
"message": {
"archived-successfully": "Arquivado com êxito",
@@ -895,16 +897,6 @@
"disallow-user-registration-description": "Impedir que novos usuários criem contas na página de cadastro.",
"week-start-day-description": "Controla o primeiro dia exibido nas visualizações em estilo de calendário."
},
"memo": {
"reactions": "Reações",
"label": "Memo",
"reactions-required": "A lista de reações não deve estar vazia",
"add-reaction": "Adicionar reação",
"configured-reactions": "Reações configuradas",
"reaction-placeholder": "Ex.: 👍",
"reactions-description": "Definir as opções de reação que os usuários podem aplicar aos memorandos.",
"remove-reaction": "Remover reação"
},
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Um nome fácil de lembrar",
+3 -11
View File
@@ -442,7 +442,9 @@
"layout-list-description": "Uma única coluna com uma largura de leitura",
"on-this-memo": "Neste memorando",
"parent-memo": "Memorando pai",
"view-options": "Opções de visualização"
"view-options": "Opções de visualização",
"add-reaction": "Adicionar reação",
"remove-reaction": "Remover reação"
},
"message": {
"archived-successfully": "Arquivado com sucesso",
@@ -574,16 +576,6 @@
"create-success": "Utilizador criado",
"update-success": "Utilizador atualizado"
},
"memo": {
"label": "Memo",
"reactions": "Reações",
"reactions-required": "A lista de reações não deve estar vazia",
"add-reaction": "Adicionar reação",
"configured-reactions": "Reações configuradas",
"reaction-placeholder": "por exemplo 👍",
"reactions-description": "Defina as opções de reação que os usuários podem aplicar aos memorandos.",
"remove-reaction": "Remover reação"
},
"my-account": {
"label": "A Minha Conta"
},
+3 -11
View File
@@ -480,7 +480,9 @@
"layout-list-description": "O singură coloană cu lățime de citire",
"on-this-memo": "Pe această notă",
"parent-memo": "Notă părinte",
"view-options": "Opțiuni de vizualizare"
"view-options": "Opțiuni de vizualizare",
"add-reaction": "Adăugați reacția",
"remove-reaction": "Îndepărtați reacția"
},
"message": {
"archived-successfully": "Arhivat cu succes",
@@ -655,16 +657,6 @@
"create-success": "Utilizator creat",
"update-success": "Utilizator actualizat"
},
"memo": {
"add-reaction": "Adăugați reacția",
"configured-reactions": "Reacții configurate",
"label": "Notă",
"reaction-placeholder": "de ex. 👍",
"reactions-description": "Definiți opțiunile de reacție pe care utilizatorii le pot aplica la memorii.",
"remove-reaction": "Îndepărtați reacția",
"reactions": "Reactions",
"reactions-required": "Lista Reactions nu trebuie să fie goală"
},
"my-account": {
"label": "Contul meu"
},
+3 -11
View File
@@ -443,7 +443,9 @@
"back-to": "Назад к {{source}}",
"connections": "Подключения",
"on-this-memo": "К этой заметке",
"parent-memo": "Родительская заметка"
"parent-memo": "Родительская заметка",
"add-reaction": "Добавить реакцию",
"remove-reaction": "Удалить реакцию"
},
"message": {
"archived-successfully": "Перемещено в архив",
@@ -575,16 +577,6 @@
"create-success": "Пользователь создан",
"update-success": "Пользователь обновлён"
},
"memo": {
"label": "Заметки",
"reactions": "Реакции",
"reactions-required": "Список реакций не должен быть пустым.",
"add-reaction": "Добавить реакцию",
"configured-reactions": "Настроенные реакции",
"reaction-placeholder": "например 👍",
"reactions-description": "Определите параметры реакции, которые пользователи могут применять к заметкам.",
"remove-reaction": "Удалить реакцию"
},
"my-account": {
"label": "Мой аккаунт"
},
+3 -11
View File
@@ -481,7 +481,9 @@
"layout-list-description": "Jeden stĺpec na šírku čítania",
"on-this-memo": "V tejto poznámke",
"parent-memo": "Nadradená poznámka",
"view-options": "Možnosti zobrazenia"
"view-options": "Možnosti zobrazenia",
"add-reaction": "Pridajte reakciu",
"remove-reaction": "Odstráňte reakciu"
},
"message": {
"archived-successfully": "Úspešne archivované",
@@ -656,16 +658,6 @@
"create-success": "Používateľ bol vytvorený",
"update-success": "Používateľ bol aktualizovaný"
},
"memo": {
"add-reaction": "Pridajte reakciu",
"configured-reactions": "Nastavené reakcie",
"label": "Memo",
"reaction-placeholder": "napr. 👍",
"reactions-description": "Definujte možnosti reakcie, ktoré môžu používatelia použiť na poznámky.",
"remove-reaction": "Odstráňte reakciu",
"reactions": "Reactions",
"reactions-required": "Zoznam Reactions nesmie byť prázdny"
},
"my-account": {
"label": "Môj účet"
},
+3 -11
View File
@@ -443,7 +443,9 @@
"layout-list-description": "En sam stolpec za branje",
"on-this-memo": "V tem zapisku",
"parent-memo": "Nadrejeni zapisek",
"view-options": "Možnosti pogleda"
"view-options": "Možnosti pogleda",
"add-reaction": "Dodajte reakcijo",
"remove-reaction": "Odstrani reakcijo"
},
"message": {
"archived-successfully": "Uspešno arhivirano",
@@ -575,16 +577,6 @@
"create-success": "Uporabnik ustvarjen",
"update-success": "Uporabnik posodobljen"
},
"memo": {
"label": "Beležka",
"reactions": "Odzivi",
"reactions-required": "Seznam reakcij ne sme biti prazen",
"add-reaction": "Dodajte reakcijo",
"configured-reactions": "Konfigurirane reakcije",
"reaction-placeholder": "npr. 👍",
"reactions-description": "Določite možnosti odziva, ki jih lahko uporabniki uporabijo za beležke.",
"remove-reaction": "Odstrani reakcijo"
},
"my-account": {
"label": "Moj račun"
},
+3 -11
View File
@@ -480,7 +480,9 @@
"layout-list-description": "Једна колона ширине читања",
"on-this-memo": "На овој поруци",
"parent-memo": "Надређена порука",
"view-options": "Опције приказа"
"view-options": "Опције приказа",
"add-reaction": "Додајте реакцију",
"remove-reaction": "Уклоните реакцију"
},
"message": {
"archived-successfully": "Архивирано је успешно",
@@ -655,16 +657,6 @@
"create-success": "Корисник је направљен",
"update-success": "Корисник је ажуриран"
},
"memo": {
"add-reaction": "Додајте реакцију",
"configured-reactions": "Конфигурисане реакције",
"label": "Мемо",
"reaction-placeholder": "нпр. 👍",
"reactions-description": "Дефинишите опције реакције које корисници могу применити на белешке.",
"remove-reaction": "Уклоните реакцију",
"reactions": "Reactионс",
"reactions-required": "Листа Reactионс не сме бити празна"
},
"my-account": {
"label": "Мој налог"
},
+3 -11
View File
@@ -441,7 +441,9 @@
"layout-list-description": "En enda kolumn med läsbredd",
"on-this-memo": "På detta PM",
"parent-memo": "Överordnat PM",
"view-options": "Visningsalternativ"
"view-options": "Visningsalternativ",
"add-reaction": "Lägg till reaktion",
"remove-reaction": "Ta bort reaktionen"
},
"message": {
"archived-successfully": "Arkiverad framgångsrikt",
@@ -573,16 +575,6 @@
"create-success": "Användaren har skapats",
"update-success": "Användaren har uppdaterats"
},
"memo": {
"label": "Anteckning",
"reactions": "Reaktioner",
"reactions-required": "Reaktionslistan får inte vara tom",
"add-reaction": "Lägg till reaktion",
"configured-reactions": "Konfigurerade reaktioner",
"reaction-placeholder": "till exempel 👍",
"reactions-description": "Definiera reaktionsalternativen som användare kan tillämpa på anteckningar.",
"remove-reaction": "Ta bort reaktionen"
},
"my-account": {
"label": "Mitt konto"
},
+3 -11
View File
@@ -436,7 +436,9 @@
"uncheck-all": "ยกเลิกการเลือกงานทั้งหมด",
"updated": "อัปเดตงานแล้ว"
},
"view-options": "ตัวเลือกการดู"
"view-options": "ตัวเลือกการดู",
"add-reaction": "เพิ่มปฏิกิริยา",
"remove-reaction": "ลบการตอบสนอง"
},
"message": {
"archived-successfully": "เก็บถาวรเรียบร้อยแล้ว",
@@ -894,16 +896,6 @@
"disallow-user-registration-description": "ป้องกันไม่ให้ผู้ใช้ใหม่สร้างบัญชีจากหน้าลงทะเบียน",
"week-start-day-description": "ควบคุมวันแรกที่แสดงในมุมมองแบบปฏิทิน"
},
"memo": {
"reactions": "ปฏิกิริยา",
"label": "บันทึก",
"reactions-required": "รายการความรู้สึกต้องไม่ว่��งเปล่า",
"add-reaction": "เพิ่มปฏิกิริยา",
"configured-reactions": "ปฏิกิริยาที่กำหนดค่าไว้",
"reaction-placeholder": "เช่น 👍",
"reactions-description": "กำหนดตัวเลือกการตอบสนองที่ผู้ใช้สามารถใช้กับบันทึกช่วยจำ",
"remove-reaction": "ลบการตอบสนอง"
},
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "ชื่อที่จำง่าย",
+3 -11
View File
@@ -472,7 +472,9 @@
"check-all": "Tüm görevleri kontrol et",
"uncheck-all": "Tüm görevlerin işaretini kaldırın",
"updated": "Görevler güncellendi"
}
},
"add-reaction": "Tepki ekle",
"remove-reaction": "Reaksiyonu kaldır"
},
"message": {
"archived-successfully": "Başarıyla arşivlendi",
@@ -618,16 +620,6 @@
"create-success": "Kullanıcı oluşturuldu",
"update-success": "Kullanıcı güncellendi"
},
"memo": {
"label": "Not",
"reactions": "Tepkiler",
"reactions-required": "Tepki listesi boş olamaz",
"add-reaction": "Tepki ekle",
"configured-reactions": "Yapılandırılmış reaksiyonlar",
"reaction-placeholder": "örneğin 👍",
"reactions-description": "Kullanıcıların notlara uygulayabileceği reaksiyon seçeneklerini tanımlayın.",
"remove-reaction": "Reaksiyonu kaldır"
},
"memo-export": {
"description": "Notlarınızı ve eklerinizi tek bir ZIP dosyasıyla Memos sunucuları arasında taşıyın.",
"export-action": "Dışa aktar",
+3 -11
View File
@@ -443,7 +443,9 @@
"layout-list-description": "Один стовпець ширини для читання",
"on-this-memo": "У цій нотатці",
"parent-memo": "Батьківська нотатка",
"view-options": "Параметри перегляду"
"view-options": "Параметри перегляду",
"add-reaction": "Додайте реакцію",
"remove-reaction": "Видалити реакцію"
},
"message": {
"archived-successfully": "Архівовано успішно",
@@ -575,16 +577,6 @@
"create-success": "Користувача створено",
"update-success": "Користувача оновлено"
},
"memo": {
"label": "Нотатка",
"reactions": "Реакції",
"reactions-required": "Список реакцій не повинен бути порожнім",
"add-reaction": "Додайте реакцію",
"configured-reactions": "Налаштовані реакції",
"reaction-placeholder": "напр. 👍",
"reactions-description": "Визначте варіанти реакції, які користувачі можуть застосувати до нагадувань.",
"remove-reaction": "Видалити реакцію"
},
"my-account": {
"label": "Мій обліковий запис"
},
+3 -11
View File
@@ -436,7 +436,9 @@
"uncheck-all": "Bỏ chọn tất cả nhiệm vụ",
"updated": "Nhiệm vụ đã được cập nhật"
},
"view-options": "Tùy chọn xem"
"view-options": "Tùy chọn xem",
"add-reaction": "Thêm biểu tượng cảm xúc",
"remove-reaction": "Xóa phản ứng"
},
"message": {
"archived-successfully": "Lưu trữ thành công",
@@ -894,16 +896,6 @@
"disallow-user-registration-description": "Ngăn người dùng mới tạo tài khoản từ trang đăng ký.",
"week-start-day-description": "Kiểm soát ngày đầu tiên được hiển thị trong chế độ xem kiểu lịch."
},
"memo": {
"reactions": "Phản ứng",
"label": "Ghi chú",
"reactions-required": "Danh sách phản ứng không được trống",
"add-reaction": "Thêm biểu tượng cảm xúc",
"configured-reactions": "Biểu tượng cảm xúc đã cấu hình",
"reaction-placeholder": "ví dụ: 👍",
"reactions-description": "Xác định các tùy chọn biểu tượng cảm xúc mà người dùng có thể áp dụng cho ghi chú.",
"remove-reaction": "Xóa phản ứng"
},
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Tên dễ nhớ",
+3 -11
View File
@@ -472,7 +472,9 @@
"parent-load-error": "无法加载原始备忘录。",
"parent-unavailable": "原始备忘录不可用",
"parent-unavailable-description": "它可能已被删除,或者您可能已失去访问权限。",
"moved": "备忘录已移动"
"moved": "备忘录已移动",
"add-reaction": "添加表态",
"remove-reaction": "移除表态"
},
"message": {
"archived-successfully": "归档成功",
@@ -973,16 +975,6 @@
"allow-public-access-description": "允许未登录的访客浏览公开备忘录。即使禁用此功能,共享备忘录的链接仍然可用。",
"allow-public-access": "允许公开访问"
},
"memo": {
"add-reaction": "添加表态",
"configured-reactions": "已配置表态",
"reactions": "表态",
"reaction-placeholder": "例如 👍",
"reactions-description": "定义用户可以添加到备忘录上的表态选项。",
"remove-reaction": "移除表态",
"label": "备忘录",
"reactions-required": "反应列表不能为空"
},
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "请输入一个容易记住的标题",
+3 -11
View File
@@ -520,7 +520,9 @@
"back-to": "返回 {{source}}",
"connections": "關聯",
"on-this-memo": "在此備忘錄中",
"parent-memo": "原始備忘錄"
"parent-memo": "原始備忘錄",
"add-reaction": "新增表情回應",
"remove-reaction": "移除表情回應"
},
"message": {
"archived-successfully": "封存成功",
@@ -695,16 +697,6 @@
"create-success": "已建立使用者",
"update-success": "已更新使用者"
},
"memo": {
"add-reaction": "新增表情回應",
"configured-reactions": "已設定的表情回應",
"label": "備忘錄",
"reaction-placeholder": "例如 👍",
"reactions-description": "定義使用者可以對備忘錄套用的表情回應選項。",
"remove-reaction": "移除表情回應",
"reactions": "表情回應",
"reactions-required": "反應列表不能為空"
},
"my-account": {
"label": "我的帳號"
},
File diff suppressed because one or more lines are too long
+18
View File
@@ -0,0 +1,18 @@
import { describe, expect, it } from "vitest";
import { EMOJI_OPTIONS, findEmoji } from "@/lib/emoji";
import { FULLY_QUALIFIED_EMOJI } from "@/utils/tag-unicode-data";
describe("reaction emoji catalog", () => {
it("includes the complete Unicode emoji set with names", () => {
expect(EMOJI_OPTIONS.map(({ emoji }) => emoji)).toEqual(FULLY_QUALIFIED_EMOJI);
expect(EMOJI_OPTIONS.every(({ name }) => name.length > 0)).toBe(true);
});
it("finds names, aliases, skin tones, flags and pasted sequences", () => {
expect(findEmoji(":thumbsup:").some(({ emoji }) => emoji === "👍")).toBe(true);
expect(findEmoji("tada").some(({ emoji }) => emoji === "🎉")).toBe(true);
expect(findEmoji("medium skin tone thumbs up").some(({ emoji }) => emoji === "👍🏽")).toBe(true);
expect(findEmoji("singapore").map(({ emoji }) => emoji)).toContain("🇸🇬");
expect(findEmoji("👩‍💻").map(({ emoji }) => emoji)).toEqual(["👩‍💻"]);
expect(findEmoji("no-such-emoji")).toEqual([]);
});
});
+1 -1
View File
@@ -114,7 +114,7 @@ describe("instance ACCESS React Query integration", () => {
await waitFor(() => expect(screen.getByTestId("setting-access")).toHaveTextContent(String(InstanceAccessMode.PRIVATE)));
expect(clients.batchGetInstanceSettings).toHaveBeenCalledWith({
names: ["instance/settings/GENERAL", "instance/settings/MEMO_RELATED"],
names: ["instance/settings/GENERAL"],
});
fireEvent.click(screen.getByRole("button", { name: "Make public" }));
+1 -1
View File
@@ -19,7 +19,7 @@ const placeholders = (value: string) =>
const source = flatten(english);
const locales = import.meta.glob<{ default: Messages }>("../src/locales/*.json", { eager: true });
const sourceFiles = import.meta.glob<string>(
["../src/**/*.{ts,tsx}", "!../src/types/proto/**", "!../src/**/*.d.ts", "!../src/**/*.test.{ts,tsx}"],
["../src/**/*.{ts,tsx}", "!../src/types/proto/**", "!../src/lib/emoji-data.ts", "!../src/**/*.d.ts", "!../src/**/*.test.{ts,tsx}"],
{ eager: true, query: "?raw", import: "default" },
);
-78
View File
@@ -1,78 +0,0 @@
import { create } from "@bufbuild/protobuf";
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import MemoRelatedSettings from "@/components/Settings/MemoRelatedSettings";
import {
type ConfigurationStatus,
ConfigurationStatusSchema,
type InstanceSetting,
InstanceSetting_Key,
InstanceSetting_MemoRelatedSettingSchema,
} from "@/types/proto/api/instance_service_pb";
const mocks = vi.hoisted(() => ({
instance: {
memoRelatedSetting: {},
updateSetting: vi.fn(),
fetchSetting: vi.fn(),
},
toastError: vi.fn(),
toastSuccess: vi.fn(),
}));
const configuration = vi.hoisted(() => ({ status: undefined as ConfigurationStatus | undefined }));
vi.mock("@/contexts/InstanceContext", () => ({
useInstance: () => mocks.instance,
}));
vi.mock("@/hooks/useConfigurationQueries", async (importOriginal) => {
const actual = await importOriginal<typeof import("@/hooks/useConfigurationQueries")>();
return {
...actual,
useConfigurationStatus: () => configuration.status,
useManagedResource: (name: string) => actual.findManagedResource(configuration.status, name),
};
});
vi.mock("@/utils/i18n", () => ({
useTranslate: () => (key: string) => key,
}));
vi.mock("@/lib/toast", () => ({ toast: { add: mocks.toastSuccess, close: vi.fn() }, showErrorToast: mocks.toastError }));
describe("<MemoRelatedSettings>", () => {
beforeEach(() => {
mocks.instance.memoRelatedSetting = create(InstanceSetting_MemoRelatedSettingSchema, {
reactions: ["thumbs-up"],
});
mocks.instance.updateSetting.mockReset().mockResolvedValue(undefined);
mocks.instance.fetchSetting.mockReset().mockResolvedValue(undefined);
mocks.toastError.mockReset();
mocks.toastSuccess.mockReset();
configuration.status = undefined;
});
it("saves only the reaction list", async () => {
render(<MemoRelatedSettings />);
expect(screen.queryByRole("switch")).not.toBeInTheDocument();
fireEvent.change(screen.getByPlaceholderText("setting.memo.reaction-placeholder"), { target: { value: "heart" } });
fireEvent.click(screen.getByRole("button", { name: "setting.memo.add-reaction" }));
fireEvent.click(screen.getByRole("button", { name: "common.save" }));
await waitFor(() => expect(mocks.instance.updateSetting).toHaveBeenCalledTimes(1));
const setting = mocks.instance.updateSetting.mock.calls[0][0] as InstanceSetting;
expect(setting.name).toBe("instance/settings/MEMO_RELATED");
if (setting.value.case !== "memoRelatedSetting") throw new Error("Expected memo-related setting");
expect(setting.value.value).toEqual(create(InstanceSetting_MemoRelatedSettingSchema, { reactions: ["thumbs-up", "heart"] }));
expect(mocks.instance.fetchSetting).toHaveBeenCalledWith(InstanceSetting_Key.MEMO_RELATED);
});
it("locks the reactions configuration manages", () => {
configuration.status = create(ConfigurationStatusSchema, {
managedResources: [{ resource: "instance/settings/MEMO_RELATED", source: "memo.json", managedFields: ["*"] }],
});
render(<MemoRelatedSettings />);
expect(screen.getByPlaceholderText("setting.memo.reaction-placeholder")).toBeDisabled();
expect(screen.getByRole("button", { name: "setting.memo.remove-reaction" })).toBeDisabled();
expect(screen.getByText("memo.json")).toBeInTheDocument();
});
});
+76 -71
View File
@@ -1,96 +1,101 @@
import { create } from "@bufbuild/protobuf";
import { QueryClient, QueryClientProvider, useQuery } from "@tanstack/react-query";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { act, renderHook, waitFor } from "@testing-library/react";
import type { ReactNode } from "react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { useReactionActions } from "@/components/MemoReactionListView/hooks";
import { memoDetailQueryOptions, memoKeys, useInfiniteMemos, useMemoByName } from "@/hooks/useMemoQueries";
import { ListMemosResponseSchema, type Memo, MemoSchema, ReactionSchema } from "@/types/proto/api/memo_service_pb";
import { findMemoRecord, memoKeys, useMemoRecord } from "@/hooks/useMemoQueries";
import { ListMemosResponseSchema, type Memo, MemoSchema, type Reaction, ReactionSchema } from "@/types/proto/api/memo_service_pb";
const api = vi.hoisted(() => ({ getMemo: vi.fn(), listMemos: vi.fn(), upsertMemoReaction: vi.fn(), deleteMemoReaction: vi.fn() }));
const api = vi.hoisted(() => ({ getMemo: vi.fn(), upsertMemoReaction: vi.fn(), deleteMemoReaction: vi.fn(), showErrorToast: vi.fn() }));
vi.mock("@/connect", () => ({ memoServiceClient: api }));
vi.mock("@/hooks/useCurrentUser", () => ({ default: () => ({ name: "users/me" }) }));
vi.mock("@/contexts/MentionResolutionContext", () => ({ useResolvedUsersByNames: () => new Map() }));
vi.mock("@/lib/toast", () => ({ showErrorToast: api.showErrorToast }));
const setup = () => {
const client = new QueryClient({ defaultOptions: { queries: { retry: false, retryDelay: 0 }, mutations: { retry: false } } });
const setup = (reactions: Memo["reactions"] = []) => {
const client = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
const memo = create(MemoSchema, { name: "memos/x", reactions });
const listKey = memoKeys.list({});
client.setQueryData(listKey, { pages: [create(ListMemosResponseSchema, { memos: [memo] })], pageParams: [""] });
const wrapper = ({ children }: { children: ReactNode }) => <QueryClientProvider client={client}>{children}</QueryClientProvider>;
return { client, wrapper };
const hook = renderHook(
() => {
const current = useMemoRecord(memo.name) as Memo;
return { memo: current, first: useReactionActions({ memo: current }), second: useReactionActions({ memo: current }) };
},
{ wrapper },
);
return { client, listKey, ...hook };
};
describe("useReactionActions", () => {
beforeEach(() => vi.resetAllMocks());
it("keeps the newer reactions when the first reaction's refetch answers last", async () => {
const { client, wrapper } = setup();
const name = "memos/x";
client.setQueryData(memoKeys.detail(name), create(MemoSchema, { name, reactions: [] }));
// The server's reactions, and the replies to getMemo, each holding the reactions saved when it was asked.
const saved: string[] = [];
const replies: Array<() => void> = [];
api.upsertMemoReaction.mockImplementation(async ({ reaction }: { reaction: { reactionType: string } }) => {
saved.push(reaction.reactionType);
return create(ReactionSchema, { reactionType: reaction.reactionType });
});
api.getMemo.mockImplementation(() => {
const reactions = saved.map((reactionType) => create(ReactionSchema, { reactionType, creator: "users/me" }));
return new Promise<Memo>((done) => replies.push(() => done(create(MemoSchema, { name, reactions }))));
});
// The detail page: the memo's query is observed, and the reaction picker acts on the memo it shows.
const { result } = renderHook(
() => {
const memo = useQuery(memoDetailQueryOptions(name)).data as Memo;
return { memo, actions: useReactionActions({ memo }) };
},
{ wrapper },
);
it("updates list and detail immediately and uses the saved reaction without waiting for a refetch", async () => {
const { result, client, listKey } = setup();
const request = Promise.withResolvers<Reaction>();
api.upsertMemoReaction.mockReturnValue(request.promise);
act(() => {
void result.current.actions.handleReactionClick("👍");
result.current.first.handleReactionClick("👍");
});
await waitFor(() => expect(api.getMemo).toHaveBeenCalledTimes(1));
act(() => {
void result.current.actions.handleReactionClick("❤️");
});
await waitFor(() => expect(api.getMemo).toHaveBeenCalledTimes(2));
await waitFor(() => expect(result.current.memo.reactions).toHaveLength(1));
expect(result.current.first.isPending).toBe(true);
expect(client.getQueryData<{ pages: { memos: Memo[] }[] }>(listKey)?.pages[0].memos[0].reactions).toHaveLength(1);
// The second refetch answers first, then the first one, which only knows about 👍.
await act(async () => replies[1]());
await act(async () => replies[0]());
await waitFor(() => expect(client.isFetching()).toBe(0));
expect(saved).toEqual(["👍", "❤️"]);
expect(result.current.memo.reactions.map((reaction) => reaction.reactionType)).toEqual(["👍", "❤️"]);
const saved = create(ReactionSchema, { name: "memos/x/reactions/1", creator: "users/me", reactionType: "👍" });
await act(async () => request.resolve(saved));
await waitFor(() => expect(result.current.first.isPending).toBe(false));
expect(findMemoRecord(client, "memos/x")?.reactions).toEqual([saved]);
expect(api.getMemo).not.toHaveBeenCalled();
});
it("shows a reaction on a card in a list without waiting for the list's refetch", async () => {
const { client, wrapper } = setup();
const name = "memos/x";
const listed = create(MemoSchema, { name, reactions: [] });
client.setQueryData(memoKeys.list({}), { pages: [create(ListMemosResponseSchema, { memos: [listed] })], pageParams: [""] });
api.upsertMemoReaction.mockImplementation(async ({ reaction }: { reaction: { reactionType: string } }) =>
create(ReactionSchema, { reactionType: reaction.reactionType }),
);
api.getMemo.mockResolvedValue(create(MemoSchema, { name, reactions: [{ reactionType: "👍", creator: "users/me" }] }));
// The list's refetch is slow: every loaded page is fetched again before any of them shows.
api.listMemos.mockImplementation(() => new Promise(() => {}));
// A card: the memo is the list's copy, and the card's own detail query is disabled.
const { result } = renderHook(
() => {
useInfiniteMemos();
const memo = useMemoByName(name).data as Memo;
return { memo, actions: useReactionActions({ memo }) };
},
{ wrapper },
);
expect(result.current.memo).toBe(listed);
await act(async () => {
await result.current.actions.handleReactionClick("👍");
it("blocks overlapping clicks across pickers and pills for the same memo", async () => {
const { result } = setup();
const request = Promise.withResolvers<Reaction>();
api.upsertMemoReaction.mockReturnValue(request.promise);
act(() => {
expect(result.current.first.handleReactionClick("👍")).toBe(true);
expect(result.current.second.handleReactionClick("👍")).toBe(false);
expect(result.current.second.handleReactionClick("❤️")).toBe(false);
});
await waitFor(() => expect(api.upsertMemoReaction).toHaveBeenCalledTimes(1));
await act(async () => request.resolve(create(ReactionSchema, { creator: "users/me", reactionType: "👍" })));
});
expect(api.getMemo).toHaveBeenCalledTimes(1);
expect(api.listMemos).toHaveBeenCalledTimes(1);
expect(result.current.memo.reactions.map((reaction) => reaction.reactionType)).toEqual(["👍"]);
it("rolls back a failed add and reports it while keeping unrelated new reactions", async () => {
const { result, client } = setup();
const request = Promise.withResolvers<never>();
api.upsertMemoReaction.mockReturnValue(request.promise);
act(() => {
result.current.first.handleReactionClick("👍");
});
await waitFor(() => expect(result.current.memo.reactions).toHaveLength(1));
const incoming = create(ReactionSchema, { name: "memos/x/reactions/2", creator: "users/other", reactionType: "❤️" });
act(() =>
client.setQueryData(memoKeys.detail("memos/x"), { ...result.current.memo, reactions: [...result.current.memo.reactions, incoming] }),
);
const logged = vi.spyOn(console, "error").mockImplementation(() => {});
await act(async () => request.reject(new Error("Request failed")));
await waitFor(() => expect(api.showErrorToast).toHaveBeenCalledWith("Request failed"));
expect(result.current.memo.reactions).toEqual([incoming]);
logged.mockRestore();
});
it("removes an existing reaction optimistically and restores it on failure", async () => {
const existing = create(ReactionSchema, { name: "memos/x/reactions/1", creator: "users/me", reactionType: "👍" });
const { result } = setup([existing]);
const request = Promise.withResolvers<never>();
api.deleteMemoReaction.mockReturnValue(request.promise);
act(() => {
result.current.first.handleReactionClick("👍");
});
await waitFor(() => expect(result.current.memo.reactions).toHaveLength(0));
expect(api.deleteMemoReaction).toHaveBeenCalledWith({ name: existing.name });
const logged = vi.spyOn(console, "error").mockImplementation(() => {});
await act(async () => request.reject(new Error("Delete failed")));
await waitFor(() => expect(result.current.memo.reactions).toEqual([existing]));
expect(api.showErrorToast).toHaveBeenCalledWith("Delete failed");
logged.mockRestore();
});
});
+71
View File
@@ -0,0 +1,71 @@
import { create } from "@bufbuild/protobuf";
import { fireEvent, render, screen, waitFor, within } from "@testing-library/react";
import { Tooltip } from "@usememos/ui";
import { beforeEach, describe, expect, it, vi } from "vitest";
import ReactionSelector from "@/components/MemoReactionListView/ReactionSelector";
import { findEmoji } from "@/lib/emoji";
import { MemoSchema } from "@/types/proto/api/memo_service_pb";
const actions = vi.hoisted(() => ({ handleReactionClick: vi.fn(), hasReacted: () => false, isPending: false, canReact: true }));
vi.mock("@/components/MemoReactionListView/hooks", () => ({ useReactionActions: () => actions }));
vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key }));
const setup = async () => {
render(
<Tooltip.Provider>
<ReactionSelector memo={create(MemoSchema, { name: "memos/1" })} />
</Tooltip.Provider>,
);
fireEvent.click(screen.getByRole("button", { name: "memo.add-reaction" }));
const picker = within(await screen.findByRole("dialog"));
return { picker, search: picker.getByRole("combobox"), grid: picker.getByRole("grid") };
};
const activeCell = (search: HTMLElement) => document.getElementById(search.getAttribute("aria-activedescendant") ?? "");
describe("ReactionSelector with the full emoji catalog", () => {
beforeEach(() => {
actions.handleReactionClick.mockReset().mockReturnValue(true);
});
it("renders a bounded window, reaches the last emoji by scrolling, and resets after search", async () => {
const { picker, search, grid } = await setup();
const options = findEmoji("");
expect(options.length).toBeGreaterThan(3000);
expect(picker.getAllByRole("gridcell").length).toBeLessThan(130);
expect(grid).toHaveAttribute("aria-rowcount", String(Math.ceil(options.length / 8)));
fireEvent.scroll(grid, { target: { scrollTop: (options.length / 8) * 34 } });
const last = options.at(-1)!;
expect(picker.getByRole("gridcell", { name: last.name })).toHaveTextContent(last.emoji);
expect(picker.getAllByRole("gridcell").length).toBeLessThan(130);
fireEvent.change(search, { target: { value: "phoenix" } });
expect(grid.scrollTop).toBe(0);
expect(picker.getAllByRole("gridcell")).toHaveLength(1);
expect(picker.getByRole("gridcell", { name: "phoenix" })).toHaveTextContent("🐦‍🔥");
fireEvent.change(search, { target: { value: "" } });
expect(picker.getByRole("gridcell", { name: options[0].name })).toBeInTheDocument();
expect(picker.getAllByRole("gridcell").length).toBeLessThan(130);
});
it("keeps keyboard navigation and selection working beyond the mounted window", async () => {
const { search, grid } = await setup();
fireEvent.keyDown(search, { key: "ArrowDown" });
await waitFor(() => expect(activeCell(search)).toHaveAttribute("aria-label", findEmoji("")[0].name));
for (let row = 0; row < 20; row++) fireEvent.keyDown(search, { key: "ArrowDown" });
fireEvent.keyDown(search, { key: "ArrowRight" });
const option = findEmoji("")[20 * 8 + 1];
expect(activeCell(search)).toHaveAttribute("aria-label", option.name);
expect(grid.scrollTop).toBeGreaterThan(0);
fireEvent.scroll(grid, { target: { scrollTop: 10000 } });
expect(activeCell(search)).toHaveAttribute("aria-label", option.name);
fireEvent.keyDown(search, { key: "ArrowDown" });
const next = findEmoji("")[21 * 8 + 1];
expect(activeCell(search)).toHaveAttribute("aria-label", next.name);
fireEvent.keyDown(search, { key: "Enter" });
expect(actions.handleReactionClick).toHaveBeenCalledWith(next.emoji);
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
});
});
+149 -130
View File
@@ -1,5 +1,5 @@
import { create } from "@bufbuild/protobuf";
import { QueryClient, QueryClientProvider, useQuery } from "@tanstack/react-query";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
import { Button, Tooltip } from "@usememos/ui";
import { SmilePlusIcon } from "lucide-react";
@@ -7,29 +7,41 @@ import type { ReactElement } from "react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import MemoReactionListView from "@/components/MemoReactionListView/MemoReactionListView";
import ReactionSelector from "@/components/MemoReactionListView/ReactionSelector";
import { memoDetailQueryOptions, memoKeys } from "@/hooks/useMemoQueries";
import { memoKeys, useMemoRecord } from "@/hooks/useMemoQueries";
import { State } from "@/types/proto/api/common_pb";
import { MemoSchema, ReactionSchema } from "@/types/proto/api/memo_service_pb";
import { type Memo, MemoSchema, type Reaction, ReactionSchema } from "@/types/proto/api/memo_service_pb";
import { SpaceMember_Role } from "@/types/proto/api/space_service_pb";
import { UserSchema } from "@/types/proto/api/user_service_pb";
const state = vi.hoisted(() => ({
currentUser: { name: "users/me", username: "me" } as { name: string; username: string } | undefined,
api: { getMemo: vi.fn(), upsertMemoReaction: vi.fn(), deleteMemoReaction: vi.fn() },
resolveUsers: true,
role: 0,
api: { getMemo: vi.fn(), upsertMemoReaction: vi.fn(), deleteMemoReaction: vi.fn(), showErrorToast: vi.fn() },
}));
vi.mock("@/connect", () => ({ memoServiceClient: state.api }));
vi.mock("@/hooks/useCurrentUser", () => ({ default: () => state.currentUser }));
vi.mock("@/hooks/useSpaceQueries", () => ({ useSpaces: () => ({ data: [{ name: "spaces/a", currentUserRole: state.role }] }) }));
vi.mock("@/lib/toast", () => ({ showErrorToast: state.api.showErrorToast }));
vi.mock("@/contexts/MentionResolutionContext", () => ({
useResolvedUsersByNames: () =>
new Map([
["users/me", create(UserSchema, { name: "users/me", username: "me" })],
["users/other", create(UserSchema, { name: "users/other", username: "other" })],
]),
state.resolveUsers
? new Map([
["users/me", create(UserSchema, { name: "users/me", username: "me" })],
["users/other", create(UserSchema, { name: "users/other", username: "other" })],
])
: new Map(),
}));
vi.mock("@/contexts/InstanceContext", () => ({
useInstance: () => ({ memoRelatedSetting: { reactions: ["👍", "🎉", "❤️"] } }),
vi.mock("@/lib/emoji-data", () => ({
EMOJI: [
["👍", "thumbs up"],
["🎉", "party popper"],
["❤️", "red heart"],
["🦊", "fox"],
["👍🏽", "thumbs up: medium skin tone"],
],
}));
vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key }));
vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key, translate: (key: string) => key }));
const reactionMemo = () =>
create(MemoSchema, {
@@ -44,10 +56,8 @@ const reactionMemo = () =>
const setup = (memo = reactionMemo(), trigger?: ReactElement) => {
const client = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
client.setQueryData(memoKeys.detail(memo.name), memo);
state.api.getMemo.mockResolvedValue(memo);
const Surface = () => {
const { data } = useQuery({ ...memoDetailQueryOptions(memo.name), staleTime: Infinity });
if (!data) return null;
const data = useMemoRecord(memo.name) as Memo;
return trigger ? <ReactionSelector memo={data} trigger={trigger} /> : <MemoReactionListView memo={data} reactions={data.reactions} />;
};
return render(
@@ -59,138 +69,133 @@ const setup = (memo = reactionMemo(), trigger?: ReactElement) => {
</QueryClientProvider>,
);
};
const openPicker = async () => {
fireEvent.click(screen.getByRole("button", { name: "setting.memo.add-reaction" }));
return within(await screen.findByRole("dialog", { name: "setting.memo.add-reaction" }));
};
const openPickerWithMouse = () => {
const trigger = screen.getByRole("button", { name: "setting.memo.add-reaction" });
fireEvent.pointerDown(trigger, { pointerType: "mouse", button: 0 });
fireEvent.mouseDown(trigger, { button: 0 });
trigger.focus();
fireEvent.pointerUp(trigger, { pointerType: "mouse", button: 0 });
fireEvent.mouseUp(trigger, { button: 0 });
fireEvent.click(trigger, { detail: 1 });
fireEvent.click(screen.getByRole("button", { name: "memo.add-reaction" }));
return within(await screen.findByRole("dialog", { name: "memo.add-reaction" }));
};
describe("ReactionSelector", () => {
beforeEach(() => {
vi.resetAllMocks();
state.currentUser = { name: "users/me", username: "me" };
state.resolveUsers = true;
state.role = 0;
});
it("focuses the panel when opened with a mouse, leaving emoji choices unfocused", async () => {
it("focuses search, filters by name or pasted emoji, and shows a no-results state", async () => {
setup();
openPickerWithMouse();
const popup = await screen.findByRole("dialog", { name: "setting.memo.add-reaction" });
await waitFor(() => expect(popup).toHaveFocus());
});
it("focuses the first choice for keyboard opening and the panel when subsequently reopened with a mouse", async () => {
setup();
const trigger = screen.getByRole("button", { name: "setting.memo.add-reaction" });
trigger.focus();
fireEvent.keyDown(trigger, { key: "Enter" });
fireEvent.click(trigger, { detail: 0 });
fireEvent.keyUp(trigger, { key: "Enter" });
const popup = await screen.findByRole("dialog", { name: "setting.memo.add-reaction" });
await waitFor(() => expect(within(popup).getByRole("button", { name: "👍" })).toHaveFocus());
fireEvent.keyDown(popup, { key: "Escape" });
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
expect(trigger).toHaveFocus();
openPickerWithMouse();
await waitFor(() => expect(screen.getByRole("dialog")).toHaveFocus());
});
it("shows configured choices and shares the current user's pressed state with the strip", async () => {
setup();
expect(screen.getByRole("button", { name: /🎉\s*1/ })).toHaveAttribute("aria-pressed", "true");
expect(screen.getByRole("button", { name: /👍\s*1/ })).toHaveAttribute("aria-pressed", "false");
const picker = await openPicker();
expect(picker.getAllByRole("button")).toHaveLength(3);
expect(picker.getByRole("button", { name: "🎉" })).toHaveAttribute("aria-pressed", "true");
expect(picker.getByRole("button", { name: "👍" })).toHaveAttribute("aria-pressed", "false");
expect(picker.getByRole("button", { name: "❤️" })).toBeInTheDocument();
const search = picker.getByRole("combobox");
await waitFor(() => expect(search).toHaveFocus());
expect(picker.getByRole("gridcell", { name: "party popper" })).toHaveAttribute("aria-selected", "true");
fireEvent.change(search, { target: { value: "fox" } });
expect(picker.getAllByRole("gridcell")).toHaveLength(1);
expect(picker.getByRole("gridcell", { name: "fox" })).toBeInTheDocument();
fireEvent.change(search, { target: { value: "👍🏽" } });
expect(picker.getByRole("gridcell", { name: "thumbs up: medium skin tone" })).toBeInTheDocument();
fireEvent.change(search, { target: { value: "no such emoji" } });
expect(picker.queryByRole("gridcell")).not.toBeInTheDocument();
expect(picker.getByText("space.icon.no-results")).toBeVisible();
});
it("updates the strip after a successful request, closes, and shows the saved choice when reopened", async () => {
const memo = reactionMemo();
setup(memo);
state.api.getMemo.mockResolvedValue(
create(MemoSchema, { ...memo, reactions: [...memo.reactions, create(ReactionSchema, { reactionType: "👍", creator: "users/me" })] }),
it("keeps accessible emoji names and actions without native tooltips or a preview footer", async () => {
setup();
const picker = await openPicker();
const search = picker.getByRole("combobox");
for (const cell of picker.getAllByRole("gridcell")) expect(cell).not.toHaveAttribute("title");
const heart = picker.getByRole("gridcell", { name: "red heart" });
expect(heart).toHaveAccessibleDescription("memo.add-reaction");
expect(picker.getByRole("gridcell", { name: "party popper" })).toHaveAccessibleDescription("memo.remove-reaction");
fireEvent.mouseMove(heart);
expect(picker.queryByText("red heart")).not.toBeInTheDocument();
fireEvent.keyDown(search, { key: "ArrowRight" });
expect(document.getElementById(search.getAttribute("aria-activedescendant")!)).toHaveAccessibleName("party popper");
expect(picker.queryByText("party popper")).not.toBeInTheDocument();
expect(picker.queryByText("memo.add-reaction")).not.toBeInTheDocument();
});
it("selects with the keyboard, closes immediately and updates the strip during a slow request", async () => {
setup();
const request = Promise.withResolvers<Reaction>();
state.api.upsertMemoReaction.mockReturnValue(request.promise);
const picker = await openPicker();
const search = picker.getByRole("combobox");
fireEvent.change(search, { target: { value: "fox" } });
fireEvent.keyDown(search, { key: "ArrowDown" });
fireEvent.keyDown(search, { key: "Enter" });
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
expect(screen.getByRole("button", { name: "memo.add-reaction" })).toHaveFocus();
await waitFor(() => expect(screen.getByRole("button", { name: /fox: 1/ })).toHaveAttribute("aria-pressed", "true"));
expect(state.api.upsertMemoReaction).toHaveBeenCalledWith({ parent: "memos/1", reaction: { reactionType: "🦊" } });
expect(screen.getByRole("button", { name: "memo.add-reaction" })).toHaveAttribute("aria-disabled", "true");
await act(async () =>
request.resolve(create(ReactionSchema, { name: "memos/1/reactions/3", creator: "users/me", reactionType: "🦊" })),
);
const request = Promise.withResolvers<void>();
state.api.upsertMemoReaction.mockReturnValue(request.promise);
const picker = await openPicker();
fireEvent.click(picker.getByRole("button", { name: "👍" }));
expect(state.api.upsertMemoReaction).toHaveBeenCalledWith({ parent: memo.name, reaction: { reactionType: "👍" } });
expect(screen.getByRole("dialog")).toBeInTheDocument();
await act(async () => request.resolve());
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
expect(screen.getByRole("button", { name: "setting.memo.add-reaction" })).toHaveFocus();
expect(screen.getByRole("button", { name: /👍\s*2/ })).toHaveAttribute("aria-pressed", "true");
expect((await openPicker()).getByRole("button", { name: "👍" })).toHaveAttribute("aria-pressed", "true");
await waitFor(() => expect(screen.getByRole("button", { name: "memo.add-reaction" })).toHaveAttribute("aria-disabled", "false"));
expect((await openPicker()).getByRole("gridcell", { name: "fox" })).toHaveAttribute("aria-selected", "true");
});
it("removes an existing reaction and closes after the request completes", async () => {
const memo = reactionMemo();
setup(memo);
state.api.getMemo.mockResolvedValue(create(MemoSchema, { ...memo, reactions: memo.reactions.filter((r) => r.creator !== "users/me") }));
fireEvent.click((await openPicker()).getByRole("button", { name: "🎉" }));
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
expect(state.api.deleteMemoReaction).toHaveBeenCalledExactlyOnceWith({ name: "memos/1/reactions/1" });
expect(screen.queryByRole("button", { name: /🎉\s*1/ })).not.toBeInTheDocument();
expect((await openPicker()).getByRole("button", { name: "🎉" })).toHaveAttribute("aria-pressed", "false");
});
it("preserves the existing failure behavior: closes without changing saved reactions", async () => {
it("removes an existing reaction from the picker", async () => {
setup();
state.api.upsertMemoReaction.mockRejectedValue(new Error("Request failed"));
fireEvent.click((await openPicker()).getByRole("button", { name: "👍" }));
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
expect(screen.getByRole("button", { name: "setting.memo.add-reaction" })).toHaveFocus();
expect(state.api.getMemo).not.toHaveBeenCalled();
expect(screen.getByRole("button", { name: /👍\s*1/ })).toHaveAttribute("aria-pressed", "false");
expect((await openPicker()).getByRole("button", { name: "👍" })).toHaveAttribute("aria-pressed", "false");
fireEvent.click((await openPicker()).getByRole("gridcell", { name: "party popper" }));
await waitFor(() => expect(state.api.deleteMemoReaction).toHaveBeenCalledWith({ name: "memos/1/reactions/1" }));
expect(screen.queryByRole("button", { name: /party popper:/ })).not.toBeInTheDocument();
});
it.each(["success", "failure"])("keeps editing focus when a dismissed picker's slow request ends in %s", async (outcome) => {
it("reports failure, restores the reaction and leaves editing focus alone", async () => {
setup();
const request = Promise.withResolvers<void>();
const request = Promise.withResolvers<never>();
state.api.upsertMemoReaction.mockReturnValue(request.promise);
const picker = await openPicker();
const choice = picker.getByRole("button", { name: "👍" });
choice.focus();
fireEvent.click(choice);
expect(state.api.upsertMemoReaction).toHaveBeenCalledTimes(1);
fireEvent.click((await openPicker()).getByRole("gridcell", { name: "fox" }));
await waitFor(() => expect(screen.getByRole("button", { name: /fox: 1/ })).toBeInTheDocument());
const editor = screen.getByRole("textbox", { name: "Memo draft" });
fireEvent.pointerDown(editor, { pointerType: "mouse", button: 0 });
editor.focus();
fireEvent.pointerUp(editor, { pointerType: "mouse", button: 0 });
fireEvent.click(editor);
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
expect(editor).toHaveFocus();
fireEvent.change(editor, { target: { value: "Continue editing" } });
await act(async () => {
if (outcome === "success") request.resolve();
else request.reject(new Error("Request failed"));
await request.promise.catch(() => {});
});
const logged = vi.spyOn(console, "error").mockImplementation(() => {});
await act(async () => request.reject(new Error("Request failed")));
await waitFor(() => expect(state.api.showErrorToast).toHaveBeenCalledWith("Request failed"));
expect(screen.queryByRole("button", { name: /fox: 1/ })).not.toBeInTheDocument();
expect(editor).toHaveFocus();
expect(editor).toHaveValue("Continue editing");
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
logged.mockRestore();
});
it("keeps counts and names when profile lookup is unavailable", () => {
state.resolveUsers = false;
setup();
expect(screen.getByRole("button", { name: /party popper: 1 · me/ })).toHaveAttribute("aria-pressed", "true");
expect(screen.getByRole("button", { name: /thumbs up: 1 · other/ })).toBeInTheDocument();
});
it("keeps a focused pill mounted when its count changes", async () => {
setup();
const pill = screen.getByRole("button", { name: /thumbs up: 1/ });
const request = Promise.withResolvers<Reaction>();
state.api.upsertMemoReaction.mockReturnValue(request.promise);
pill.focus();
fireEvent.click(pill);
await waitFor(() => expect(screen.getByRole("button", { name: /thumbs up: 2/ })).toBe(pill));
expect(pill).toHaveFocus();
await act(async () => request.resolve(create(ReactionSchema, { creator: "users/me", reactionType: "👍" })));
expect(pill).toHaveFocus();
});
it("shows participants on touch long-press without toggling the reaction", async () => {
vi.useFakeTimers();
try {
setup();
const pill = screen.getByRole("button", { name: /thumbs up: 1/ });
fireEvent.pointerDown(pill, { pointerType: "touch" });
await act(async () => vi.advanceTimersByTimeAsync(550));
expect(screen.getByText("other")).toBeVisible();
fireEvent.pointerUp(pill, { pointerType: "touch" });
fireEvent.click(pill);
expect(state.api.upsertMemoReaction).not.toHaveBeenCalled();
expect(state.api.deleteMemoReaction).not.toHaveBeenCalled();
} finally {
vi.useRealTimers();
}
});
it.each(["signed out", "archived"])("keeps reactions non-interactive when %s", (mode) => {
@@ -198,21 +203,35 @@ describe("ReactionSelector", () => {
if (mode === "signed out") state.currentUser = undefined;
else memo.state = State.ARCHIVED;
setup(memo);
expect(screen.queryByRole("button")).not.toBeInTheDocument();
expect(screen.getByText("🎉").closest("button, [role=button], [tabindex]")).toBeNull();
expect(screen.getByText("👍")).toBeInTheDocument();
expect(state.api.upsertMemoReaction).not.toHaveBeenCalled();
expect(screen.getByText("🎉")).toBeInTheDocument();
});
it("keeps the header's supplied trigger and returns focus after Escape", async () => {
it("hides the picker for a Space outsider but lets them withdraw their existing reaction", async () => {
const memo = reactionMemo();
memo.space = "spaces/a";
setup(memo);
expect(screen.queryByRole("button", { name: "memo.add-reaction" })).not.toBeInTheDocument();
expect(screen.queryByRole("button", { name: /thumbs up:/ })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: /party popper:/ }));
await waitFor(() => expect(state.api.deleteMemoReaction).toHaveBeenCalledWith({ name: "memos/1/reactions/1" }));
});
it("offers the picker to an active Space member", async () => {
state.role = SpaceMember_Role.USER;
const memo = reactionMemo();
memo.space = "spaces/a";
setup(memo);
expect((await openPicker()).getByRole("combobox")).toBeInTheDocument();
});
it("keeps a supplied header trigger and returns focus after Escape", async () => {
setup(reactionMemo(), <Button variant="ghost" size="sm" icon={<SmilePlusIcon />} data-testid="header-trigger" />);
const trigger = screen.getByRole("button", { name: "setting.memo.add-reaction" });
const trigger = screen.getByRole("button", { name: "memo.add-reaction" });
expect(trigger).toBe(screen.getByTestId("header-trigger"));
trigger.focus();
await openPicker();
fireEvent.keyDown(screen.getByRole("dialog"), { key: "Escape" });
fireEvent.keyDown(screen.getByRole("combobox"), { key: "Escape" });
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
await waitFor(() => expect(trigger).toHaveFocus());
expect(trigger).toHaveFocus();
});
});
+1
View File
@@ -50,6 +50,7 @@ describe("type roles", () => {
"components/AppSidebar/ViewsSection.tsx",
"components/CustomIconPicker.tsx",
"components/MemoFilters.tsx",
"components/MemoReactionListView/ReactionSelector.tsx",
"components/SpaceIcon.tsx",
"components/SpaceMark.tsx",
"pages/MemoViews.tsx",