mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-21 23:01:00 +00:00
Misc lemmy compat (#635)
This commit is contained in:
parent
2a50928f27
commit
671807beb8
2 changed files with 4 additions and 2 deletions
|
@ -281,7 +281,7 @@ class Emoji(StatorModel):
|
||||||
# Name could be a direct property, or in a language'd value
|
# Name could be a direct property, or in a language'd value
|
||||||
if "name" in data:
|
if "name" in data:
|
||||||
name = data["name"]
|
name = data["name"]
|
||||||
elif "nameMap" in data:
|
elif "nameMap" in data and "und" in data["nameMap"]:
|
||||||
name = data["nameMap"]["und"]
|
name = data["nameMap"]["und"]
|
||||||
else:
|
else:
|
||||||
raise ValueError("No name on emoji JSON")
|
raise ValueError("No name on emoji JSON")
|
||||||
|
|
|
@ -13,7 +13,7 @@ from api.decorators import scope_required
|
||||||
def search(
|
def search(
|
||||||
request,
|
request,
|
||||||
q: str,
|
q: str,
|
||||||
type: Literal["accounts", "hashtags", "statuses"] | None = None,
|
type: Literal["accounts", "hashtags", "statuses", ""] | None = None,
|
||||||
fetch_identities: bool = Field(False, alias="resolve"),
|
fetch_identities: bool = Field(False, alias="resolve"),
|
||||||
following: bool = False,
|
following: bool = False,
|
||||||
exclude_unreviewed: bool = False,
|
exclude_unreviewed: bool = False,
|
||||||
|
@ -33,6 +33,8 @@ def search(
|
||||||
# Run search
|
# Run search
|
||||||
searcher = SearchService(q, request.identity)
|
searcher = SearchService(q, request.identity)
|
||||||
search_result = searcher.search_all()
|
search_result = searcher.search_all()
|
||||||
|
if type == "":
|
||||||
|
type = None
|
||||||
if type is None or type == "accounts":
|
if type is None or type == "accounts":
|
||||||
result["accounts"] = [
|
result["accounts"] = [
|
||||||
schemas.Account.from_identity(i, include_counts=False)
|
schemas.Account.from_identity(i, include_counts=False)
|
||||||
|
|
Loading…
Reference in a new issue