Skip to content

Notification channel Delete: #2573

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

Merged

Conversation

luismsousa
Copy link
Contributor

@luismsousa luismsousa commented Jul 2, 2025

Describe your changes

attempt to add the delete button to the notifications view

Write your issue number after "Fixes "

Fixes #2572

Please ensure all items are checked off before requesting a review. "Checked off" means you need to add an "x" character between brackets so they turn into checkmarks.

  • (Do not skip this or your PR will be closed) I deployed the application locally.
  • (Do not skip this or your PR will be closed) I have performed a self-review and testing of my code.
  • I have included the issue # in the PR.
  • I have added i18n support to visible strings (instead of <div>Add</div>, use):
const { t } = useTranslation();
<div>{t('add')}</div>
  • I have not included any files that are not related to my pull request, including package-lock and package-json if dependencies have not changed
  • I didn't use any hardcoded values (otherwise it will not scale, and will make it difficult to maintain consistency across the application).
  • I made sure font sizes, color choices etc are all referenced from the theme. I don't have any hardcoded dimensions.
  • My PR is granular and targeted to one specific feature.
  • I ran npm run format in server and client directories, which automatically formats your code.
  • I took a screenshot or a video and attached to this PR if there is a UI change.

Screenshot 2025-07-02 at 22 28 10
Screenshot 2025-07-02 at 22 28 17

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added the ability to delete notifications when editing, including a "Delete" button with loading state and automatic navigation after deletion.
  • Bug Fixes

    • Improved event handling in notification action menus and table headers to prevent unintended interactions when clicking on menu items or the "Actions" column.
  • Style

    • Updated accessibility label for the notification actions button.
  • Localization

    • Added internationalization support for notification action menu labels and button texts.

attempt to add the delete button to the notifications view
Copy link

coderabbitai bot commented Jul 2, 2025

Walkthrough

The changes improve event handling in the notifications UI, preventing unintended event propagation in menus and table headers. Additionally, the ability to delete a notification channel is implemented in the notification creation/editing page, including UI updates and navigation after deletion. Breadcrumbs now reflect whether the user is creating or editing a notification.

Changes

File(s) Change Summary
client/src/Pages/Notifications/components/ActionMenu.jsx Updated event handlers to stop propagation for clicks and mouse downs; changed aria-label for IconButton; added i18n support for menu labels.
client/src/Pages/Notifications/create/index.jsx Added delete notification functionality, dynamic breadcrumbs, conditional "Delete" button with loading state, and translation for button labels.
client/src/Pages/Notifications/index.jsx Added stopPropagation to the "actions" column header onClick handler.
client/src/Hooks/useNotifications.js Modified deleteNotification function to accept an optional callback and invoke it conditionally.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CreateNotificationsPage
    participant useDeleteNotification
    participant Router

    User->>CreateNotificationsPage: Clicks "Delete" button
    CreateNotificationsPage->>useDeleteNotification: deleteNotification(notificationId)
    useDeleteNotification-->>CreateNotificationsPage: Resolves deletion
    CreateNotificationsPage->>Router: Navigate to /notifications
Loading

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Ability to delete a notification channel (#2572): Delete button in details view, deletion logic, navigation after deletion
Prevent unintended navigation when clicking delete in the action menu (#2572)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes were found. All changes are related to the objectives in the linked issue.


Why did the Canadian developer refuse to propagate events? Because, unlike their American neighbors, they always politely stop and say "sorry" before moving on!


📜 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 292c7fd and 9954a74.

📒 Files selected for processing (1)
  • client/src/Pages/Notifications/create/index.jsx (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • client/src/Pages/Notifications/create/index.jsx
✨ 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

@llamapreview llamapreview bot left a comment

Choose a reason for hiding this comment

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

Auto Pull Request Review from LlamaPReview

1. Overview

1.1 Core Changes

  • Primary purpose and scope: Adds delete functionality for notification channels
  • Key components modified: ActionMenu, CreateNotifications page, Notifications page
  • Cross-component impacts: Minimal impact; changes localized to notification management
  • Business value alignment: Solves user request (#2572) for channel management capabilities

1.2 Technical Architecture

  • System design modifications: Added delete hook and UI components
  • Component interaction changes: Enhanced event propagation handling
  • Integration points impact: Notification service API integration extended
  • Dependency changes: Added useDeleteNotification hook

2. Critical Findings

2.1 Must Fix (P0🔴)

Issue: Missing error handling for delete operation

  • Analysis Confidence: High
  • Impact: Failed deletions won't notify users, causing UI inconsistency
  • Resolution: Add error handling to onDelete function

2.2 Should Fix (P1🟡)

Issue: Incomplete test coverage for delete functionality

  • Analysis Confidence: Medium
  • Impact: Potential undetected regression in notification management
  • Suggested Solution: Add unit tests for delete success/failure cases

2.3 Consider (P2🟢)

Area: Delete confirmation dialog

  • Analysis Confidence: Medium
  • Improvement Opportunity: Prevent accidental deletions with confirmation prompt

2.4 Summary of Action Items

  • P0: Implement delete error handling (immediate)
  • P1: Add test coverage (before next release)
  • P2: Add confirmation dialog (future enhancement)

3. Technical Analysis

3.1 Code Logic Analysis

📁 client/src/Pages/Notifications/create/index.jsx - onDelete

  • Submitted PR Code:
    const onDelete = () => {
      if (notificationId) {
        deleteNotification(notificationId, () => {
          navigate("/notifications");
        });
      }
    };
  • Analysis:
    • Current logic lacks error handling for failed deletions
    • Edge case: Network failure leaves UI in inconsistent state
    • Business impact: Users won't know if deletion failed
  • LlamaPReview Suggested Improvements:
    const onDelete = () => {
      if (notificationId) {
        deleteNotification(notificationId, 
          () => navigate("/notifications"),  // Success callback
          (error) => {                        // Error handling
            createToast({ 
              body: `Delete failed: ${error.message}`,
              type: "error" 
            });
          }
        );
      }
    };
  • Improvement rationale:
    • Prevents silent failures
    • Maintains UI consistency
    • Improves user experience

📁 client/src/Pages/Notifications/components/ActionMenu.jsx - Event Handling

  • Submitted PR Code:
    const handleClose = (event) => {
      if (event) {
        event.stopPropagation();
      }
      setAnchorEl(null);
    };
  • Analysis:
    • Robust event propagation prevention
    • Prevents unintended UI interactions
    • Maintains component isolation
  • LlamaPReview Suggested Improvements: [No improvements needed]

3.2 Key Quality Aspects

  • Testing strategy and coverage: Requires additional tests for delete functionality
  • Documentation needs: Update API docs for new delete endpoint

4. Overall Evaluation

  • Technical assessment: Well-structured implementation following existing patterns
  • Business impact: Solves critical user need for channel management
  • Risk evaluation: Low risk with P0 fix implemented
  • Notable positive aspects:
    • Excellent event propagation handling
    • Clean component separation
    • Proper conditional rendering
  • Implementation quality: High quality with minor gap in error handling
  • Final recommendation: Request Changes (due to P0 error handling requirement)

💡 LlamaPReview Community
Have feedback on this AI Code review tool? Join our GitHub Discussions to share your thoughts and help shape the future of LlamaPReview.

@luismsousa
Copy link
Contributor Author

I'm not a developer, so please check this thoroughly.

@gorkem-bwl gorkem-bwl requested a review from ajhollid July 2, 2025 16:29
@gorkem-bwl
Copy link
Contributor

I'm not a developer, so please check this thoroughly.

Not sure I get it - how did you develop this code? It requires running the app locally as per the PR requirements in the PR.

@luismsousa
Copy link
Contributor Author

luismsousa commented Jul 2, 2025

I'm not a developer, so please check this thoroughly.

Not sure I get it - how did you develop this code? It requires running the app locally as per the PR requirements in the PR.

@gorkem-bwl I'm a devops engineer by day and I'm self training as a backend engineer in my spare time. So please be gentle :) . I've tried to replicate delete functionality in the frontend as I noticed that the backend method was already implemented in the server

@luismsousa
Copy link
Contributor Author

regarding I have added i18n support to visible strings (instead of <div>Add</div>, use):

I don't think the other buttons have this so I've refrained from touching it for now as I'm not familiar with i18n concepts from a developer's perspective.

@gorkem-bwl
Copy link
Contributor

regarding I have added i18n support to visible strings (instead of <div>Add</div>, use):

I don't think the other buttons have this so I've refrained from touching it for now as I'm not familiar with i18n concepts from a developer's perspective.

In fact those should be added as well by checking how it works in other parts of the platform, so can you modify your PR ? Many thanks.

@luismsousa
Copy link
Contributor Author

@gorkem-bwl I had a cheeky look at client/src/Components/Dialog/index.jsx and client/src/locales/en.json and it seems straightforward. I've updated the PR.

@luismsousa
Copy link
Contributor Author

@coderabbitai review

Copy link

coderabbitai bot commented Jul 2, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@luismsousa
Copy link
Contributor Author

aligning the dropdown menu to also use the delete phraseology
Screenshot 2025-07-02 at 23 18 18
Screenshot 2025-07-02 at 23 18 09

Copy link
Collaborator

@ajhollid ajhollid left a comment

Choose a reason for hiding this comment

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

Looks good for the most part! The deleteNotification method isn't used quite correctly here, but it is a quick fix.

We also don't need to provide default values for translations so those can all be dropped.

Thanks for your contribution!

Copy link
Collaborator

@ajhollid ajhollid left a comment

Choose a reason for hiding this comment

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

Thanks for making revisions here, we still need to drop those default strings and I think we're good to go.

@gorkem-bwl
Copy link
Contributor

Hi @luismsousa - we are about to make the final release so wanted to check back here :)

@luismsousa
Copy link
Contributor Author

luismsousa commented Jul 7, 2025

@gorkem-bwl hopefully that will do it :) thanks for your patience. 🤖

@gorkem-bwl
Copy link
Contributor

@gorkem-bwl hopefully that will do it :) thanks for your patience. 🤖

Thanks for this @luismsousa - really appreciated. :)

@ajhollid ajhollid merged commit 961c398 into bluewave-labs:develop Jul 7, 2025
1 check passed
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.

Ability to delete a notification channel
3 participants