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/search.py | |
| parent | fc8a21fc5c6809ea115092eeec57e09e984cdd76 (diff) | |
| download | takahe-20239b5cb7455d593680b17d2d80d2a4850c524d.tar.gz takahe-20239b5cb7455d593680b17d2d80d2a4850c524d.tar.bz2 takahe-20239b5cb7455d593680b17d2d80d2a4850c524d.zip | |
Basic post mutation
Diffstat (limited to 'api/views/search.py')
| -rw-r--r-- | api/views/search.py | 9 | 
1 files changed, 8 insertions, 1 deletions
| 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 | 
