diff --git a/api/v1/activity.go b/api/v1/activity.go deleted file mode 100644 index e667d802..00000000 --- a/api/v1/activity.go +++ /dev/null @@ -1,136 +0,0 @@ -package v1 - -import "github.com/usememos/memos/server/profile" - -// ActivityType is the type for an activity. -type ActivityType string - -const ( - // User related. - - // ActivityUserCreate is the type for creating users. - ActivityUserCreate ActivityType = "user.create" - // ActivityUserUpdate is the type for updating users. - ActivityUserUpdate ActivityType = "user.update" - // ActivityUserDelete is the type for deleting users. - ActivityUserDelete ActivityType = "user.delete" - // ActivityUserAuthSignIn is the type for user signin. - ActivityUserAuthSignIn ActivityType = "user.auth.signin" - // ActivityUserAuthSignUp is the type for user signup. - ActivityUserAuthSignUp ActivityType = "user.auth.signup" - // ActivityUserSettingUpdate is the type for updating user settings. - ActivityUserSettingUpdate ActivityType = "user.setting.update" - - // Memo related. - - // ActivityMemoCreate is the type for creating memos. - ActivityMemoCreate ActivityType = "memo.create" - // ActivityMemoView is the type for viewing memos. - ActivityMemoView ActivityType = "memo.view" - // ActivityMemoUpdate is the type for updating memos. - ActivityMemoUpdate ActivityType = "memo.update" - // ActivityMemoDelete is the type for deleting memos. - ActivityMemoDelete ActivityType = "memo.delete" - - // Resource related. - - // ActivityResourceCreate is the type for creating resources. - ActivityResourceCreate ActivityType = "resource.create" - // ActivityResourceDelete is the type for deleting resources. - ActivityResourceDelete ActivityType = "resource.delete" - - // Tag related. - - // ActivityTagCreate is the type for creating tags. - ActivityTagCreate ActivityType = "tag.create" - // ActivityTagDelete is the type for deleting tags. - ActivityTagDelete ActivityType = "tag.delete" - - // Server related. - - // ActivityServerStart is the type for starting server. - ActivityServerStart ActivityType = "server.start" -) - -func (t ActivityType) String() string { - return string(t) -} - -// ActivityLevel is the level of activities. -type ActivityLevel string - -const ( - // ActivityInfo is the INFO level of activities. - ActivityInfo ActivityLevel = "INFO" - // ActivityWarn is the WARN level of activities. - ActivityWarn ActivityLevel = "WARN" - // ActivityError is the ERROR level of activities. - ActivityError ActivityLevel = "ERROR" -) - -func (l ActivityLevel) String() string { - return string(l) -} - -type ActivityUserCreatePayload struct { - UserID int32 `json:"userId"` - Username string `json:"username"` - Role Role `json:"role"` -} - -type ActivityUserAuthSignInPayload struct { - UserID int32 `json:"userId"` - IP string `json:"ip"` -} - -type ActivityUserAuthSignUpPayload struct { - Username string `json:"username"` - IP string `json:"ip"` -} - -type ActivityMemoCreatePayload struct { - MemoID int32 `json:"memoId"` -} - -type ActivityMemoViewPayload struct { - MemoID int32 `json:"memoId"` -} - -type ActivityResourceCreatePayload struct { - Filename string `json:"filename"` - Type string `json:"type"` - Size int64 `json:"size"` -} - -type ActivityTagCreatePayload struct { - TagName string `json:"tagName"` -} - -type ActivityServerStartPayload struct { - ServerID string `json:"serverId"` - Profile *profile.Profile `json:"profile"` -} - -type Activity struct { - ID int32 `json:"id"` - - // Standard fields - CreatorID int32 `json:"creatorId"` - CreatedTs int64 `json:"createdTs"` - - // Domain specific fields - Type ActivityType `json:"type"` - Level ActivityLevel `json:"level"` - Payload string `json:"payload"` -} - -// ActivityCreate is the API message for creating an activity. -type ActivityCreate struct { - // Standard fields - CreatorID int32 - - // Domain specific fields - Type ActivityType `json:"type"` - Level ActivityLevel - Payload string `json:"payload"` -} diff --git a/api/v1/auth.go b/api/v1/auth.go index 389d1a72..ae15300b 100644 --- a/api/v1/auth.go +++ b/api/v1/auth.go @@ -117,9 +117,6 @@ func (s *APIV1Service) SignIn(c echo.Context) error { if err := s.UpsertAccessTokenToStore(ctx, user, accessToken); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("failed to upsert access token, err: %s", err)).SetInternal(err) } - if err := s.createAuthSignInActivity(c, user); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create activity").SetInternal(err) - } cookieExp := time.Now().Add(auth.CookieExpDuration) setTokenCookie(c, auth.AccessTokenCookieName, accessToken, cookieExp) userMessage := convertUserFromStore(user) @@ -241,9 +238,6 @@ func (s *APIV1Service) SignInSSO(c echo.Context) error { if err := s.UpsertAccessTokenToStore(ctx, user, accessToken); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("failed to upsert access token, err: %s", err)).SetInternal(err) } - if err := s.createAuthSignInActivity(c, user); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create activity").SetInternal(err) - } cookieExp := time.Now().Add(auth.CookieExpDuration) setTokenCookie(c, auth.AccessTokenCookieName, accessToken, cookieExp) userMessage := convertUserFromStore(user) @@ -366,9 +360,6 @@ func (s *APIV1Service) SignUp(c echo.Context) error { if err := s.UpsertAccessTokenToStore(ctx, user, accessToken); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("failed to upsert access token, err: %s", err)).SetInternal(err) } - if err := s.createAuthSignUpActivity(c, user); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create activity").SetInternal(err) - } cookieExp := time.Now().Add(auth.CookieExpDuration) setTokenCookie(c, auth.AccessTokenCookieName, accessToken, cookieExp) userMessage := convertUserFromStore(user) @@ -399,50 +390,6 @@ func (s *APIV1Service) UpsertAccessTokenToStore(ctx context.Context, user *store return nil } -func (s *APIV1Service) createAuthSignInActivity(c echo.Context, user *store.User) error { - ctx := c.Request().Context() - payload := ActivityUserAuthSignInPayload{ - UserID: user.ID, - IP: echo.ExtractIPFromRealIPHeader()(c.Request()), - } - payloadBytes, err := json.Marshal(payload) - if err != nil { - return errors.Wrap(err, "failed to marshal activity payload") - } - activity, err := s.Store.CreateActivity(ctx, &store.Activity{ - CreatorID: user.ID, - Type: string(ActivityUserAuthSignIn), - Level: string(ActivityInfo), - Payload: string(payloadBytes), - }) - if err != nil || activity == nil { - return errors.Wrap(err, "failed to create activity") - } - return err -} - -func (s *APIV1Service) createAuthSignUpActivity(c echo.Context, user *store.User) error { - ctx := c.Request().Context() - payload := ActivityUserAuthSignUpPayload{ - Username: user.Username, - IP: echo.ExtractIPFromRealIPHeader()(c.Request()), - } - payloadBytes, err := json.Marshal(payload) - if err != nil { - return errors.Wrap(err, "failed to marshal activity payload") - } - activity, err := s.Store.CreateActivity(ctx, &store.Activity{ - CreatorID: user.ID, - Type: string(ActivityUserAuthSignUp), - Level: string(ActivityInfo), - Payload: string(payloadBytes), - }) - if err != nil || activity == nil { - return errors.Wrap(err, "failed to create activity") - } - return err -} - // removeAccessTokenAndCookies removes the jwt token from the cookies. func removeAccessTokenAndCookies(c echo.Context) { cookieExp := time.Now().Add(-1 * time.Hour) diff --git a/api/v1/memo.go b/api/v1/memo.go index 3fbc7663..c1ac9133 100644 --- a/api/v1/memo.go +++ b/api/v1/memo.go @@ -319,9 +319,6 @@ func (s *APIV1Service) CreateMemo(c echo.Context) error { if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create memo").SetInternal(err) } - if err := s.createMemoCreateActivity(ctx, memo); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create activity").SetInternal(err) - } for _, resourceID := range createMemoRequest.ResourceIDList { if _, err := s.Store.UpdateResource(ctx, &store.UpdateResource{ @@ -340,6 +337,18 @@ func (s *APIV1Service) CreateMemo(c echo.Context) error { }); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to upsert memo relation").SetInternal(err) } + if memoRelationUpsert.Type == MemoRelationComment { + relatedMemo, err := s.Store.GetMemo(ctx, &store.FindMemo{ + ID: &memoRelationUpsert.RelatedMemoID, + }) + if err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, "Failed to get related memo").SetInternal(err) + } + // nolint + if relatedMemo.CreatorID != memo.CreatorID { + // TODO: When a memo is commented by others, send notification to the memo creator. + } + } } composedMemo, err := s.Store.GetMemo(ctx, &store.FindMemo{ @@ -567,9 +576,6 @@ func (s *APIV1Service) GetMemo(c echo.Context) error { return echo.NewHTTPError(http.StatusForbidden, "this memo is protected, missing user in session") } } - if err := s.createMemoViewActivity(c, memo, userID); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create activity").SetInternal(err) - } memoResponse, err := s.convertMemoFromStore(ctx, memo) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to compose memo response").SetInternal(err) @@ -766,47 +772,6 @@ func (s *APIV1Service) UpdateMemo(c echo.Context) error { return c.JSON(http.StatusOK, memoResponse) } -func (s *APIV1Service) createMemoCreateActivity(ctx context.Context, memo *store.Memo) error { - payload := ActivityMemoCreatePayload{ - MemoID: memo.ID, - } - payloadBytes, err := json.Marshal(payload) - if err != nil { - return errors.Wrap(err, "failed to marshal activity payload") - } - activity, err := s.Store.CreateActivity(ctx, &store.Activity{ - CreatorID: memo.CreatorID, - Type: ActivityMemoCreate.String(), - Level: ActivityInfo.String(), - Payload: string(payloadBytes), - }) - if err != nil || activity == nil { - return errors.Wrap(err, "failed to create activity") - } - return err -} - -func (s *APIV1Service) createMemoViewActivity(c echo.Context, memo *store.Memo, userID int32) error { - ctx := c.Request().Context() - payload := ActivityMemoViewPayload{ - MemoID: memo.ID, - } - payloadBytes, err := json.Marshal(payload) - if err != nil { - return errors.Wrap(err, "failed to marshal activity payload") - } - activity, err := s.Store.CreateActivity(ctx, &store.Activity{ - CreatorID: userID, - Type: string(ActivityMemoView), - Level: string(ActivityInfo), - Payload: string(payloadBytes), - }) - if err != nil || activity == nil { - return errors.Wrap(err, "failed to create activity") - } - return err -} - func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.Memo) (*Memo, error) { memoResponse := &Memo{ ID: memo.ID, diff --git a/api/v1/memo_relation.go b/api/v1/memo_relation.go index a2d80bbb..61350af8 100644 --- a/api/v1/memo_relation.go +++ b/api/v1/memo_relation.go @@ -14,8 +14,8 @@ import ( type MemoRelationType string const ( - MemoRelationReference MemoRelationType = "REFERENCE" - MemoRelationAdditional MemoRelationType = "ADDITIONAL" + MemoRelationReference MemoRelationType = "REFERENCE" + MemoRelationComment MemoRelationType = "COMMENT" ) type MemoRelation struct { diff --git a/api/v1/resource.go b/api/v1/resource.go index 61ca18a7..fc1ca1e9 100644 --- a/api/v1/resource.go +++ b/api/v1/resource.go @@ -161,9 +161,6 @@ func (s *APIV1Service) CreateResource(c echo.Context) error { if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create resource").SetInternal(err) } - if err := s.createResourceCreateActivity(ctx, resource); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create activity").SetInternal(err) - } return c.JSON(http.StatusOK, convertResourceFromStore(resource)) } @@ -233,9 +230,6 @@ func (s *APIV1Service) UploadResource(c echo.Context) error { if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create resource").SetInternal(err) } - if err := s.createResourceCreateActivity(ctx, resource); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create activity").SetInternal(err) - } return c.JSON(http.StatusOK, convertResourceFromStore(resource)) } @@ -353,28 +347,6 @@ func (s *APIV1Service) UpdateResource(c echo.Context) error { return c.JSON(http.StatusOK, convertResourceFromStore(resource)) } -func (s *APIV1Service) createResourceCreateActivity(ctx context.Context, resource *store.Resource) error { - payload := ActivityResourceCreatePayload{ - Filename: resource.Filename, - Type: resource.Type, - Size: resource.Size, - } - payloadBytes, err := json.Marshal(payload) - if err != nil { - return errors.Wrap(err, "failed to marshal activity payload") - } - activity, err := s.Store.CreateActivity(ctx, &store.Activity{ - CreatorID: resource.CreatorID, - Type: ActivityResourceCreate.String(), - Level: ActivityInfo.String(), - Payload: string(payloadBytes), - }) - if err != nil || activity == nil { - return errors.Wrap(err, "failed to create activity") - } - return err -} - func replacePathTemplate(path, filename string) string { t := time.Now() path = fileKeyPattern.ReplaceAllStringFunc(path, func(s string) string { diff --git a/api/v1/tag.go b/api/v1/tag.go index 31163637..e75416a2 100644 --- a/api/v1/tag.go +++ b/api/v1/tag.go @@ -8,7 +8,6 @@ import ( "sort" "github.com/labstack/echo/v4" - "github.com/pkg/errors" "golang.org/x/exp/slices" "github.com/usememos/memos/store" @@ -99,9 +98,6 @@ func (s *APIV1Service) CreateTag(c echo.Context) error { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to upsert tag").SetInternal(err) } tagMessage := convertTagFromStore(tag) - if err := s.createTagCreateActivity(c, tagMessage); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create activity").SetInternal(err) - } return c.JSON(http.StatusOK, tagMessage.Name) } @@ -196,27 +192,6 @@ func (s *APIV1Service) GetTagSuggestion(c echo.Context) error { return c.JSON(http.StatusOK, tagList) } -func (s *APIV1Service) createTagCreateActivity(c echo.Context, tag *Tag) error { - ctx := c.Request().Context() - payload := ActivityTagCreatePayload{ - TagName: tag.Name, - } - payloadBytes, err := json.Marshal(payload) - if err != nil { - return errors.Wrap(err, "failed to marshal activity payload") - } - activity, err := s.Store.CreateActivity(ctx, &store.Activity{ - CreatorID: tag.CreatorID, - Type: ActivityTagCreate.String(), - Level: ActivityInfo.String(), - Payload: string(payloadBytes), - }) - if err != nil || activity == nil { - return errors.Wrap(err, "failed to create activity") - } - return err -} - func convertTagFromStore(tag *store.Tag) *Tag { return &Tag{ Name: tag.Name, diff --git a/api/v1/user.go b/api/v1/user.go index 268d6c48..dbb69739 100644 --- a/api/v1/user.go +++ b/api/v1/user.go @@ -167,9 +167,6 @@ func (s *APIV1Service) CreateUser(c echo.Context) error { } userMessage := convertUserFromStore(user) - if err := s.createUserCreateActivity(c, userMessage); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create activity").SetInternal(err) - } metric.Enqueue("user create") return c.JSON(http.StatusOK, userMessage) } @@ -473,29 +470,6 @@ func (update UpdateUserRequest) Validate() error { return nil } -func (s *APIV1Service) createUserCreateActivity(c echo.Context, user *User) error { - ctx := c.Request().Context() - payload := ActivityUserCreatePayload{ - UserID: user.ID, - Username: user.Username, - Role: user.Role, - } - payloadBytes, err := json.Marshal(payload) - if err != nil { - return errors.Wrap(err, "failed to marshal activity payload") - } - activity, err := s.Store.CreateActivity(ctx, &store.Activity{ - CreatorID: user.ID, - Type: ActivityUserCreate.String(), - Level: ActivityInfo.String(), - Payload: string(payloadBytes), - }) - if err != nil || activity == nil { - return errors.Wrap(err, "failed to create activity") - } - return err -} - func convertUserFromStore(user *store.User) *User { return &User{ ID: user.ID, diff --git a/api/v2/inbox_service .go b/api/v2/inbox_service .go index d2ae311f..1d78dc52 100644 --- a/api/v2/inbox_service .go +++ b/api/v2/inbox_service .go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -87,14 +88,27 @@ func (s *APIV2Service) DeleteInbox(ctx context.Context, request *apiv2pb.DeleteI return &apiv2pb.DeleteInboxResponse{}, nil } -func (*APIV2Service) convertInboxFromStore(_ context.Context, inbox *store.Inbox) (*apiv2pb.Inbox, error) { - // TODO: convert sender and receiver. +func (s *APIV2Service) convertInboxFromStore(ctx context.Context, inbox *store.Inbox) (*apiv2pb.Inbox, error) { + sender, err := s.Store.GetUser(ctx, &store.FindUser{ + ID: &inbox.SenderID, + }) + if err != nil { + return nil, errors.Wrap(err, "failed to get sender") + } + receiver, err := s.Store.GetUser(ctx, &store.FindUser{ + ID: &inbox.ReceiverID, + }) + if err != nil { + return nil, errors.Wrap(err, "failed to get receiver") + } + return &apiv2pb.Inbox{ - Name: fmt.Sprintf("inbox/%d", inbox.ID), - Status: convertInboxStatusFromStore(inbox.Status), - Title: inbox.Message.Title, - Content: inbox.Message.Content, - Link: inbox.Message.Link, + Name: fmt.Sprintf("inbox/%d", inbox.ID), + Sender: fmt.Sprintf("users/%s", sender.Username), + Receiver: fmt.Sprintf("users/%s", receiver.Username), + Status: convertInboxStatusFromStore(inbox.Status), + Type: apiv2pb.Inbox_Type(inbox.Message.Type), + ActivityId: inbox.Message.ActivityId, }, nil } diff --git a/proto/api/v2/inbox_service.proto b/proto/api/v2/inbox_service.proto index aaf9fdc8..eb68b7b9 100644 --- a/proto/api/v2/inbox_service.proto +++ b/proto/api/v2/inbox_service.proto @@ -44,11 +44,13 @@ message Inbox { } Status status = 4; - string title = 5; - - string content = 6; + enum Type { + TYPE_UNSPECIFIED = 0; + TYPE_MEMO_COMMENT = 1; + } + Type type = 5; - string link = 7; + optional int32 activity_id = 6; } message ListInboxRequest { diff --git a/proto/gen/api/v2/README.md b/proto/gen/api/v2/README.md index 7de3b3de..31f5baba 100644 --- a/proto/gen/api/v2/README.md +++ b/proto/gen/api/v2/README.md @@ -16,6 +16,7 @@ - [UpdateInboxResponse](#memos-api-v2-UpdateInboxResponse) - [Inbox.Status](#memos-api-v2-Inbox-Status) + - [Inbox.Type](#memos-api-v2-Inbox-Type) - [InboxService](#memos-api-v2-InboxService) @@ -166,9 +167,8 @@ | sender | [string](#string) | | Format: users/{username} | | receiver | [string](#string) | | Format: users/{username} | | status | [Inbox.Status](#memos-api-v2-Inbox-Status) | | | -| title | [string](#string) | | | -| content | [string](#string) | | | -| link | [string](#string) | | | +| type | [Inbox.Type](#memos-api-v2-Inbox-Type) | | | +| activity_id | [int32](#int32) | optional | | @@ -251,6 +251,18 @@ | ARCHIVED | 3 | | + + + +### Inbox.Type + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| TYPE_UNSPECIFIED | 0 | | +| TYPE_MEMO_COMMENT | 1 | | + + diff --git a/proto/gen/api/v2/inbox_service.pb.go b/proto/gen/api/v2/inbox_service.pb.go index d2b1e0cb..f7bba2d3 100644 --- a/proto/gen/api/v2/inbox_service.pb.go +++ b/proto/gen/api/v2/inbox_service.pb.go @@ -74,6 +74,52 @@ func (Inbox_Status) EnumDescriptor() ([]byte, []int) { return file_api_v2_inbox_service_proto_rawDescGZIP(), []int{0, 0} } +type Inbox_Type int32 + +const ( + Inbox_TYPE_UNSPECIFIED Inbox_Type = 0 + Inbox_TYPE_MEMO_COMMENT Inbox_Type = 1 +) + +// Enum value maps for Inbox_Type. +var ( + Inbox_Type_name = map[int32]string{ + 0: "TYPE_UNSPECIFIED", + 1: "TYPE_MEMO_COMMENT", + } + Inbox_Type_value = map[string]int32{ + "TYPE_UNSPECIFIED": 0, + "TYPE_MEMO_COMMENT": 1, + } +) + +func (x Inbox_Type) Enum() *Inbox_Type { + p := new(Inbox_Type) + *p = x + return p +} + +func (x Inbox_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Inbox_Type) Descriptor() protoreflect.EnumDescriptor { + return file_api_v2_inbox_service_proto_enumTypes[1].Descriptor() +} + +func (Inbox_Type) Type() protoreflect.EnumType { + return &file_api_v2_inbox_service_proto_enumTypes[1] +} + +func (x Inbox_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Inbox_Type.Descriptor instead. +func (Inbox_Type) EnumDescriptor() ([]byte, []int) { + return file_api_v2_inbox_service_proto_rawDescGZIP(), []int{0, 1} +} + type Inbox struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -85,11 +131,10 @@ type Inbox struct { // Format: users/{username} Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` // Format: users/{username} - 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.v2.Inbox_Status" json:"status,omitempty"` - Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` - Content string `protobuf:"bytes,6,opt,name=content,proto3" json:"content,omitempty"` - Link string `protobuf:"bytes,7,opt,name=link,proto3" json:"link,omitempty"` + 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.v2.Inbox_Status" json:"status,omitempty"` + Type Inbox_Type `protobuf:"varint,5,opt,name=type,proto3,enum=memos.api.v2.Inbox_Type" json:"type,omitempty"` + ActivityId *int32 `protobuf:"varint,6,opt,name=activity_id,json=activityId,proto3,oneof" json:"activity_id,omitempty"` } func (x *Inbox) Reset() { @@ -152,25 +197,18 @@ func (x *Inbox) GetStatus() Inbox_Status { return Inbox_STATUS_UNSPECIFIED } -func (x *Inbox) GetTitle() string { +func (x *Inbox) GetType() Inbox_Type { if x != nil { - return x.Title + return x.Type } - return "" -} - -func (x *Inbox) GetContent() string { - if x != nil { - return x.Content - } - return "" + return Inbox_TYPE_UNSPECIFIED } -func (x *Inbox) GetLink() string { - if x != nil { - return x.Link +func (x *Inbox) GetActivityId() int32 { + if x != nil && x.ActivityId != nil { + return *x.ActivityId } - return "" + return 0 } type ListInboxRequest struct { @@ -468,7 +506,7 @@ var file_api_v2_inbox_service_proto_rawDesc = []byte{ 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x02, 0x0a, 0x05, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x12, 0x0a, + 0x6f, 0x74, 0x6f, 0x22, 0xe2, 0x02, 0x0a, 0x05, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, @@ -476,72 +514,78 @@ var file_api_v2_inbox_service_proto_rawDesc = []byte{ 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, - 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, - 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x44, 0x0a, + 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x2e, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x76, + 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x0a, + 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x49, 0x64, 0x88, 0x01, 0x01, 0x22, 0x44, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x4e, 0x52, 0x45, 0x41, 0x44, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45, - 0x44, 0x10, 0x03, 0x22, 0x26, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x3e, 0x0a, 0x11, 0x4c, + 0x44, 0x10, 0x03, 0x22, 0x33, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x43, + 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x10, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x61, 0x63, 0x74, + 0x69, 0x76, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x22, 0x26, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, + 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, + 0x22, 0x3e, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, + 0x22, 0x7c, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, + 0x78, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, + 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x40, + 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, + 0x22, 0x28, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x32, 0xed, 0x02, 0x0a, 0x0c, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, + 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x29, 0x0a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, - 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x22, 0x7c, 0x0a, 0x12, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x3b, 0x0a, 0x0b, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x40, 0x0a, 0x13, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x29, 0x0a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, - 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x22, 0x28, 0x0a, 0x12, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, - 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xed, 0x02, 0x0a, - 0x0c, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x63, 0x0a, - 0x09, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, - 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, - 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x69, 0x6e, 0x62, - 0x6f, 0x78, 0x12, 0x80, 0x01, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, - 0x6f, 0x78, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0xda, 0x41, 0x11, 0x69, 0x6e, 0x62, 0x6f, - 0x78, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x12, 0x3a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x32, 0x09, 0x2f, 0x76, 0x32, 0x2f, - 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x75, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, - 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, - 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0xda, 0x41, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x6e, - 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x2f, 0x2a, 0x7d, 0x42, 0xa9, 0x01, 0x0a, - 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x42, 0x11, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, - 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, - 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, - 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, - 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x32, 0x2f, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x80, 0x01, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, + 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, + 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0xda, 0x41, + 0x11, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, + 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x32, + 0x09, 0x2f, 0x76, 0x32, 0x2f, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x75, 0x0a, 0x0b, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, + 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, + 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, + 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x2f, 0x2a, + 0x7d, 0x42, 0xa9, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x11, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, + 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, + 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, + 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, + 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -556,36 +600,38 @@ func file_api_v2_inbox_service_proto_rawDescGZIP() []byte { return file_api_v2_inbox_service_proto_rawDescData } -var file_api_v2_inbox_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_v2_inbox_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_api_v2_inbox_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_api_v2_inbox_service_proto_goTypes = []interface{}{ (Inbox_Status)(0), // 0: memos.api.v2.Inbox.Status - (*Inbox)(nil), // 1: memos.api.v2.Inbox - (*ListInboxRequest)(nil), // 2: memos.api.v2.ListInboxRequest - (*ListInboxResponse)(nil), // 3: memos.api.v2.ListInboxResponse - (*UpdateInboxRequest)(nil), // 4: memos.api.v2.UpdateInboxRequest - (*UpdateInboxResponse)(nil), // 5: memos.api.v2.UpdateInboxResponse - (*DeleteInboxRequest)(nil), // 6: memos.api.v2.DeleteInboxRequest - (*DeleteInboxResponse)(nil), // 7: memos.api.v2.DeleteInboxResponse - (*fieldmaskpb.FieldMask)(nil), // 8: google.protobuf.FieldMask + (Inbox_Type)(0), // 1: memos.api.v2.Inbox.Type + (*Inbox)(nil), // 2: memos.api.v2.Inbox + (*ListInboxRequest)(nil), // 3: memos.api.v2.ListInboxRequest + (*ListInboxResponse)(nil), // 4: memos.api.v2.ListInboxResponse + (*UpdateInboxRequest)(nil), // 5: memos.api.v2.UpdateInboxRequest + (*UpdateInboxResponse)(nil), // 6: memos.api.v2.UpdateInboxResponse + (*DeleteInboxRequest)(nil), // 7: memos.api.v2.DeleteInboxRequest + (*DeleteInboxResponse)(nil), // 8: memos.api.v2.DeleteInboxResponse + (*fieldmaskpb.FieldMask)(nil), // 9: google.protobuf.FieldMask } var file_api_v2_inbox_service_proto_depIdxs = []int32{ 0, // 0: memos.api.v2.Inbox.status:type_name -> memos.api.v2.Inbox.Status - 1, // 1: memos.api.v2.ListInboxResponse.inbox:type_name -> memos.api.v2.Inbox - 1, // 2: memos.api.v2.UpdateInboxRequest.inbox:type_name -> memos.api.v2.Inbox - 8, // 3: memos.api.v2.UpdateInboxRequest.update_mask:type_name -> google.protobuf.FieldMask - 1, // 4: memos.api.v2.UpdateInboxResponse.inbox:type_name -> memos.api.v2.Inbox - 2, // 5: memos.api.v2.InboxService.ListInbox:input_type -> memos.api.v2.ListInboxRequest - 4, // 6: memos.api.v2.InboxService.UpdateInbox:input_type -> memos.api.v2.UpdateInboxRequest - 6, // 7: memos.api.v2.InboxService.DeleteInbox:input_type -> memos.api.v2.DeleteInboxRequest - 3, // 8: memos.api.v2.InboxService.ListInbox:output_type -> memos.api.v2.ListInboxResponse - 5, // 9: memos.api.v2.InboxService.UpdateInbox:output_type -> memos.api.v2.UpdateInboxResponse - 7, // 10: memos.api.v2.InboxService.DeleteInbox:output_type -> memos.api.v2.DeleteInboxResponse - 8, // [8:11] is the sub-list for method output_type - 5, // [5:8] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 1, // 1: memos.api.v2.Inbox.type:type_name -> memos.api.v2.Inbox.Type + 2, // 2: memos.api.v2.ListInboxResponse.inbox:type_name -> memos.api.v2.Inbox + 2, // 3: memos.api.v2.UpdateInboxRequest.inbox:type_name -> memos.api.v2.Inbox + 9, // 4: memos.api.v2.UpdateInboxRequest.update_mask:type_name -> google.protobuf.FieldMask + 2, // 5: memos.api.v2.UpdateInboxResponse.inbox:type_name -> memos.api.v2.Inbox + 3, // 6: memos.api.v2.InboxService.ListInbox:input_type -> memos.api.v2.ListInboxRequest + 5, // 7: memos.api.v2.InboxService.UpdateInbox:input_type -> memos.api.v2.UpdateInboxRequest + 7, // 8: memos.api.v2.InboxService.DeleteInbox:input_type -> memos.api.v2.DeleteInboxRequest + 4, // 9: memos.api.v2.InboxService.ListInbox:output_type -> memos.api.v2.ListInboxResponse + 6, // 10: memos.api.v2.InboxService.UpdateInbox:output_type -> memos.api.v2.UpdateInboxResponse + 8, // 11: memos.api.v2.InboxService.DeleteInbox:output_type -> memos.api.v2.DeleteInboxResponse + 9, // [9:12] is the sub-list for method output_type + 6, // [6:9] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_api_v2_inbox_service_proto_init() } @@ -679,12 +725,13 @@ func file_api_v2_inbox_service_proto_init() { } } } + file_api_v2_inbox_service_proto_msgTypes[0].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_api_v2_inbox_service_proto_rawDesc, - NumEnums: 1, + NumEnums: 2, NumMessages: 7, NumExtensions: 0, NumServices: 1, diff --git a/proto/gen/store/README.md b/proto/gen/store/README.md index 05771de1..08e5dc1d 100644 --- a/proto/gen/store/README.md +++ b/proto/gen/store/README.md @@ -4,10 +4,15 @@ ## Table of Contents - [store/activity.proto](#store_activity-proto) + - [ActivityMemoCommentPayload](#memos-store-ActivityMemoCommentPayload) + - [ActivityPayload](#memos-store-ActivityPayload) + - [store/common.proto](#store_common-proto) - [store/inbox.proto](#store_inbox-proto) - [InboxMessage](#memos-store-InboxMessage) + - [InboxMessage.Type](#memos-store-InboxMessage-Type) + - [store/system_setting.proto](#store_system_setting-proto) - [BackupConfig](#memos-store-BackupConfig) @@ -30,6 +35,37 @@ ## store/activity.proto + + + +### ActivityMemoCommentPayload + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| memo_id | [int32](#int32) | | | +| related_memo_id | [int32](#int32) | | | + + + + + + + + +### ActivityPayload + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| memo_comment | [ActivityMemoCommentPayload](#memos-store-ActivityMemoCommentPayload) | | | + + + + + @@ -71,9 +107,7 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| title | [string](#string) | | | -| content | [string](#string) | | | -| link | [string](#string) | | | +| type | [InboxMessage.Type](#memos-store-InboxMessage-Type) | | | | activity_id | [int32](#int32) | optional | | @@ -82,6 +116,18 @@ + + + +### InboxMessage.Type + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| TYPE_UNSPECIFIED | 0 | | +| TYPE_MEMO_COMMENT | 1 | | + + diff --git a/proto/gen/store/activity.pb.go b/proto/gen/store/activity.pb.go index 09c5e995..dbf9eb1b 100644 --- a/proto/gen/store/activity.pb.go +++ b/proto/gen/store/activity.pb.go @@ -10,6 +10,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" + sync "sync" ) const ( @@ -19,31 +20,162 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type ActivityMemoCommentPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MemoId int32 `protobuf:"varint,1,opt,name=memo_id,json=memoId,proto3" json:"memo_id,omitempty"` + RelatedMemoId int32 `protobuf:"varint,2,opt,name=related_memo_id,json=relatedMemoId,proto3" json:"related_memo_id,omitempty"` +} + +func (x *ActivityMemoCommentPayload) Reset() { + *x = ActivityMemoCommentPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_store_activity_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ActivityMemoCommentPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ActivityMemoCommentPayload) ProtoMessage() {} + +func (x *ActivityMemoCommentPayload) ProtoReflect() protoreflect.Message { + mi := &file_store_activity_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ActivityMemoCommentPayload.ProtoReflect.Descriptor instead. +func (*ActivityMemoCommentPayload) Descriptor() ([]byte, []int) { + return file_store_activity_proto_rawDescGZIP(), []int{0} +} + +func (x *ActivityMemoCommentPayload) GetMemoId() int32 { + if x != nil { + return x.MemoId + } + return 0 +} + +func (x *ActivityMemoCommentPayload) GetRelatedMemoId() int32 { + if x != nil { + return x.RelatedMemoId + } + return 0 +} + +type ActivityPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MemoComment *ActivityMemoCommentPayload `protobuf:"bytes,1,opt,name=memo_comment,json=memoComment,proto3" json:"memo_comment,omitempty"` +} + +func (x *ActivityPayload) Reset() { + *x = ActivityPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_store_activity_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ActivityPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ActivityPayload) ProtoMessage() {} + +func (x *ActivityPayload) ProtoReflect() protoreflect.Message { + mi := &file_store_activity_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ActivityPayload.ProtoReflect.Descriptor instead. +func (*ActivityPayload) Descriptor() ([]byte, []int) { + return file_store_activity_proto_rawDescGZIP(), []int{1} +} + +func (x *ActivityPayload) GetMemoComment() *ActivityMemoCommentPayload { + if x != nil { + return x.MemoComment + } + return nil +} + var File_store_activity_proto protoreflect.FileDescriptor var file_store_activity_proto_rawDesc = []byte{ 0x0a, 0x14, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0x42, 0x98, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x0d, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, - 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, - 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_store_activity_proto_goTypes = []interface{}{} + 0x6f, 0x72, 0x65, 0x22, 0x5d, 0x0a, 0x1a, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x4d, + 0x65, 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x6f, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0f, 0x72, 0x65, + 0x6c, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x6d, 0x6f, + 0x49, 0x64, 0x22, 0x5d, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x4a, 0x0a, 0x0c, 0x6d, 0x65, 0x6d, 0x6f, 0x5f, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, + 0x74, 0x79, 0x4d, 0x65, 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x42, 0x98, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x0d, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, + 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, + 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, + 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, + 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_store_activity_proto_rawDescOnce sync.Once + file_store_activity_proto_rawDescData = file_store_activity_proto_rawDesc +) + +func file_store_activity_proto_rawDescGZIP() []byte { + file_store_activity_proto_rawDescOnce.Do(func() { + file_store_activity_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_activity_proto_rawDescData) + }) + return file_store_activity_proto_rawDescData +} + +var file_store_activity_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_store_activity_proto_goTypes = []interface{}{ + (*ActivityMemoCommentPayload)(nil), // 0: memos.store.ActivityMemoCommentPayload + (*ActivityPayload)(nil), // 1: memos.store.ActivityPayload +} var file_store_activity_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: memos.store.ActivityPayload.memo_comment:type_name -> memos.store.ActivityMemoCommentPayload + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_store_activity_proto_init() } @@ -51,18 +183,45 @@ func file_store_activity_proto_init() { if File_store_activity_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_store_activity_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActivityMemoCommentPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_store_activity_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActivityPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_store_activity_proto_rawDesc, NumEnums: 0, - NumMessages: 0, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, GoTypes: file_store_activity_proto_goTypes, DependencyIndexes: file_store_activity_proto_depIdxs, + MessageInfos: file_store_activity_proto_msgTypes, }.Build() File_store_activity_proto = out.File file_store_activity_proto_rawDesc = nil diff --git a/proto/gen/store/inbox.pb.go b/proto/gen/store/inbox.pb.go index afa88dfc..50ec5a16 100644 --- a/proto/gen/store/inbox.pb.go +++ b/proto/gen/store/inbox.pb.go @@ -20,15 +20,59 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type InboxMessage_Type int32 + +const ( + InboxMessage_TYPE_UNSPECIFIED InboxMessage_Type = 0 + InboxMessage_TYPE_MEMO_COMMENT InboxMessage_Type = 1 +) + +// Enum value maps for InboxMessage_Type. +var ( + InboxMessage_Type_name = map[int32]string{ + 0: "TYPE_UNSPECIFIED", + 1: "TYPE_MEMO_COMMENT", + } + InboxMessage_Type_value = map[string]int32{ + "TYPE_UNSPECIFIED": 0, + "TYPE_MEMO_COMMENT": 1, + } +) + +func (x InboxMessage_Type) Enum() *InboxMessage_Type { + p := new(InboxMessage_Type) + *p = x + return p +} + +func (x InboxMessage_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (InboxMessage_Type) Descriptor() protoreflect.EnumDescriptor { + return file_store_inbox_proto_enumTypes[0].Descriptor() +} + +func (InboxMessage_Type) Type() protoreflect.EnumType { + return &file_store_inbox_proto_enumTypes[0] +} + +func (x InboxMessage_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use InboxMessage_Type.Descriptor instead. +func (InboxMessage_Type) EnumDescriptor() ([]byte, []int) { + return file_store_inbox_proto_rawDescGZIP(), []int{0, 0} +} + type InboxMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` - Link string `protobuf:"bytes,3,opt,name=link,proto3" json:"link,omitempty"` - ActivityId *int32 `protobuf:"varint,4,opt,name=activity_id,json=activityId,proto3,oneof" json:"activity_id,omitempty"` + Type InboxMessage_Type `protobuf:"varint,1,opt,name=type,proto3,enum=memos.store.InboxMessage_Type" json:"type,omitempty"` + ActivityId *int32 `protobuf:"varint,2,opt,name=activity_id,json=activityId,proto3,oneof" json:"activity_id,omitempty"` } func (x *InboxMessage) Reset() { @@ -63,25 +107,11 @@ func (*InboxMessage) Descriptor() ([]byte, []int) { return file_store_inbox_proto_rawDescGZIP(), []int{0} } -func (x *InboxMessage) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *InboxMessage) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -func (x *InboxMessage) GetLink() string { +func (x *InboxMessage) GetType() InboxMessage_Type { if x != nil { - return x.Link + return x.Type } - return "" + return InboxMessage_TYPE_UNSPECIFIED } func (x *InboxMessage) GetActivityId() int32 { @@ -96,25 +126,27 @@ var File_store_inbox_proto protoreflect.FileDescriptor var file_store_inbox_proto_rawDesc = []byte{ 0x0a, 0x11, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x22, 0x88, 0x01, 0x0a, 0x0c, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x24, 0x0a, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, - 0x79, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x0a, 0x61, 0x63, - 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x49, 0x64, 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, - 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x42, 0x95, 0x01, 0x0a, 0x0f, - 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, - 0x0a, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, - 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, - 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, - 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, - 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0xad, 0x01, 0x0a, 0x0c, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x32, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, + 0x62, 0x6f, 0x78, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, + 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x0a, 0x61, 0x63, + 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x49, 0x64, 0x88, 0x01, 0x01, 0x22, 0x33, 0x0a, 0x04, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x10, 0x01, + 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, + 0x42, 0x95, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x42, 0x0a, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, + 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, + 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, + 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, + 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, + 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -129,16 +161,19 @@ func file_store_inbox_proto_rawDescGZIP() []byte { return file_store_inbox_proto_rawDescData } +var file_store_inbox_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_store_inbox_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_store_inbox_proto_goTypes = []interface{}{ - (*InboxMessage)(nil), // 0: memos.store.InboxMessage + (InboxMessage_Type)(0), // 0: memos.store.InboxMessage.Type + (*InboxMessage)(nil), // 1: memos.store.InboxMessage } var file_store_inbox_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: memos.store.InboxMessage.type:type_name -> memos.store.InboxMessage.Type + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_store_inbox_proto_init() } @@ -166,13 +201,14 @@ func file_store_inbox_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_store_inbox_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, GoTypes: file_store_inbox_proto_goTypes, DependencyIndexes: file_store_inbox_proto_depIdxs, + EnumInfos: file_store_inbox_proto_enumTypes, MessageInfos: file_store_inbox_proto_msgTypes, }.Build() File_store_inbox_proto = out.File diff --git a/proto/store/activity.proto b/proto/store/activity.proto index 5990f042..d6613bd9 100644 --- a/proto/store/activity.proto +++ b/proto/store/activity.proto @@ -3,3 +3,12 @@ syntax = "proto3"; package memos.store; option go_package = "gen/store"; + +message ActivityMemoCommentPayload { + int32 memo_id = 1; + int32 related_memo_id = 2; +} + +message ActivityPayload { + ActivityMemoCommentPayload memo_comment = 1; +} diff --git a/proto/store/inbox.proto b/proto/store/inbox.proto index 1955bab9..f4bd4cf0 100644 --- a/proto/store/inbox.proto +++ b/proto/store/inbox.proto @@ -5,8 +5,10 @@ package memos.store; option go_package = "gen/store"; message InboxMessage { - string title = 1; - string content = 2; - string link = 3; - optional int32 activity_id = 4; + enum Type { + TYPE_UNSPECIFIED = 0; + TYPE_MEMO_COMMENT = 1; + } + Type type = 1; + optional int32 activity_id = 2; } diff --git a/server/server.go b/server/server.go index fbfc5db4..256cb0c1 100644 --- a/server/server.go +++ b/server/server.go @@ -2,7 +2,6 @@ package server import ( "context" - "encoding/json" "fmt" "net/http" "strings" @@ -112,10 +111,6 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store } func (s *Server) Start(ctx context.Context) error { - if err := s.createServerStartActivity(ctx); err != nil { - return errors.Wrap(err, "failed to create activity") - } - go s.telegramBot.Start(ctx) go s.backupRunner.Run(ctx) @@ -182,26 +177,6 @@ func (s *Server) getSystemSecretSessionName(ctx context.Context) (string, error) return secretSessionNameValue.Value, nil } -func (s *Server) createServerStartActivity(ctx context.Context) error { - payload := apiv1.ActivityServerStartPayload{ - ServerID: s.ID, - Profile: s.Profile, - } - payloadBytes, err := json.Marshal(payload) - if err != nil { - return errors.Wrap(err, "failed to marshal activity payload") - } - activity, err := s.Store.CreateActivity(ctx, &store.Activity{ - Type: apiv1.ActivityServerStart.String(), - Level: apiv1.ActivityInfo.String(), - Payload: string(payloadBytes), - }) - if err != nil || activity == nil { - return errors.Wrap(err, "failed to create activity") - } - return err -} - func grpcRequestSkipper(c echo.Context) bool { return strings.HasPrefix(c.Request().URL.Path, "/memos.api.v2.") } diff --git a/web/src/grpcweb.ts b/web/src/grpcweb.ts index 347782fb..154b66e1 100644 --- a/web/src/grpcweb.ts +++ b/web/src/grpcweb.ts @@ -1,4 +1,5 @@ import { createChannel, createClientFactory, FetchTransport } from "nice-grpc-web"; +import { InboxServiceDefinition } from "./types/proto/api/v2/inbox_service"; import { MemoServiceDefinition } from "./types/proto/api/v2/memo_service"; import { ResourceServiceDefinition } from "./types/proto/api/v2/resource_service"; import { SystemServiceDefinition } from "./types/proto/api/v2/system_service"; @@ -23,3 +24,5 @@ export const resourceServiceClient = clientFactory.create(ResourceServiceDefinit export const systemServiceClient = clientFactory.create(SystemServiceDefinition, channel); export const tagServiceClient = clientFactory.create(TagServiceDefinition, channel); + +export const inboxServiceClient = clientFactory.create(InboxServiceDefinition, channel);