aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Braun <rbraun@Bobble.local>2017-10-23 16:27:51 +0200
committerRoger Braun <rbraun@Bobble.local>2017-10-23 16:27:51 +0200
commit64bc38e009208fa4f4409f6930d5117dc291c2f5 (patch)
tree1faa9af1a53bb713a62a5428c572a982e46bea99
parent38f3908c14d3b8fcfe522d4c92bde022dcc682e3 (diff)
downloadpleroma-64bc38e009208fa4f4409f6930d5117dc291c2f5.tar.gz
MastoAPI: Add emoji output.
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex6
-rw-r--r--test/support/factory.ex5
-rw-r--r--test/web/mastodon_api/status_view_test.exs9
3 files changed, 17 insertions, 3 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index cce4f7217..272f83b2a 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -74,6 +74,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
reply_to = Activity.get_create_activity_by_object_ap_id(object["inReplyTo"])
reply_to_user = reply_to && User.get_cached_by_ap_id(reply_to.data["actor"])
+ emojis = (activity.data["object"]["emoji"] || [])
+ |> Enum.map(fn {name, url} -> %{ shortcode: name, url: url, static_url: url } end)
+
%{
id: activity.id,
uri: object["id"],
@@ -99,7 +102,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
name: "Web",
website: nil
},
- language: nil
+ language: nil,
+ emojis: emojis
}
end
diff --git a/test/support/factory.ex b/test/support/factory.ex
index f499024a2..33bacd40c 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -26,7 +26,10 @@ defmodule Pleroma.Factory do
"likes" => [],
"like_count" => 0,
"context" => "2hu",
- "tag" => ["2hu"]
+ "tag" => ["2hu"],
+ "emoji" => %{
+ "2hu" => "corndog.png"
+ }
}
%Pleroma.Object{
diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs
index 1575b1d6e..dc5cdfe9a 100644
--- a/test/web/mastodon_api/status_view_test.exs
+++ b/test/web/mastodon_api/status_view_test.exs
@@ -41,7 +41,14 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
name: "Web",
website: nil
},
- language: nil
+ language: nil,
+ emojis: [
+ %{
+ shortcode: "2hu",
+ url: "corndog.png",
+ static_url: "corndog.png"
+ }
+ ]
}
assert status == expected