MastoAPI: Add categories to custom emojis
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Sat, 29 Jun 2019 23:05:28 +0000 (01:05 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Wed, 10 Jul 2019 15:02:37 +0000 (17:02 +0200)
Note: This isn’t in a release yet, can be seen in mastofe on the
rebase/glitch-soc branch.

CHANGELOG.md
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
test/web/mastodon_api/mastodon_api_controller_test.exs

index 9ec8a55516988eff3e0d3232e9415649122514ec..f27446f36b954a63cbb71d13781edeb4970c5c92 100644 (file)
@@ -27,6 +27,7 @@ Configuration: `federation_incoming_replies_max_depth` option
 - Admin API: Allow querying user by ID
 - Added synchronization of following/followers counters for external users
 - Configuration: `enabled` option for `Pleroma.Emails.Mailer`, defaulting to `false`.
+- Mastodon API: Add support for categories for custom emojis by reusing the group feature. <https://github.com/tootsuite/mastodon/pull/11196>
 
 ## [1.0.0] - 2019-06-29
 ### Security
index 82f180635642a0152befd7445619a927b1cc87fb..8c2033c3ab433ad8650638842e7c3c1b0ce8f076 100644 (file)
@@ -299,7 +299,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
index 64f14f794c275cbdbc2a31794f449086bcbdd2cf..8afb1497be4450b85763c19797ae5380824cbb28 100644 (file)
@@ -2958,6 +2958,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