From 0a429a899fce775132058948de1114b9b04dd5c5 Mon Sep 17 00:00:00 2001 From: Johnny Date: Sun, 9 Feb 2025 11:48:53 +0800 Subject: [PATCH] chore: remove version update activity --- proto/api/v1/activity_service.proto | 6 - proto/gen/api/v1/activity_service.pb.go | 174 ++++++------------ proto/gen/apidocs.swagger.yaml | 8 - proto/gen/store/activity.pb.go | 125 ++++--------- proto/store/activity.proto | 5 - server/router/api/v1/activity_service.go | 5 - server/runner/version/runner.go | 140 -------------- server/runner/version/runner_test.go | 1 - server/server.go | 4 - store/activity.go | 3 +- .../components/Inbox/VersionUpdateMessage.tsx | 101 ---------- web/src/pages/Inboxes.tsx | 3 - 12 files changed, 87 insertions(+), 488 deletions(-) delete mode 100644 server/runner/version/runner.go delete mode 100644 server/runner/version/runner_test.go delete mode 100644 web/src/components/Inbox/VersionUpdateMessage.tsx diff --git a/proto/api/v1/activity_service.proto b/proto/api/v1/activity_service.proto index cfb19087..c89de6d5 100644 --- a/proto/api/v1/activity_service.proto +++ b/proto/api/v1/activity_service.proto @@ -36,7 +36,6 @@ message Activity { message ActivityPayload { ActivityMemoCommentPayload memo_comment = 1; - ActivityVersionUpdatePayload version_update = 2; } // ActivityMemoCommentPayload represents the payload of a memo comment activity. @@ -48,11 +47,6 @@ message ActivityMemoCommentPayload { string related_memo = 2; } -message ActivityVersionUpdatePayload { - // The updated version of memos. - string version = 1; -} - message GetActivityRequest { // The name of the activity. // Format: activities/{id}, id is the system generated auto-incremented id. diff --git a/proto/gen/api/v1/activity_service.pb.go b/proto/gen/api/v1/activity_service.pb.go index a59acc20..469cd7fc 100644 --- a/proto/gen/api/v1/activity_service.pb.go +++ b/proto/gen/api/v1/activity_service.pb.go @@ -116,9 +116,8 @@ func (x *Activity) GetPayload() *ActivityPayload { } type ActivityPayload struct { - state protoimpl.MessageState `protogen:"open.v1"` - MemoComment *ActivityMemoCommentPayload `protobuf:"bytes,1,opt,name=memo_comment,json=memoComment,proto3" json:"memo_comment,omitempty"` - VersionUpdate *ActivityVersionUpdatePayload `protobuf:"bytes,2,opt,name=version_update,json=versionUpdate,proto3" json:"version_update,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + MemoComment *ActivityMemoCommentPayload `protobuf:"bytes,1,opt,name=memo_comment,json=memoComment,proto3" json:"memo_comment,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -160,13 +159,6 @@ func (x *ActivityPayload) GetMemoComment() *ActivityMemoCommentPayload { return nil } -func (x *ActivityPayload) GetVersionUpdate() *ActivityVersionUpdatePayload { - if x != nil { - return x.VersionUpdate - } - return nil -} - // ActivityMemoCommentPayload represents the payload of a memo comment activity. type ActivityMemoCommentPayload struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -223,51 +215,6 @@ func (x *ActivityMemoCommentPayload) GetRelatedMemo() string { return "" } -type ActivityVersionUpdatePayload struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The updated version of memos. - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ActivityVersionUpdatePayload) Reset() { - *x = ActivityVersionUpdatePayload{} - mi := &file_api_v1_activity_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ActivityVersionUpdatePayload) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ActivityVersionUpdatePayload) ProtoMessage() {} - -func (x *ActivityVersionUpdatePayload) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_activity_service_proto_msgTypes[3] - 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 ActivityVersionUpdatePayload.ProtoReflect.Descriptor instead. -func (*ActivityVersionUpdatePayload) Descriptor() ([]byte, []int) { - return file_api_v1_activity_service_proto_rawDescGZIP(), []int{3} -} - -func (x *ActivityVersionUpdatePayload) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - type GetActivityRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // The name of the activity. @@ -279,7 +226,7 @@ type GetActivityRequest struct { func (x *GetActivityRequest) Reset() { *x = GetActivityRequest{} - mi := &file_api_v1_activity_service_proto_msgTypes[4] + mi := &file_api_v1_activity_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -291,7 +238,7 @@ func (x *GetActivityRequest) String() string { func (*GetActivityRequest) ProtoMessage() {} func (x *GetActivityRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_activity_service_proto_msgTypes[4] + mi := &file_api_v1_activity_service_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -304,7 +251,7 @@ func (x *GetActivityRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetActivityRequest.ProtoReflect.Descriptor instead. func (*GetActivityRequest) Descriptor() ([]byte, []int) { - return file_api_v1_activity_service_proto_rawDescGZIP(), []int{4} + return file_api_v1_activity_service_proto_rawDescGZIP(), []int{3} } func (x *GetActivityRequest) GetName() string { @@ -341,50 +288,41 @@ var file_api_v1_activity_service_proto_rawDesc = string([]byte{ 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, - 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0xb1, 0x01, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, - 0x76, 0x69, 0x74, 0x79, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x4b, 0x0a, 0x0c, 0x6d, - 0x65, 0x6d, 0x6f, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 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, 0x12, 0x51, 0x0a, 0x0e, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x0d, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x53, 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, 0x12, 0x0a, 0x04, 0x6d, 0x65, 0x6d, - 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x12, 0x21, 0x0a, - 0x0c, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x6d, 0x6f, - 0x22, 0x38, 0x0a, 0x1c, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x28, 0x0a, 0x12, 0x47, 0x65, - 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 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, 0x32, 0x86, 0x01, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, - 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x73, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x41, - 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, - 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, - 0x79, 0x22, 0x2a, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, - 0x12, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, - 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xac, 0x01, - 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x42, 0x14, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 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, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, - 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, - 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, - 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 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, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x5e, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x76, + 0x69, 0x74, 0x79, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x4b, 0x0a, 0x0c, 0x6d, 0x65, + 0x6d, 0x6f, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 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, 0x22, 0x53, 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, 0x12, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x6c, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x6d, 0x6f, 0x22, 0x28, 0x0a, 0x12, + 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 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, 0x32, 0x86, 0x01, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x76, + 0x69, 0x74, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x73, 0x0a, 0x0b, 0x47, 0x65, + 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, + 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, + 0x69, 0x74, 0x79, 0x22, 0x2a, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, + 0x65, 0x3d, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x69, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x42, + 0xac, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x42, 0x14, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 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, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, + 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, + 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, + 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, + 0x31, 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, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, }) var ( @@ -399,27 +337,25 @@ func file_api_v1_activity_service_proto_rawDescGZIP() []byte { return file_api_v1_activity_service_proto_rawDescData } -var file_api_v1_activity_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_api_v1_activity_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_api_v1_activity_service_proto_goTypes = []any{ - (*Activity)(nil), // 0: memos.api.v1.Activity - (*ActivityPayload)(nil), // 1: memos.api.v1.ActivityPayload - (*ActivityMemoCommentPayload)(nil), // 2: memos.api.v1.ActivityMemoCommentPayload - (*ActivityVersionUpdatePayload)(nil), // 3: memos.api.v1.ActivityVersionUpdatePayload - (*GetActivityRequest)(nil), // 4: memos.api.v1.GetActivityRequest - (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp + (*Activity)(nil), // 0: memos.api.v1.Activity + (*ActivityPayload)(nil), // 1: memos.api.v1.ActivityPayload + (*ActivityMemoCommentPayload)(nil), // 2: memos.api.v1.ActivityMemoCommentPayload + (*GetActivityRequest)(nil), // 3: memos.api.v1.GetActivityRequest + (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp } var file_api_v1_activity_service_proto_depIdxs = []int32{ - 5, // 0: memos.api.v1.Activity.create_time:type_name -> google.protobuf.Timestamp + 4, // 0: memos.api.v1.Activity.create_time:type_name -> google.protobuf.Timestamp 1, // 1: memos.api.v1.Activity.payload:type_name -> memos.api.v1.ActivityPayload 2, // 2: memos.api.v1.ActivityPayload.memo_comment:type_name -> memos.api.v1.ActivityMemoCommentPayload - 3, // 3: memos.api.v1.ActivityPayload.version_update:type_name -> memos.api.v1.ActivityVersionUpdatePayload - 4, // 4: memos.api.v1.ActivityService.GetActivity:input_type -> memos.api.v1.GetActivityRequest - 0, // 5: memos.api.v1.ActivityService.GetActivity:output_type -> memos.api.v1.Activity - 5, // [5:6] is the sub-list for method output_type - 4, // [4:5] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 3, // 3: memos.api.v1.ActivityService.GetActivity:input_type -> memos.api.v1.GetActivityRequest + 0, // 4: memos.api.v1.ActivityService.GetActivity:output_type -> memos.api.v1.Activity + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_api_v1_activity_service_proto_init() } @@ -433,7 +369,7 @@ func file_api_v1_activity_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_activity_service_proto_rawDesc), len(file_api_v1_activity_service_proto_rawDesc)), NumEnums: 0, - NumMessages: 5, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index 93420686..390242c2 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -2092,14 +2092,6 @@ definitions: properties: memoComment: $ref: '#/definitions/apiv1ActivityMemoCommentPayload' - versionUpdate: - $ref: '#/definitions/apiv1ActivityVersionUpdatePayload' - apiv1ActivityVersionUpdatePayload: - type: object - properties: - version: - type: string - description: The updated version of memos. apiv1FieldMapping: type: object properties: diff --git a/proto/gen/store/activity.pb.go b/proto/gen/store/activity.pb.go index 46d24d5c..5dd65b6b 100644 --- a/proto/gen/store/activity.pb.go +++ b/proto/gen/store/activity.pb.go @@ -73,61 +73,16 @@ func (x *ActivityMemoCommentPayload) GetRelatedMemoId() int32 { return 0 } -type ActivityVersionUpdatePayload struct { - state protoimpl.MessageState `protogen:"open.v1"` - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ActivityVersionUpdatePayload) Reset() { - *x = ActivityVersionUpdatePayload{} - mi := &file_store_activity_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ActivityVersionUpdatePayload) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ActivityVersionUpdatePayload) ProtoMessage() {} - -func (x *ActivityVersionUpdatePayload) ProtoReflect() protoreflect.Message { - mi := &file_store_activity_proto_msgTypes[1] - 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 ActivityVersionUpdatePayload.ProtoReflect.Descriptor instead. -func (*ActivityVersionUpdatePayload) Descriptor() ([]byte, []int) { - return file_store_activity_proto_rawDescGZIP(), []int{1} -} - -func (x *ActivityVersionUpdatePayload) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - type ActivityPayload struct { - state protoimpl.MessageState `protogen:"open.v1"` - MemoComment *ActivityMemoCommentPayload `protobuf:"bytes,1,opt,name=memo_comment,json=memoComment,proto3" json:"memo_comment,omitempty"` - VersionUpdate *ActivityVersionUpdatePayload `protobuf:"bytes,2,opt,name=version_update,json=versionUpdate,proto3" json:"version_update,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + MemoComment *ActivityMemoCommentPayload `protobuf:"bytes,1,opt,name=memo_comment,json=memoComment,proto3" json:"memo_comment,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *ActivityPayload) Reset() { *x = ActivityPayload{} - mi := &file_store_activity_proto_msgTypes[2] + mi := &file_store_activity_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -139,7 +94,7 @@ func (x *ActivityPayload) String() string { func (*ActivityPayload) ProtoMessage() {} func (x *ActivityPayload) ProtoReflect() protoreflect.Message { - mi := &file_store_activity_proto_msgTypes[2] + mi := &file_store_activity_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -152,7 +107,7 @@ func (x *ActivityPayload) ProtoReflect() protoreflect.Message { // Deprecated: Use ActivityPayload.ProtoReflect.Descriptor instead. func (*ActivityPayload) Descriptor() ([]byte, []int) { - return file_store_activity_proto_rawDescGZIP(), []int{2} + return file_store_activity_proto_rawDescGZIP(), []int{1} } func (x *ActivityPayload) GetMemoComment() *ActivityMemoCommentPayload { @@ -162,13 +117,6 @@ func (x *ActivityPayload) GetMemoComment() *ActivityMemoCommentPayload { return nil } -func (x *ActivityPayload) GetVersionUpdate() *ActivityVersionUpdatePayload { - if x != nil { - return x.VersionUpdate - } - return nil -} - var File_store_activity_proto protoreflect.FileDescriptor var file_store_activity_proto_rawDesc = string([]byte{ @@ -180,32 +128,23 @@ var file_store_activity_proto_rawDesc = string([]byte{ 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, 0x38, 0x0a, 0x1c, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xaf, 0x01, 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, 0x12, 0x50, 0x0a, 0x0e, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, - 0x0d, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 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, + 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 ( @@ -220,20 +159,18 @@ func file_store_activity_proto_rawDescGZIP() []byte { return file_store_activity_proto_rawDescData } -var file_store_activity_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_store_activity_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_store_activity_proto_goTypes = []any{ - (*ActivityMemoCommentPayload)(nil), // 0: memos.store.ActivityMemoCommentPayload - (*ActivityVersionUpdatePayload)(nil), // 1: memos.store.ActivityVersionUpdatePayload - (*ActivityPayload)(nil), // 2: memos.store.ActivityPayload + (*ActivityMemoCommentPayload)(nil), // 0: memos.store.ActivityMemoCommentPayload + (*ActivityPayload)(nil), // 1: memos.store.ActivityPayload } var file_store_activity_proto_depIdxs = []int32{ 0, // 0: memos.store.ActivityPayload.memo_comment:type_name -> memos.store.ActivityMemoCommentPayload - 1, // 1: memos.store.ActivityPayload.version_update:type_name -> memos.store.ActivityVersionUpdatePayload - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 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() } @@ -247,7 +184,7 @@ func file_store_activity_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_activity_proto_rawDesc), len(file_store_activity_proto_rawDesc)), NumEnums: 0, - NumMessages: 3, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/store/activity.proto b/proto/store/activity.proto index d5c7bdf1..d6613bd9 100644 --- a/proto/store/activity.proto +++ b/proto/store/activity.proto @@ -9,11 +9,6 @@ message ActivityMemoCommentPayload { int32 related_memo_id = 2; } -message ActivityVersionUpdatePayload { - string version = 1; -} - message ActivityPayload { ActivityMemoCommentPayload memo_comment = 1; - ActivityVersionUpdatePayload version_update = 2; } diff --git a/server/router/api/v1/activity_service.go b/server/router/api/v1/activity_service.go index 20420a67..b315fef5 100644 --- a/server/router/api/v1/activity_service.go +++ b/server/router/api/v1/activity_service.go @@ -70,10 +70,5 @@ func (s *APIV1Service) convertActivityPayloadFromStore(ctx context.Context, payl RelatedMemo: fmt.Sprintf("%s%s", MemoNamePrefix, relatedMemo.UID), } } - if payload.VersionUpdate != nil { - v2Payload.VersionUpdate = &v1pb.ActivityVersionUpdatePayload{ - Version: payload.VersionUpdate.Version, - } - } return v2Payload, nil } diff --git a/server/runner/version/runner.go b/server/runner/version/runner.go deleted file mode 100644 index 0dc0afed..00000000 --- a/server/runner/version/runner.go +++ /dev/null @@ -1,140 +0,0 @@ -// Package version provides a runner to check the latest version of the application. -package version - -import ( - "bytes" - "context" - "encoding/json" - "net/http" - "time" - - "github.com/pkg/errors" - "golang.org/x/exp/slog" - - storepb "github.com/usememos/memos/proto/gen/store" - "github.com/usememos/memos/server/profile" - "github.com/usememos/memos/server/version" - "github.com/usememos/memos/store" -) - -type Runner struct { - Store *store.Store - Profile *profile.Profile -} - -func NewRunner(store *store.Store, profile *profile.Profile) *Runner { - return &Runner{ - Store: store, - Profile: profile, - } -} - -// Schedule checker every 8 hours. -const runnerInterval = time.Hour * 8 - -func (r *Runner) Run(ctx context.Context) { - ticker := time.NewTicker(runnerInterval) - defer ticker.Stop() - - for { - select { - case <-ticker.C: - r.RunOnce(ctx) - case <-ctx.Done(): - return - } - } -} - -func (r *Runner) RunOnce(ctx context.Context) { - r.Check(ctx) -} - -func (r *Runner) Check(ctx context.Context) { - latestVersion, err := r.GetLatestVersion() - if err != nil { - return - } - if !version.IsVersionGreaterThan(latestVersion, version.GetCurrentVersion(r.Profile.Mode)) { - return - } - - versionUpdateActivityType := store.ActivityTypeVersionUpdate - list, err := r.Store.ListActivities(ctx, &store.FindActivity{ - Type: &versionUpdateActivityType, - }) - if err != nil { - return - } - - shouldNotify := true - if len(list) > 0 { - latestVersionUpdateActivity := list[0] - if latestVersionUpdateActivity.Payload != nil && version.IsVersionGreaterOrEqualThan(latestVersionUpdateActivity.Payload.VersionUpdate.Version, latestVersion) { - shouldNotify = false - } - } - - if !shouldNotify { - return - } - - // Create version update activity and inbox message. - activity := &store.Activity{ - CreatorID: store.SystemBotID, - Type: store.ActivityTypeVersionUpdate, - Level: store.ActivityLevelInfo, - Payload: &storepb.ActivityPayload{ - VersionUpdate: &storepb.ActivityVersionUpdatePayload{ - Version: latestVersion, - }, - }, - } - if _, err := r.Store.CreateActivity(ctx, activity); err != nil { - return - } - - hostUserRole := store.RoleHost - users, err := r.Store.ListUsers(ctx, &store.FindUser{ - Role: &hostUserRole, - }) - if err != nil { - return - } - if len(users) == 0 { - return - } - - hostUser := users[0] - if _, err := r.Store.CreateInbox(ctx, &store.Inbox{ - SenderID: store.SystemBotID, - ReceiverID: hostUser.ID, - Status: store.UNREAD, - Message: &storepb.InboxMessage{ - Type: storepb.InboxMessage_VERSION_UPDATE, - ActivityId: &activity.ID, - }, - }); err != nil { - slog.Error("failed to create inbox", slog.String("error", err.Error())) - } -} - -func (*Runner) GetLatestVersion() (string, error) { - response, err := http.Get("https://www.usememos.com/api/version") - if err != nil { - return "", errors.Wrap(err, "failed to make http request") - } - defer response.Body.Close() - - buf := &bytes.Buffer{} - _, err = buf.ReadFrom(response.Body) - if err != nil { - return "", errors.Wrap(err, "fail to read response body") - } - - version := "" - if err = json.Unmarshal(buf.Bytes(), &version); err != nil { - return "", errors.Wrap(err, "fail to unmarshal get version response") - } - return version, nil -} diff --git a/server/runner/version/runner_test.go b/server/runner/version/runner_test.go deleted file mode 100644 index f37d99d0..00000000 --- a/server/runner/version/runner_test.go +++ /dev/null @@ -1 +0,0 @@ -package version diff --git a/server/server.go b/server/server.go index 43b986fa..bb481d23 100644 --- a/server/server.go +++ b/server/server.go @@ -24,7 +24,6 @@ import ( "github.com/usememos/memos/server/router/rss" "github.com/usememos/memos/server/runner/memopayload" "github.com/usememos/memos/server/runner/s3presign" - "github.com/usememos/memos/server/runner/version" "github.com/usememos/memos/store" ) @@ -144,14 +143,11 @@ func (s *Server) Shutdown(ctx context.Context) { func (s *Server) StartBackgroundRunners(ctx context.Context) { s3presignRunner := s3presign.NewRunner(s.Store) s3presignRunner.RunOnce(ctx) - versionRunner := version.NewRunner(s.Store, s.Profile) - versionRunner.RunOnce(ctx) memopayloadRunner := memopayload.NewRunner(s.Store) // Rebuild all memos' payload after server starts. memopayloadRunner.RunOnce(ctx) go s3presignRunner.Run(ctx) - go versionRunner.Run(ctx) } func (s *Server) getOrUpsertWorkspaceBasicSetting(ctx context.Context) (*storepb.WorkspaceBasicSetting, error) { diff --git a/store/activity.go b/store/activity.go index 59078e21..eb5b7c93 100644 --- a/store/activity.go +++ b/store/activity.go @@ -9,8 +9,7 @@ import ( type ActivityType string const ( - ActivityTypeMemoComment ActivityType = "MEMO_COMMENT" - ActivityTypeVersionUpdate ActivityType = "VERSION_UPDATE" + ActivityTypeMemoComment ActivityType = "MEMO_COMMENT" ) func (t ActivityType) String() string { diff --git a/web/src/components/Inbox/VersionUpdateMessage.tsx b/web/src/components/Inbox/VersionUpdateMessage.tsx deleted file mode 100644 index 9c0c499a..00000000 --- a/web/src/components/Inbox/VersionUpdateMessage.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import { Tooltip } from "@mui/joy"; -import { ArrowUpIcon, InboxIcon } from "lucide-react"; -import { useEffect, useState } from "react"; -import toast from "react-hot-toast"; -import { activityServiceClient } from "@/grpcweb"; -import { activityNamePrefix } from "@/store/v1"; -import { userStore } from "@/store/v2"; -import { Activity } from "@/types/proto/api/v1/activity_service"; -import { Inbox, Inbox_Status } from "@/types/proto/api/v1/inbox_service"; -import { cn } from "@/utils"; -import { useTranslate } from "@/utils/i18n"; - -interface Props { - inbox: Inbox; -} - -const VersionUpdateMessage = ({ inbox }: Props) => { - const t = useTranslate(); - const [activity, setActivity] = useState(undefined); - - useEffect(() => { - if (!inbox.activityId) { - return; - } - - (async () => { - const activity = await activityServiceClient.getActivity({ - name: `${activityNamePrefix}${inbox.activityId}`, - }); - setActivity(activity); - })(); - }, [inbox.activityId]); - - const handleNavigate = () => { - if (!activity?.payload?.versionUpdate?.version) { - return; - } - - window.open(`https://github.com/usememos/memos/releases/tag/v${activity?.payload?.versionUpdate?.version}`); - if (inbox.status === Inbox_Status.UNREAD) { - handleArchiveMessage(true); - } - }; - - const handleArchiveMessage = async (silence = false) => { - await userStore.updateInbox( - { - name: inbox.name, - status: Inbox_Status.ARCHIVED, - }, - ["status"], - ); - if (!silence) { - toast.success(t("message.archived-successfully")); - } - }; - - return ( -
-
- - - -
-
-
- {inbox.createTime?.toLocaleString()} -
- {inbox.status === Inbox_Status.UNREAD && ( - - handleArchiveMessage()} /> - - )} -
-
-

- {t("inbox.version-update", { - version: activity?.payload?.versionUpdate?.version, - })} -

-
-
- ); -}; - -export default VersionUpdateMessage; diff --git a/web/src/pages/Inboxes.tsx b/web/src/pages/Inboxes.tsx index 2e40b161..fd46e6cb 100644 --- a/web/src/pages/Inboxes.tsx +++ b/web/src/pages/Inboxes.tsx @@ -3,7 +3,6 @@ import { observer } from "mobx-react-lite"; import { useEffect } from "react"; import Empty from "@/components/Empty"; import MemoCommentMessage from "@/components/Inbox/MemoCommentMessage"; -import VersionUpdateMessage from "@/components/Inbox/VersionUpdateMessage"; import MobileHeader from "@/components/MobileHeader"; import { userStore } from "@/store/v2"; import { Inbox_Status, Inbox_Type } from "@/types/proto/api/v1/inbox_service"; @@ -44,8 +43,6 @@ const Inboxes = observer(() => { {inboxes.map((inbox) => { if (inbox.type === Inbox_Type.MEMO_COMMENT) { return ; - } else if (inbox.type === Inbox_Type.VERSION_UPDATE) { - return ; } return undefined; })}