Skip to content

feat: user can edit notifications to receive#83

Merged
hmbanan666 merged 2 commits into
mainfrom
notifications-edit
Aug 20, 2025
Merged

feat: user can edit notifications to receive#83
hmbanan666 merged 2 commits into
mainfrom
notifications-edit

Conversation

@hmbanan666
Copy link
Copy Markdown
Collaborator

@hmbanan666 hmbanan666 commented Aug 20, 2025

Summary by CodeRabbit

  • New Features

    • Notification settings modal to choose Atrium and Telegram delivery for task updates.
    • “My Telegram” linking flow, including a prompt in the notifications drawer and a user menu action.
    • Navigation now shows live badges with counts for Epics and Tickets.
  • Behavior Changes

    • Staff receive task-completed notifications only if they’ve enabled them.
  • UI/Style

    • Improved typography on the Epics page for clearer hierarchy.
  • Documentation

    • Updated in-app labels and menu items (e.g., “Настройка уведомлений”, Telegram action) for clarity.

@hmbanan666 hmbanan666 self-assigned this Aug 20, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds user notification preferences to the data model and APIs, introduces a UI to configure them, and gates task-completion notifications based on these preferences. Integrates Telegram linking prompt and modal, updates navigation badges for epics and tickets, tweaks epic page typography, and extends schemas and store to include notifications and telegramUsers.

Changes

Cohort / File(s) Summary
Navigation badges
apps/web-app/app/components/Navigation.vue
Injects ticket and epic stores and shows dynamic badges for epics and tickets; updates tickets icon.
Notification settings UI
apps/web-app/app/components/NotificationsDrawer.vue, apps/web-app/app/components/UserMenu.vue, apps/web-app/app/components/form/UpdateUserNotifications.vue, apps/web-app/app/components/modal/UpdateUserNotifications.vue
Adds Telegram-link prompt and modal, introduces “Настройка уведомлений” modal and form to update per-user notification destinations; wires overlays and events.
User notifications data model & API
apps/web-app/app/stores/user.ts, apps/web-app/shared/services/user.ts, packages/database/src/types.ts, packages/database/src/tables.ts, packages/database/src/repository/user.ts, apps/web-app/server/api/user/id/[userId]/index.patch.ts
Adds NotificationOption type, users.notifications JSONB column, exposes telegramUsers and relations, extends UpdateUser schema with notifications, and ensures typed notifications in user update handler.
Task completion notification gating
apps/web-app/server/api/task/id/[taskId]/complete.post.ts
Creates 'task_completed' notifications only for staff whose preferences include 'task_completed_atrium'.
Epic page typography
apps/web-app/app/pages/epic/index.vue
Adjusts heading (larger) and body text classes (compact) with no logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant ND as NotificationsDrawer
  participant US as userStore
  participant OV as Overlay
  participant MT as ModalAttachTelegram

  U->>ND: Open Notifications Drawer
  ND->>US: Read userStore.telegramUsers
  ND->>ND: Compute atriumUser for botId
  alt No linked Telegram
    ND-->>U: Show Telegram prompt card
    U->>ND: Click "Открыть форму"
    ND->>OV: create(ModalAttachTelegram)
    OV->>MT: Open with { userId, botId }
  else Already linked
    ND-->>U: Hide prompt
  end
Loading
sequenceDiagram
  autonumber
  actor U as User
  participant UM as UserMenu
  participant OV as Overlay
  participant MN as ModalUpdateUserNotifications
  participant F as FormUpdateUserNotifications
  participant US as userStore
  participant API as /api/user/id/{id}

  U->>UM: Open User Menu
  U->>UM: Click "Настройка уведомлений"
  UM->>OV: create(ModalUpdateUserNotifications)
  OV->>MN: Open with { userId }
  MN->>F: Mount form with userId
  F->>US: Load user and current notifications
  U->>F: Edit checkboxes and Submit
  F->>API: PATCH { notifications }
  API-->>F: 200 OK + updated user
  F->>US: Update store with response
  F-->>MN: emit submitted/success
  MN->>OV: overlay.closeAll()
Loading
sequenceDiagram
  autonumber
  participant C as Client
  participant API as POST /task/id/{taskId}/complete
  participant Repo as Repository
  participant Staff as Staff Users[]
  participant Notif as NotificationsService

  C->>API: Complete task
  API->>Repo: Fetch staff excluding performer
  loop For each staff user
    API->>Staff: Inspect user.notifications
    alt Includes 'task_completed_atrium'
      API->>Notif: Create 'task_completed' notification (atrium)
      Notif-->>API: Created
    else Not included
      API-->>API: Skip creation
    end
  end
  API-->>C: Success
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

A bunny taps a bell with glee,
“Tick-tasks done? Notify me!”
Atrium chimes, Telegram sings,
Preferences tied with feathered strings.
Badges bloom on nav so bright—
Hop, click, modal lights the night.
Carrot-OK, we’re set just right. 🥕✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1e313f0 and 18e61ba.

📒 Files selected for processing (13)
  • apps/web-app/app/components/Navigation.vue (2 hunks)
  • apps/web-app/app/components/NotificationsDrawer.vue (2 hunks)
  • apps/web-app/app/components/UserMenu.vue (3 hunks)
  • apps/web-app/app/components/form/UpdateUserNotifications.vue (1 hunks)
  • apps/web-app/app/components/modal/UpdateUserNotifications.vue (1 hunks)
  • apps/web-app/app/pages/epic/index.vue (1 hunks)
  • apps/web-app/app/stores/user.ts (3 hunks)
  • apps/web-app/server/api/task/id/[taskId]/complete.post.ts (1 hunks)
  • apps/web-app/server/api/user/id/[userId]/index.patch.ts (2 hunks)
  • apps/web-app/shared/services/user.ts (1 hunks)
  • packages/database/src/repository/user.ts (1 hunks)
  • packages/database/src/tables.ts (2 hunks)
  • packages/database/src/types.ts (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch notifications-edit

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@sonarqubecloud
Copy link
Copy Markdown

@hmbanan666 hmbanan666 merged commit 09ce8fc into main Aug 20, 2025
7 checks passed
@hmbanan666 hmbanan666 deleted the notifications-edit branch August 20, 2025 13:24
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.

1 participant