Skip to content

Removed comment logic from memo_service #4678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

nathankrieger
Copy link

@nathankrieger nathankrieger commented May 7, 2025

Closes #4677

Moves memo comment logic to its own service, shortening memo_service and aligning better with SRP

@nathankrieger nathankrieger marked this pull request as ready for review May 7, 2025 16:24
@nathankrieger nathankrieger requested a review from boojack as a code owner May 7, 2025 16:24
@boojack boojack requested a review from Copilot May 8, 2025 02:25
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors memo comment functionality by removing it from memo_service and moving it to a dedicated MemoCommentService, thereby reducing the responsibilities of memo_service and complying with the Single Responsibility Principle.

  • Removed CreateMemoComment and ListMemoComments operations from memo_service.
  • Introduced MemoCommentService in both TypeScript proto definitions and server API.
  • Updated client imports and MemoEditor usage to call memoCommentServiceClient instead of memoServiceClient.

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
web/src/types/proto/api/v1/memo_service.ts Removed memo comment request/response messages and corresponding service method definitions.
server/router/api/v1/memo_service.go Removed Create/List memo comment handler functions.
server/router/api/v1/memo_comment_service.go New implementation for memo comment creation and listing.
web/src/components/MemoEditor/index.tsx Updated import and changed service call from memoServiceClient to memoCommentServiceClient; modified fallback logic for memo visibility.
proto/api/v1/memo_service.proto & proto/api/v1/memo_comment_service.proto Adjusted proto definitions and HTTP annotations for the new memo comment operations.
GRPC related generated files Removed memo comment endpoints from MemoService GRPC stubs and added them in MemoCommentService stubs.
Comments suppressed due to low confidence (1)

web/src/components/MemoEditor/index.tsx:104

  • In the MemoEditor, the fallback for memo visibility has been changed from 'PRIVATE' to 'PUBLIC' when disallowPublicVisibility is true. Please verify if this change is intentional or if it may inadvertently expose comments publicly.
visibility = "PUBLIC";

@nathankrieger
Copy link
Author

nathankrieger commented May 8, 2025

@boojack Can I get some guidance on the failing check? I ran the commands to format.

@johnnyjoygh
Copy link
Collaborator

@nathankrieger Please follow the import order sample in https://github.com/usememos/memos/blob/main/server/router/api/v1/memo_service.go#L22

The order should be as follows:

// built-in packages
"context"
"fmt"

// third-party packages
"github.com/lithammer/shortuuid/v4"
"github.com/pkg/errors"

// local packages
"github.com/usememos/memos/server/runner/memopayload"
"github.com/usememos/memos/store"

@johnnyjoygh
Copy link
Collaborator

@nathankrieger There still has linter error, any updates?

@boojack boojack closed this May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Removing Memo Comment Logic From memo_service.go
4 participants