mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
notifications: Don't error when dismissing missing notifications
Fixes: #2468. - Two browser tabs could be loaded with the interface and the same notification could be dismissed twice. When dismissing the notification for the second time, we currently throw a 404 error. Instead silently ignore the error. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
parent
536721df19
commit
987577fae2
@ -568,9 +568,8 @@ def notification_dismiss(request, id):
|
||||
"""Dismiss a notification."""
|
||||
from .notification import Notification
|
||||
notes = Notification.list(key=id, user=request.user)
|
||||
if not notes:
|
||||
raise Http404
|
||||
|
||||
notes[0].dismiss()
|
||||
if notes:
|
||||
# If a notification is not found, no need to dismiss it.
|
||||
notes[0].dismiss()
|
||||
|
||||
return HttpResponseRedirect(_get_redirect_url_from_param(request))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user