From 20239b5cb7455d593680b17d2d80d2a4850c524d Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sun, 11 Dec 2022 12:37:28 -0700 Subject: Basic post mutation --- api/views/search.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'api/views/search.py') diff --git a/api/views/search.py b/api/views/search.py index 7735a65..bd44cd7 100644 --- a/api/views/search.py +++ b/api/views/search.py @@ -2,6 +2,7 @@ from typing import Literal from ninja import Field +from activities.models import PostInteraction from activities.search import Searcher from api import schemas from api.decorators import identity_required @@ -38,5 +39,11 @@ def search( if type is None or type == "hashtag": result["hashtag"] = [h.to_mastodon_json() for h in search_result["hashtags"]] if type is None or type == "statuses": - result["statuses"] = [p.to_mastodon_json() for p in search_result["posts"]] + interactions = PostInteraction.get_post_interactions( + search_result["posts"], request.identity + ) + result["statuses"] = [ + p.to_mastodon_json(interactions=interactions) + for p in search_result["posts"] + ] return result -- cgit v1.2.3