plane icon indicating copy to clipboard operation
plane copied to clipboard

[WEB-2383] feat: Inbox Settings v2

Open Saurabhkmr98 opened this issue 10 months ago • 3 comments

Description

Inbox settings page UI and APIs

Type of Change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] Feature (non-breaking change which adds functionality)
  • [ ] Improvement (change that would cause existing functionality to not work as expected)
  • [ ] Code refactoring
  • [ ] Performance improvements
  • [ ] Documentation update

Screenshots and Media (if applicable)

Screenshot 2025-02-19 at 3 15 22 PM

Summary by CodeRabbit

  • New Features
    • Introduced workspace-specific notification preference management, allowing users to view and update their notification settings for activities, including task updates and comments.
    • Added a dedicated notifications settings page with an improved interface featuring intuitive toggles for in-app and email notifications.
    • Expanded support for multiple languages, enhancing the localization of notification settings.
    • Refined backend processes to automatically create and update missing notification preferences for a smoother user experience.

Saurabhkmr98 avatar Feb 19 '25 09:02 Saurabhkmr98

Walkthrough

This PR extends the notification system to support workspace-specific user preferences. It introduces a new serializer and model for workspace notifications, new endpoints (GET and PATCH) to manage these preferences, and updates to URL routing and view logic. Additionally, it adds background task functions for mention processing, a MobX store with hooks and services to manage notification settings, multiple new React components for the UI, and expanded localization and TypeScript definitions for notifications.

Changes

File(s) Change Summary
apiserver/plane/app/serializers/{__init__.py, notification.py} Updated import statements and added WorkspaceUserNotificationPreferenceSerializer.
apiserver/plane/app/urls/notification.py Added URL patterns for WorkspaceUserNotificationPreferenceEndpoint.
apiserver/plane/app/views/{__init__.py, notification/base.py, workspace/home.py} Introduced new endpoint WorkspaceUserNotificationPreferenceEndpoint with GET and PATCH methods; added logic to auto-create missing workspace notification preferences.
apiserver/plane/bgtasks/notification_task.py Added functions process_mentions, create_in_app_notifications, and create_email_notifications; refactored mention and subscriber handling in notifications.
apiserver/plane/db/models/{__init__.py, notification.py} Expanded imports and added the WorkspaceUserNotificationPreference model along with the NotificationTransportChoices enum.
packages/constants/src/notification.ts Added new enums (ENotificationSettingsKey, EWorkspaceNotificationTransport) and notification settings constants.
packages/i18n/src/locales/{cs, de, en, es, fr, id, it, ja, ko, pl, pt-BR, ro, ru, sk, ua, vi-VN, zh-CN, zh-TW}/translations.json Introduced a new notification_settings section for locale-specific notification preference translations.
packages/types/src/{index.d.ts, notification.d.ts} Added export for the notification module and new TypeScript types (TNotificationSettings, TWorkspaceUserNotification).
web/app/[workspaceSlug]/(projects)/notifications/settings/{header.tsx, layout.tsx, page.tsx} Created new React components for notifications settings: header, layout, and page.
web/ce/components/inbox/{index.ts, settings/index.ts, settings/root.tsx, settings/update-setting-row.tsx} Added exports and new components for inbox settings, including InboxSettingsRoot and InboxSettingUpdateRow.
web/core/components/inbox/settings/{content-header.tsx, content-wrapper.tsx, update-setting.tsx, index.ts} Introduced new UI components for inbox settings such as InboxSettingsContentHeader, InboxSettingContentWrapper, and InboxSettingUpdate.
web/core/constants/fetch-keys.ts Added new constants: SLACK_USER_CONNECTION_STATUS and NOTIFICATION_SETTINGS.
web/core/hooks/store/notifications/{index.ts, use-workspace-notification-settings.ts} Added and exported the custom hook useWorkspaceNotificationSettings.
web/core/services/workspace-notification-settings.service.ts Added a new service class with methods to fetch and update workspace notification settings.
web/core/store/notifications/workspace-notification-settings.store.ts Introduced a new MobX store for managing workspace notification settings.
web/core/store/root.store.ts Updated the root store to include workspaceNotificationSettings for managing notification settings state.

Sequence Diagram(s)

sequenceDiagram
    participant C as Client
    participant E as Workspace Endpoint
    participant DB as Database/Store
    participant S as Serializer

    %% GET Flow:
    C->>E: GET /workspaces/{slug}/user-notification-preferences
    E->>DB: Query notification preferences
    DB-->>E: Return preferences
    E->>S: Serialize preferences
    S-->>E: Return serialized data
    E-->>C: 200 OK with JSON response

    %% PATCH Flow:
    C->>E: PATCH /workspaces/{slug}/user-notification-preferences/{transport}
    E->>DB: Retrieve & validate preference
    DB-->>E: Return updated record or error (e.g., 404)
    E-->>C: Return success/error response

Possibly related PRs

  • makeplane/plane#6898: Integrates the new WorkspaceUserNotificationPreferenceSerializer with the notification preferences system.
  • makeplane/plane#6882: Complements the current modifications by extending the notification preferences capabilities with workspace-specific settings.

Suggested labels

🌟improvement, 🌐frontend, 🧹chore

Suggested reviewers

  • sriramveeraghanta
  • anmolsinghbhatia
  • prateekshourya29

Poem

In my burrow, soft and light,
I hop through code both day and night.
New endpoints and settings, oh what fun,
Like fresh green clover under the sun.
With each change, I wiggle my nose—
Happy coding, everyone! 🐇✨

✨ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

coderabbitai[bot] avatar Feb 19 '25 09:02 coderabbitai[bot]

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

makeplane[bot] avatar Mar 11 '25 10:03 makeplane[bot]

Can we take this opportunity to add some more useful email notification defaults? New Plane users should have email notifications enabled for them by default. This helps drive the adoption of Plane by ensuring new users don't miss activity pertaining to them. Of course, users can always disable notifications at any time. (Plane Self-hosted Pro v1.8.3).

leedsjb avatar Apr 26 '25 05:04 leedsjb

Hey @leedsjb We will include those changes as part of this enhancement. Thanks for the suggestion.

sriramveeraghanta avatar Apr 28 '25 07:04 sriramveeraghanta

Thank you so much!

leedsjb avatar Apr 28 '25 22:04 leedsjb