Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: remove unused user id
Steven8b7e9f544340
diff --git a/proto/api/v1/inbox_service.proto b/proto/api/v1/inbox_service.protoindex f916c0fa8..2541281fa 100644--- a/proto/api/v1/inbox_service.proto+++ b/proto/api/v1/inbox_service.proto@@ -34,9 +34,9 @@ message Inbox {// The name of the inbox.// Format: inboxes/{id}string name = 1;- // Format: users/{id}+ // Format: users/{user}string sender = 2;- // Format: users/{id}+ // Format: users/{user}string receiver = 3;enum Status {@@ -59,7 +59,7 @@ message Inbox {}message ListInboxesRequest {- // Format: users/{id}+ // Format: users/{user}string user = 1;// The maximum number of inbox to return.diff --git a/proto/api/v1/memo_service.proto b/proto/api/v1/memo_service.protoindex ca395b73c..8fe942ef2 100644--- a/proto/api/v1/memo_service.proto+++ b/proto/api/v1/memo_service.proto@@ -140,7 +140,7 @@ message Memo {State state = 3;// The name of the creator.- // Format: users/{id}+ // Format: users/{user}string creator = 4;google.protobuf.Timestamp create_time = 5;@@ -222,7 +222,7 @@ message ListMemosRequest {string page_token = 2;// Filter is used to filter memos returned in the list.- // Format: "creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']"+ // Format: "creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']"string filter = 3;// The view of the memo.diff --git a/proto/api/v1/reaction_service.proto b/proto/api/v1/reaction_service.protoindex c16df1d1f..7283fddb9 100644--- a/proto/api/v1/reaction_service.proto+++ b/proto/api/v1/reaction_service.proto@@ -8,7 +8,7 @@ message Reaction {int32 id = 1;// The name of the creator.- // Format: users/{id}+ // Format: users/{user}string creator = 2;string content_id = 3;diff --git a/proto/api/v1/user_service.proto b/proto/api/v1/user_service.protoindex cb782b6c2..ab1144aa1 100644--- a/proto/api/v1/user_service.proto+++ b/proto/api/v1/user_service.proto@@ -88,12 +88,9 @@ service UserService {message User {// The name of the user.- // Format: users/{id}+ // Format: users/{user}. {user} is a system-generated auto-increment id.string name = 1;- // The system generated uid of the user.- int32 id = 2;-enum Role {ROLE_UNSPECIFIED = 0;HOST = 1;@@ -139,13 +136,13 @@ message SearchUsersResponse {message GetUserRequest {// The name of the user.- // Format: users/{id}+ // Format: users/{user}string name = 1;}message GetUserAvatarBinaryRequest {// The name of the user.- // Format: users/{id}+ // Format: users/{user}string name = 1;// The raw HTTP body is bound to this field.@@ -164,13 +161,13 @@ message UpdateUserRequest {message DeleteUserRequest {// The name of the user.- // Format: users/{id}+ // Format: users/{user}string name = 1;}message UserSetting {// The name of the user.- // Format: users/{id}+ // Format: users/{user}string name = 1;// The preferred locale of the user.string locale = 2;@@ -182,7 +179,7 @@ message UserSetting {message GetUserSettingRequest {// The name of the user.- // Format: users/{id}+ // Format: users/{user}string name = 1;}@@ -201,7 +198,7 @@ message UserAccessToken {message ListUserAccessTokensRequest {// The name of the user.- // Format: users/{id}+ // Format: users/{user}string name = 1;}@@ -211,7 +208,7 @@ message ListUserAccessTokensResponse {message CreateUserAccessTokenRequest {// The name of the user.- // Format: users/{id}+ // Format: users/{user}string name = 1;string description = 2;@@ -221,7 +218,7 @@ message CreateUserAccessTokenRequest {message DeleteUserAccessTokenRequest {// The name of the user.- // Format: users/{id}+ // Format: users/{user}string name = 1;// access_token is the access token to delete.string access_token = 2;diff --git a/proto/api/v1/workspace_service.proto b/proto/api/v1/workspace_service.protoindex e6e488801..091f4c027 100644--- a/proto/api/v1/workspace_service.proto+++ b/proto/api/v1/workspace_service.proto@@ -15,7 +15,7 @@ service WorkspaceService {message WorkspaceProfile {// The name of instance owner.- // Format: "users/{id}"+ // Format: users/{user}string owner = 1;// version is the current version of instancestring version = 2;diff --git a/proto/gen/api/v1/inbox_service.pb.go b/proto/gen/api/v1/inbox_service.pb.goindex 1c2e6e868..a2407bd84 100644--- a/proto/gen/api/v1/inbox_service.pb.go+++ b/proto/gen/api/v1/inbox_service.pb.go@@ -127,9 +127,9 @@ type Inbox struct {// The name of the inbox.// Format: inboxes/{id}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`- // Format: users/{id}+ // Format: users/{user}Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"`- // Format: users/{id}+ // Format: users/{user}Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"`Status Inbox_Status `protobuf:"varint,4,opt,name=status,proto3,enum=memos.api.v1.Inbox_Status" json:"status,omitempty"`CreateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`@@ -220,7 +220,7 @@ func (x *Inbox) GetActivityId() int32 {type ListInboxesRequest struct {state protoimpl.MessageState `protogen:"open.v1"`- // Format: users/{id}+ // Format: users/{user}User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`// The maximum number of inbox to return.PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`diff --git a/proto/gen/api/v1/memo_service.pb.go b/proto/gen/api/v1/memo_service.pb.goindex e11940fa8..bca24575f 100644--- a/proto/gen/api/v1/memo_service.pb.go+++ b/proto/gen/api/v1/memo_service.pb.go@@ -137,7 +137,7 @@ type Memo struct {Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`State State `protobuf:"varint,3,opt,name=state,proto3,enum=memos.api.v1.State" json:"state,omitempty"`// The name of the creator.- // Format: users/{id}+ // Format: users/{user}Creator string `protobuf:"bytes,4,opt,name=creator,proto3" json:"creator,omitempty"`CreateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`UpdateTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`@@ -537,7 +537,7 @@ type ListMemosRequest struct {// Provide this to retrieve the subsequent page.PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`// Filter is used to filter memos returned in the list.- // Format: "creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']"+ // Format: "creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']"Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"`// The view of the memo.View MemoView `protobuf:"varint,4,opt,name=view,proto3,enum=memos.api.v1.MemoView" json:"view,omitempty"`diff --git a/proto/gen/api/v1/reaction_service.pb.go b/proto/gen/api/v1/reaction_service.pb.goindex d6099b913..2f810a4b1 100644--- a/proto/gen/api/v1/reaction_service.pb.go+++ b/proto/gen/api/v1/reaction_service.pb.go@@ -24,7 +24,7 @@ type Reaction struct {state protoimpl.MessageState `protogen:"open.v1"`Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`// The name of the creator.- // Format: users/{id}+ // Format: users/{user}Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"`ContentId string `protobuf:"bytes,3,opt,name=content_id,json=contentId,proto3" json:"content_id,omitempty"`ReactionType string `protobuf:"bytes,4,opt,name=reaction_type,json=reactionType,proto3" json:"reaction_type,omitempty"`diff --git a/proto/gen/api/v1/user_service.pb.go b/proto/gen/api/v1/user_service.pb.goindex 36240fe60..39c74a8ba 100644--- a/proto/gen/api/v1/user_service.pb.go+++ b/proto/gen/api/v1/user_service.pb.go@@ -80,10 +80,8 @@ func (User_Role) EnumDescriptor() ([]byte, []int) {type User struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the user.- // Format: users/{id}- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`- // The system generated uid of the user.- Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`+ // Format: users/{user}. {user} is a system-generated auto-increment id.+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`Role User_Role `protobuf:"varint,3,opt,name=role,proto3,enum=memos.api.v1.User_Role" json:"role,omitempty"`Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"`Email string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"`@@ -135,13 +133,6 @@ func (x *User) GetName() string {return ""}-func (x *User) GetId() int32 {- if x != nil {- return x.Id- }- return 0-}-func (x *User) GetRole() User_Role {if x != nil {return x.Role@@ -385,7 +376,7 @@ func (x *SearchUsersResponse) GetUsers() []*User {type GetUserRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the user.- // Format: users/{id}+ // Format: users/{user}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -431,7 +422,7 @@ func (x *GetUserRequest) GetName() string {type GetUserAvatarBinaryRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the user.- // Format: users/{id}+ // Format: users/{user}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`// The raw HTTP body is bound to this field.HttpBody *httpbody.HttpBody `protobuf:"bytes,2,opt,name=http_body,json=httpBody,proto3" json:"http_body,omitempty"`@@ -582,7 +573,7 @@ func (x *UpdateUserRequest) GetUpdateMask() *fieldmaskpb.FieldMask {type DeleteUserRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the user.- // Format: users/{id}+ // Format: users/{user}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -628,7 +619,7 @@ func (x *DeleteUserRequest) GetName() string {type UserSetting struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the user.- // Format: users/{id}+ // Format: users/{user}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`// The preferred locale of the user.Locale string `protobuf:"bytes,2,opt,name=locale,proto3" json:"locale,omitempty"`@@ -701,7 +692,7 @@ func (x *UserSetting) GetMemoVisibility() string {type GetUserSettingRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the user.- // Format: users/{id}+ // Format: users/{user}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -867,7 +858,7 @@ func (x *UserAccessToken) GetExpiresAt() *timestamppb.Timestamp {type ListUserAccessTokensRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the user.- // Format: users/{id}+ // Format: users/{user}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -957,7 +948,7 @@ func (x *ListUserAccessTokensResponse) GetAccessTokens() []*UserAccessToken {type CreateUserAccessTokenRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the user.- // Format: users/{id}+ // Format: users/{user}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expires_at,json=expiresAt,proto3,oneof" json:"expires_at,omitempty"`@@ -1019,7 +1010,7 @@ func (x *CreateUserAccessTokenRequest) GetExpiresAt() *timestamppb.Timestamp {type DeleteUserAccessTokenRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the user.- // Format: users/{id}+ // Format: users/{user}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`// access_token is the access token to delete.AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`@@ -1091,9 +1082,8 @@ var file_api_v1_user_service_proto_rawDesc = []byte{0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74,- 0x6f, 0x22, 0xea, 0x03, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,- 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e,- 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2b,+ 0x6f, 0x22, 0xda, 0x03, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b,0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x6d,0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72,0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75,diff --git a/proto/gen/api/v1/workspace_service.pb.go b/proto/gen/api/v1/workspace_service.pb.goindex cc9655a8a..54a683ff3 100644--- a/proto/gen/api/v1/workspace_service.pb.go+++ b/proto/gen/api/v1/workspace_service.pb.go@@ -24,7 +24,7 @@ const (type WorkspaceProfile struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of instance owner.- // Format: "users/{id}"+ // Format: users/{user}Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"`// version is the current version of instanceVersion string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yamlindex 220b82ec1..a2cbeac73 100644--- a/proto/gen/apidocs.swagger.yaml+++ b/proto/gen/apidocs.swagger.yaml@@ -190,7 +190,7 @@ paths:$ref: '#/definitions/googlerpcStatus'parameters:- name: user- description: 'Format: users/{id}'+ description: 'Format: users/{user}'in: queryrequired: falsetype: string@@ -320,7 +320,7 @@ paths:- name: filterdescription: |-Filter is used to filter memos returned in the list.- Format: "creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']"+ Format: "creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']"in: queryrequired: falsetype: string@@ -787,10 +787,10 @@ paths:properties:sender:type: string- title: 'Format: users/{id}'+ title: 'Format: users/{user}'receiver:type: string- title: 'Format: users/{id}'+ title: 'Format: users/{user}'status:$ref: '#/definitions/v1InboxStatus'createTime:@@ -841,7 +841,7 @@ paths:type: stringtitle: |-The name of the creator.- Format: users/{id}+ Format: users/{user}createTime:type: stringformat: date-time@@ -919,7 +919,7 @@ paths:- name: name_1description: |-The name of the user.- Format: users/{id}+ Format: users/{user}in: pathrequired: truetype: string@@ -1137,7 +1137,7 @@ paths:- name: namedescription: |-The name of the user.- Format: users/{id}+ Format: users/{user}in: pathrequired: truetype: string@@ -1161,7 +1161,7 @@ paths:- name: namedescription: |-The name of the user.- Format: users/{id}+ Format: users/{user}in: pathrequired: truetype: string@@ -1184,7 +1184,7 @@ paths:- name: namedescription: |-The name of the user.- Format: users/{id}+ Format: users/{user}in: pathrequired: truetype: string@@ -1214,7 +1214,7 @@ paths:- name: namedescription: |-The name of the user.- Format: users/{id}+ Format: users/{user}in: pathrequired: truetype: string@@ -1453,7 +1453,7 @@ paths:- name: namedescription: |-The name of the user.- Format: users/{id}+ Format: users/{user}in: pathrequired: truetype: string@@ -1595,7 +1595,7 @@ paths:- name: setting.namedescription: |-The name of the user.- Format: users/{id}+ Format: users/{user}in: pathrequired: truetype: string@@ -1636,7 +1636,7 @@ paths:- name: user.namedescription: |-The name of the user.- Format: users/{id}+ Format: users/{user}. {user} is a system-generated auto-increment id.in: pathrequired: truetype: string@@ -1647,10 +1647,6 @@ paths:schema:type: objectproperties:- id:- type: integer- format: int32- description: The system generated uid of the user.role:$ref: '#/definitions/UserRole'username:@@ -1694,7 +1690,7 @@ paths:- name: namedescription: |-The name of the user.- Format: users/{id}+ Format: users/{user}in: pathrequired: truetype: string@@ -1975,7 +1971,7 @@ definitions:type: stringtitle: |-The name of the creator.- Format: users/{id}+ Format: users/{user}createTime:type: stringformat: date-time@@ -2060,7 +2056,7 @@ definitions:type: stringtitle: |-The name of the user.- Format: users/{id}+ Format: users/{user}locale:type: stringdescription: The preferred locale of the user.@@ -2486,10 +2482,10 @@ definitions:Format: inboxes/{id}sender:type: string- title: 'Format: users/{id}'+ title: 'Format: users/{user}'receiver:type: string- title: 'Format: users/{id}'+ title: 'Format: users/{user}'status:$ref: '#/definitions/v1InboxStatus'createTime:@@ -2869,7 +2865,7 @@ definitions:type: stringtitle: |-The name of the creator.- Format: users/{id}+ Format: users/{user}contentId:type: stringreactionType:@@ -3035,13 +3031,9 @@ definitions:properties:name:type: string- title: |-+ description: |-The name of the user.- Format: users/{id}- id:- type: integer- format: int32- description: The system generated uid of the user.+ Format: users/{user}. {user} is a system-generated auto-increment id.role:$ref: '#/definitions/UserRole'username:@@ -3111,7 +3103,7 @@ definitions:type: stringtitle: |-The name of instance owner.- Format: "users/{id}"+ Format: users/{user}version:type: stringtitle: version is the current version of instancediff --git a/server/router/api/v1/user_service.go b/server/router/api/v1/user_service.goindex cc9cf22e9..b2e68a010 100644--- a/server/router/api/v1/user_service.go+++ b/server/router/api/v1/user_service.go@@ -556,7 +556,6 @@ func (s *APIV1Service) UpsertAccessTokenToStore(ctx context.Context, user *storefunc convertUserFromStore(user *store.User) *v1pb.User {userpb := &v1pb.User{Name: fmt.Sprintf("%s%d", UserNamePrefix, user.ID),- Id: user.ID,State: convertStateFromStore(user.RowStatus),CreateTime: timestamppb.New(time.Unix(user.CreatedTs, 0)),UpdateTime: timestamppb.New(time.Unix(user.UpdatedTs, 0)),diff --git a/store/memo_filter.go b/store/memo_filter.gonew file mode 100644index 000000000..829396613--- /dev/null+++ b/store/memo_filter.go@@ -0,0 +1,13 @@+package store++type LogicOperator string++const (+ AND LogicOperator = "AND"+ OR LogicOperator = "OR"+)++type QueryExpression struct {+ Operator LogicOperator+ Children []*QueryExpression+}diff --git a/web/src/components/Settings/MemberSection.tsx b/web/src/components/Settings/MemberSection.tsxindex 1dcd66192..07e017892 100644--- a/web/src/components/Settings/MemberSection.tsx+++ b/web/src/components/Settings/MemberSection.tsx@@ -173,14 +173,11 @@ const MemberSection = () => {<thead><tr className="text-sm font-semibold text-left text-gray-900 dark:text-gray-400"><th scope="col" className="px-3 py-2">- ID+ {t("common.username")}</th><th scope="col" className="px-3 py-2">{t("common.role")}</th>- <th scope="col" className="px-3 py-2">- {t("common.username")}- </th><th scope="col" className="px-3 py-2">{t("common.nickname")}</th>@@ -192,17 +189,16 @@ const MemberSection = () => {</thead><tbody className="divide-y divide-gray-200 dark:divide-zinc-600">{sortedUsers.map((user) => (- <tr key={user.id}>- <td className="whitespace-nowrap px-3 py-2 text-sm text-gray-900 dark:text-gray-400">{user.id}</td>- <td className="whitespace-nowrap px-3 py-2 text-sm text-gray-500 dark:text-gray-400">{stringifyUserRole(user.role)}</td>+ <tr key={user.name}><td className="whitespace-nowrap px-3 py-2 text-sm text-gray-500 dark:text-gray-400">{user.username}<span className="ml-1 italic">{user.state === State.ARCHIVED && "(Archived)"}</span></td>+ <td className="whitespace-nowrap px-3 py-2 text-sm text-gray-500 dark:text-gray-400">{stringifyUserRole(user.role)}</td><td className="whitespace-nowrap px-3 py-2 text-sm text-gray-500 dark:text-gray-400">{user.nickname}</td><td className="whitespace-nowrap px-3 py-2 text-sm text-gray-500 dark:text-gray-400">{user.email}</td><td className="relative whitespace-nowrap py-2 pl-3 pr-4 text-right text-sm font-medium flex justify-end">- {currentUser?.id === user.id ? (+ {currentUser?.name === user.name ? (<span>{t("common.yourself")}</span>) : (<Dropdown>diff --git a/web/src/components/Settings/WebhookSection.tsx b/web/src/components/Settings/WebhookSection.tsxindex 64074ab29..92e4e69a5 100644--- a/web/src/components/Settings/WebhookSection.tsx+++ b/web/src/components/Settings/WebhookSection.tsx@@ -4,6 +4,7 @@ import { useEffect, useState } from "react";import { Link } from "react-router-dom";import { webhookServiceClient } from "@/grpcweb";import useCurrentUser from "@/hooks/useCurrentUser";+import { extractUserIdFromName } from "@/store/v1";import { Webhook } from "@/types/proto/api/v1/webhook_service";import { useTranslate } from "@/utils/i18n";import showCreateWebhookDialog from "../CreateWebhookDialog";@@ -21,13 +22,13 @@ const WebhookSection = () => {const [webhooks, setWebhooks] = useState<Webhook[]>([]);useEffect(() => {- listWebhooks(currentUser.id).then((webhooks) => {+ listWebhooks(extractUserIdFromName(currentUser.name)).then((webhooks) => {setWebhooks(webhooks);});}, []);const handleCreateAccessTokenDialogConfirm = async () => {- const webhooks = await listWebhooks(currentUser.id);+ const webhooks = await listWebhooks(extractUserIdFromName(currentUser.name));setWebhooks(webhooks);};diff --git a/web/src/store/v1/resourceName.ts b/web/src/store/v1/resourceName.tsindex f48715740..6cb052ac7 100644--- a/web/src/store/v1/resourceName.ts+++ b/web/src/store/v1/resourceName.ts@@ -4,6 +4,10 @@ export const memoNamePrefix = "memos/";export const identityProviderNamePrefix = "identityProviders/";export const activityNamePrefix = "activities/";+export const extractUserIdFromName = (name: string) => {+ return parseInt(name.split(userNamePrefix).pop() || "", 10);+};+export const extractMemoIdFromName = (name: string) => {return parseInt(name.split(memoNamePrefix).pop() || "", 10);};