Skip to content

Conversation

pheus
Copy link
Contributor

@pheus pheus commented Oct 17, 2025

Fixes: #20301

Introduce a GET-based view that allows a user to clear all unread notifications with a single action from the bell dropdown. The dropdown template is updated to show a “Clear all” control only when unread items exist. This streamlines notification management while preserving existing behavior for dismissing a single notification.

Summary of changes

  • New view: NotificationDismissAllView registered via @register_model_view(Notification, name="dismiss_all", path="dismiss-all", detail=False).

    • Behavior: Deletes only unread notifications for request.user.
    • Response:
      • HTMX requests return the existing htmx/notifications.html partial (so the dropdown re-renders in place).
      • Non-HTMX requests redirect to account:notifications.
  • Template update (dropdown):

    • Uses hx-get to call extras:notification_dismiss_all, hx-target="closest .notifications", and an i18n’d confirm prompt: “Clear all unread notifications?”
    • The action is hidden when there are no unread notifications.
  • No changes to models, REST API, or existing single-item dismiss behavior.

Screenshots

Screenshots (notifications present)

Screenshot 2025-10-17 at 00-36-32 Home NetBox Screenshot 2025-10-17 at 00-36-41 Home NetBox

Screenshots (no notifications)

Screenshot 2025-10-17 at 00-36-58 Home NetBox Screenshot 2025-10-17 at 00-37-04 Home NetBox

Notes for reviewers

  • Happy to adjust copy (“Clear all” vs. “Clear all unread”), icon placement, or spacing if you have a preferred convention.
  • Let me know if you’d like this action to target all notifications (read + unread); currently it’s scoped to unread for parity with the dropdown contents.

Introduce a view to allow users to clear all unread notifications with a
single action. Update the notifications' template to include a
"Clear all" button for enhanced usability. This addition streamlines
notification management and improves the user experience.

Fixes netbox-community#20301
@jeremystretch jeremystretch requested review from a team and bctiemann and removed request for a team October 17, 2025 20:47
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.

Add a "clear all" option to the user notifications dropdown

1 participant