Skip to content

Comments

notes-update#1515

Merged
MrgSub merged 2 commits intostagingfrom
notes-update
Jun 27, 2025
Merged

notes-update#1515
MrgSub merged 2 commits intostagingfrom
notes-update

Conversation

@hiheyhello123
Copy link
Contributor

@hiheyhello123 hiheyhello123 commented Jun 27, 2025

Summary by CodeRabbit

  • New Features

    • Added a visual indicator (sticky note icon) to mail threads that have associated notes.
  • Bug Fixes

    • Ensured that notes now consistently track creation and modification timestamps when created or updated.
  • New Features

    • Note creation and update actions now return the newly created or updated note for improved feedback.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 27, 2025

Walkthrough

This update adds a sticky note icon indicator to mail threads in the UI when they have associated notes, using a custom hook to determine note presence. On the backend, the note creation and update methods now automatically manage timestamps and return the affected records after each operation.

Changes

File(s) Change Summary
apps/mail/components/mail/mail-list.tsx Added sticky note icon for threads with notes using useThreadNotes and conditional rendering.
apps/server/src/main.ts Updated createNote and updateNote methods to handle timestamps and return inserted/updated records.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MailListComponent
    participant useThreadNotes
    participant ZeroDB

    User->>MailListComponent: View thread list
    MailListComponent->>useThreadNotes: Fetch notes for thread
    useThreadNotes->>ZeroDB: Query notes by thread ID
    ZeroDB-->>useThreadNotes: Return notes data
    useThreadNotes-->>MailListComponent: Provide notes info
    MailListComponent->>MailListComponent: Check for notes
    MailListComponent-->>User: Display thread (with sticky note icon if notes exist)
Loading
sequenceDiagram
    participant Client
    participant ZeroDB

    Client->>ZeroDB: createNote(payload)
    ZeroDB->>ZeroDB: Add createdAt, updatedAt timestamps
    ZeroDB->>ZeroDB: Insert note, return inserted record
    ZeroDB-->>Client: Return created note with timestamps

    Client->>ZeroDB: updateNote(noteId, payload)
    ZeroDB->>ZeroDB: Merge updatedAt timestamp
    ZeroDB->>ZeroDB: Update note, return updated record
    ZeroDB-->>Client: Return updated note
Loading

Possibly related PRs

  • Feature/thread badge tooltips #410: Adds tooltips and refactors badge UI in mail-list.tsx, related due to overlapping UI changes in the thread component.
  • Fixing #1345: Refactors NotesManager to delegate note creation and updates to ZeroDB, directly connected to the backend note changes in this PR.
  • major refactoring for notes #485: Refactors note fetching hooks, closely related to the introduction and usage of useThreadNotes in the mail component.

Suggested reviewers

  • MrgSub

Poem

A sticky note appears, so bright and neat,
Beside each thread where notes and memos meet.
With timestamps set and records true,
Backend and frontend both got their due.
Hopping forward, features grow—
🐰 CodeRabbit brings a sticky note glow!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3041531 and 7d98905.

📒 Files selected for processing (2)
  • apps/mail/components/mail/mail-list.tsx (4 hunks)
  • apps/server/src/main.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/mail/components/mail/mail-list.tsx (1)
apps/mail/hooks/use-notes.tsx (1)
  • useThreadNotes (8-29)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
apps/server/src/main.ts (2)

234-236: LGTM! Excellent improvement to database operations.

The automatic timestamp management and returning the created record are both best practices. This ensures data consistency and provides the complete record including any auto-generated fields for immediate use.


246-249: LGTM! Consistent with createNote improvements.

The automatic updatedAt timestamp management and returning the updated record maintains consistency with the createNote method changes and follows database operation best practices.

apps/mail/components/mail/mail-list.tsx (4)

17-17: LGTM! Clean import addition.

Adding the StickyNote icon import from lucide-react follows the existing pattern and supports the new note indicator feature.


60-60: LGTM! Appropriate hook import.

The useThreadNotes hook import enables fetching notes data for the thread, which is essential for the note indicator functionality.


103-107: LGTM! Safe and efficient note checking logic.

The implementation correctly:

  • Uses the useThreadNotes hook with proper fallback (idToUse || '')
  • Computes hasNotes with safe null checks and memoization for performance
  • Handles the case where threadNotes?.notes might be undefined

526-530: LGTM! Clean conditional rendering with good styling.

The sticky note icon implementation:

  • Only renders when notes exist (hasNotes check)
  • Uses appropriate styling with amber colors for visibility
  • Maintains consistency with other inline elements (draft icon pattern)
  • Provides good visual feedback for users
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Collaborator

MrgSub commented Jun 27, 2025

Merge activity

  • Jun 27, 6:42 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 27, 6:43 PM UTC: @MrgSub merged this pull request with Graphite.

@MrgSub MrgSub merged commit dda63ad into staging Jun 27, 2025
6 checks passed
@MrgSub MrgSub deleted the notes-update branch June 27, 2025 18:43
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.

2 participants