commit: c916ba619c4d8b09e5bab67db08c9c7603376b5d
parent: b5ba41a7255e23285810d865f0fef7701ab4ca6c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 7 Jul 2019 09:14:53 +0200
Merge remote-tracking branch 'upstream/features/mastoapi-emoji-categories' into lanodan
Diffstat:
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Admin API: Return users' tags when querying reports
- Admin API: Return avatar and display name when querying users
- Mastodon API, streaming: Add support for passing the token in the `Sec-WebSocket-Protocol` header
+- Mastodon API: Add support for categories for custom emojis by reusing the group feature. <https://github.com/tootsuite/mastodon/pull/11196>
### Fixed
- Not being able to pin unlisted posts
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -242,7 +242,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
"static_url" => url,
"visible_in_picker" => true,
"url" => url,
- "tags" => tags
+ "tags" => tags,
+ # Assuming that a comma is authorized in the category name
+ "category" => (tags -- ["Custom"]) |> Enum.join(",")
}
end)
end
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -2861,6 +2861,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert Map.has_key?(emoji, "static_url")
assert Map.has_key?(emoji, "tags")
assert is_list(emoji["tags"])
+ assert Map.has_key?(emoji, "category")
assert Map.has_key?(emoji, "url")
assert Map.has_key?(emoji, "visible_in_picker")
end