diff --git a/activities/models/emoji.py b/activities/models/emoji.py index 50a3321..abf3a29 100644 --- a/activities/models/emoji.py +++ b/activities/models/emoji.py @@ -281,7 +281,7 @@ class Emoji(StatorModel): # Name could be a direct property, or in a language'd value if "name" in data: name = data["name"] - elif "nameMap" in data: + elif "nameMap" in data and "und" in data["nameMap"]: name = data["nameMap"]["und"] else: raise ValueError("No name on emoji JSON") diff --git a/api/views/search.py b/api/views/search.py index a76ef01..12df0b3 100644 --- a/api/views/search.py +++ b/api/views/search.py @@ -13,7 +13,7 @@ from api.decorators import scope_required def search( request, q: str, - type: Literal["accounts", "hashtags", "statuses"] | None = None, + type: Literal["accounts", "hashtags", "statuses", ""] | None = None, fetch_identities: bool = Field(False, alias="resolve"), following: bool = False, exclude_unreviewed: bool = False, @@ -33,6 +33,8 @@ def search( # Run search searcher = SearchService(q, request.identity) search_result = searcher.search_all() + if type == "": + type = None if type is None or type == "accounts": result["accounts"] = [ schemas.Account.from_identity(i, include_counts=False)