Fixed #599: Interaction state not present on notifications
This commit is contained in:
parent
542e3836af
commit
e34e4c0c77
|
@ -273,8 +273,9 @@ class Notification(Schema):
|
|||
def from_timeline_event(
|
||||
cls,
|
||||
event: activities_models.TimelineEvent,
|
||||
interactions=None,
|
||||
) -> "Notification":
|
||||
return cls(**event.to_mastodon_notification_json())
|
||||
return cls(**event.to_mastodon_notification_json(interactions=interactions))
|
||||
|
||||
|
||||
class Tag(Schema):
|
||||
|
|
|
@ -2,7 +2,7 @@ from django.http import HttpRequest
|
|||
from django.shortcuts import get_object_or_404
|
||||
from hatchway import ApiResponse, api_view
|
||||
|
||||
from activities.models import TimelineEvent
|
||||
from activities.models import PostInteraction, TimelineEvent
|
||||
from activities.services import TimelineService
|
||||
from api import schemas
|
||||
from api.decorators import scope_required
|
||||
|
@ -45,8 +45,15 @@ def notifications(
|
|||
since_id=since_id,
|
||||
limit=limit,
|
||||
)
|
||||
interactions = PostInteraction.get_event_interactions(
|
||||
pager.results,
|
||||
request.identity,
|
||||
)
|
||||
return PaginatingApiResponse(
|
||||
[schemas.Notification.from_timeline_event(event) for event in pager.results],
|
||||
[
|
||||
schemas.Notification.from_timeline_event(event, interactions=interactions)
|
||||
for event in pager.results
|
||||
],
|
||||
request=request,
|
||||
include_params=["limit", "account_id"],
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue