diff options
author | Andrew Godwin | 2022-12-11 12:37:28 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-12-12 11:56:49 -0700 |
commit | 20239b5cb7455d593680b17d2d80d2a4850c524d (patch) | |
tree | 1c5705837e17bca50920848d00bfcf1f7c2313af /api/views/notifications.py | |
parent | fc8a21fc5c6809ea115092eeec57e09e984cdd76 (diff) | |
download | takahe-20239b5cb7455d593680b17d2d80d2a4850c524d.tar.gz takahe-20239b5cb7455d593680b17d2d80d2a4850c524d.tar.bz2 takahe-20239b5cb7455d593680b17d2d80d2a4850c524d.zip |
Basic post mutation
Diffstat (limited to 'api/views/notifications.py')
-rw-r--r-- | api/views/notifications.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/api/views/notifications.py b/api/views/notifications.py index 9ccda81..7b05d14 100644 --- a/api/views/notifications.py +++ b/api/views/notifications.py @@ -1,8 +1,7 @@ -from activities.models import TimelineEvent - -from .. import schemas -from ..decorators import identity_required -from .base import api_router +from activities.models import PostInteraction, TimelineEvent +from api import schemas +from api.decorators import identity_required +from api.views.base import api_router @api_router.get("/v1/notifications", response=list[schemas.Notification]) @@ -49,4 +48,9 @@ def notifications( # invert the ordering to accomodate anchor_event = TimelineEvent.objects.get(pk=min_id) events = events.filter(created__gt=anchor_event.created).order_by("created") - return [event.to_mastodon_notification_json() for event in events[:limit]] + events = list(events[:limit]) + interactions = PostInteraction.get_event_interactions(events, request.identity) + return [ + event.to_mastodon_notification_json(interactions=interactions) + for event in events + ] |