summaryrefslogtreecommitdiffstats
path: root/api/views
diff options
context:
space:
mode:
authorAndrew Godwin2022-12-15 16:50:15 -0700
committerAndrew Godwin2022-12-15 16:50:30 -0700
commit3907a10d2e279d1974a829598067aea3797883dc (patch)
tree7fdb455b0a1f736dd385aeb7eb6b9ee09cef912e /api/views
parent134bacd7ba7670f50ab8af56ae68959833bcd004 (diff)
downloadtakahe-3907a10d2e279d1974a829598067aea3797883dc.tar.gz
takahe-3907a10d2e279d1974a829598067aea3797883dc.tar.bz2
takahe-3907a10d2e279d1974a829598067aea3797883dc.zip
Make emoji picker work on client apps
Diffstat (limited to 'api/views')
-rw-r--r--api/views/__init__.py1
-rw-r--r--api/views/emoji.py10
-rw-r--r--api/views/filters.py3
3 files changed, 12 insertions, 2 deletions
diff --git a/api/views/__init__.py b/api/views/__init__.py
index f95fc21..917b8cd 100644
--- a/api/views/__init__.py
+++ b/api/views/__init__.py
@@ -1,5 +1,6 @@
from .accounts import * # noqa
from .apps import * # noqa
+from .emoji import * # noqa
from .filters import * # noqa
from .instance import * # noqa
from .media import * # noqa
diff --git a/api/views/emoji.py b/api/views/emoji.py
new file mode 100644
index 0000000..0cdefb4
--- /dev/null
+++ b/api/views/emoji.py
@@ -0,0 +1,10 @@
+from activities.models import Emoji
+from api.decorators import identity_required
+from api.schemas import CustomEmoji
+from api.views.base import api_router
+
+
+@api_router.get("/v1/custom_emojis", response=list[CustomEmoji])
+@identity_required
+def emojis(request):
+ return [e.to_mastodon_json() for e in Emoji.objects.usable()]
diff --git a/api/views/filters.py b/api/views/filters.py
index ec82a7d..261247a 100644
--- a/api/views/filters.py
+++ b/api/views/filters.py
@@ -1,7 +1,6 @@
+from api.decorators import identity_required
from api.views.base import api_router
-from ..decorators import identity_required
-
@api_router.get("/v1/filters")
@identity_required