Skip to content
Snippets Groups Projects
Verified Commit fa856435 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Show scheduled notifications on dashboard not before time

parent 94923608
No related branches found
No related tags found
1 merge request!1005Resolve "Scheduled notifications are shown on the dashboard at the wrong time"
Pipeline #61883 passed
......@@ -23,6 +23,7 @@ Fixed
* Added locales-all to base image and note to docs
* The icons in the account menu were still the old ones.
* Due to a merge error, the once removed account menu in the sidenav appeared again.
* Scheduled notifications were shown on dashboard before time.
Changed
~~~~~~~
......
......@@ -309,7 +309,7 @@ class Person(ExtensibleModel):
@property
def unread_notifications(self) -> QuerySet:
"""Get all unread notifications for this person."""
return self.notifications.filter(read=False)
return self.notifications.filter(read=False, send_at__lte=timezone.now())
@property
def unread_notifications_count(self) -> int:
......
......@@ -219,7 +219,9 @@ def index(request: HttpRequest) -> HttpResponse:
notifications = person.notifications.filter(send_at__lte=timezone.now()).order_by("-created")[
:5
]
unread_notifications = person.notifications.all().filter(read=False).order_by("-created")
unread_notifications = person.notifications.filter(
send_at__lte=timezone.now(), read=False
).order_by("-created")
context["activities"] = activities
context["notifications"] = notifications
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment