From 3907a10d2e279d1974a829598067aea3797883dc Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Thu, 15 Dec 2022 16:50:15 -0700 Subject: Make emoji picker work on client apps --- api/views/__init__.py | 1 + api/views/emoji.py | 10 ++++++++++ api/views/filters.py | 3 +-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 api/views/emoji.py (limited to 'api/views') 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 -- cgit v1.2.3