EmojiReactions: Rename to EmojiReacts
authorLain Soykaf <lain@soykaf.club>
Thu, 6 Feb 2020 17:09:57 +0000 (18:09 +0100)
committerLain Soykaf <lain@soykaf.club>
Thu, 6 Feb 2020 17:09:57 +0000 (18:09 +0100)
12 files changed:
docs/API/differences_in_mastoapi_responses.md
lib/pleroma/activity.ex
lib/pleroma/notification.ex
lib/pleroma/web/activity_pub/transmogrifier.ex
lib/pleroma/web/activity_pub/utils.ex
priv/static/schemas/litepub-0.1.jsonld
test/fixtures/emoji-reaction-no-emoji.json
test/fixtures/emoji-reaction-too-long.json
test/fixtures/emoji-reaction.json
test/web/activity_pub/activity_pub_test.exs
test/web/activity_pub/transmogrifier_test.exs
test/web/mastodon_api/views/notification_view_test.exs

index 82d967e4de475d04f84a36927e12742d639bf575..89245261c79e18ac5ba8812199240eb3e5b0159a 100644 (file)
@@ -101,7 +101,7 @@ The `type` value is `move`. Has an additional field:
 
 - `target`: new account
 
-### EmojiReaction Notification
+### EmojiReact Notification
 
 The `type` value is `pleroma:emoji_reaction`. Has these fields:
 
index 0f8fce774e81b5904a24e19c0404cf85596e777d..72e2256eaf00d73bb5d2d6e3e060d63965979198 100644 (file)
@@ -31,7 +31,7 @@ defmodule Pleroma.Activity do
     "Announce" => "reblog",
     "Like" => "favourite",
     "Move" => "move",
-    "EmojiReaction" => "pleroma:emoji_reaction"
+    "EmojiReact" => "pleroma:emoji_reaction"
   }
 
   @mastodon_to_ap_notification_types for {k, v} <- @mastodon_notification_types,
index d04a65a1e6c011828c41686d6ff87a027bbbd569..66e91fcef08272489133150458023012336c9fc1 100644 (file)
@@ -294,7 +294,7 @@ defmodule Pleroma.Notification do
   end
 
   def create_notifications(%Activity{data: %{"type" => type}} = activity)
-      when type in ["Like", "Announce", "Follow", "Move", "EmojiReaction"] do
+      when type in ["Like", "Announce", "Follow", "Move", "EmojiReact"] do
     notifications =
       activity
       |> get_notified_from_activity()
@@ -322,7 +322,7 @@ defmodule Pleroma.Notification do
   def get_notified_from_activity(activity, local_only \\ true)
 
   def get_notified_from_activity(%Activity{data: %{"type" => type}} = activity, local_only)
-      when type in ["Create", "Like", "Announce", "Follow", "Move", "EmojiReaction"] do
+      when type in ["Create", "Like", "Announce", "Follow", "Move", "EmojiReact"] do
     []
     |> Utils.maybe_notify_to_recipients(activity)
     |> Utils.maybe_notify_mentioned_recipients(activity)
index 2b8bfc3bd2c00c179f2af1e3d216f56a8ff7a2be..a72d8430f6e3b6ab4d73ad69702fc2ee2a63c1f9 100644 (file)
@@ -580,7 +580,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
     "star" => "⭐"
   }
 
-  @doc "Rewrite misskey likes into EmojiReactions"
+  @doc "Rewrite misskey likes into EmojiReacts"
   def handle_incoming(
         %{
           "type" => "Like",
@@ -589,7 +589,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
         options
       ) do
     data
-    |> Map.put("type", "EmojiReaction")
+    |> Map.put("type", "EmojiReact")
     |> Map.put("content", @misskey_reactions[reaction] || reaction)
     |> handle_incoming(options)
   end
@@ -610,7 +610,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
 
   def handle_incoming(
         %{
-          "type" => "EmojiReaction",
+          "type" => "EmojiReact",
           "object" => object_id,
           "actor" => _actor,
           "id" => id,
@@ -751,7 +751,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
   def handle_incoming(
         %{
           "type" => "Undo",
-          "object" => %{"type" => "EmojiReaction", "id" => reaction_activity_id},
+          "object" => %{"type" => "EmojiReact", "id" => reaction_activity_id},
           "actor" => _actor,
           "id" => id
         } = data,
index 4f7fdaf38a1796d00b5bfb6480f9bab5e7107b97..4bcacc6d15c984d2aa9eedb9d07b72501d5964bf 100644 (file)
@@ -308,7 +308,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
 
   def make_emoji_reaction_data(user, object, emoji, activity_id) do
     make_like_data(user, object, activity_id)
-    |> Map.put("type", "EmojiReaction")
+    |> Map.put("type", "EmojiReact")
     |> Map.put("content", emoji)
   end
 
@@ -493,7 +493,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
   def get_latest_reaction(internal_activity_id, %{ap_id: ap_id}, emoji) do
     %{data: %{"object" => object_ap_id}} = Activity.get_by_id(internal_activity_id)
 
-    "EmojiReaction"
+    "EmojiReact"
     |> Activity.Queries.by_type()
     |> where(actor: ^ap_id)
     |> where([activity], fragment("?->>'content' = ?", activity.data, ^emoji))
index e7ebf72be15630be73d62c53d244374ee7101946..278ad2f96f6a9eeb7bf86e005893bab6d2491f4b 100644 (file)
@@ -29,7 +29,7 @@
                 "@id": "litepub:oauthRegistrationEndpoint",
                 "@type": "@id"
             },
-            "EmojiReaction": "litepub:EmojiReaction",
+            "EmojiReact": "litepub:EmojiReact",
             "alsoKnownAs": {
                 "@id": "as:alsoKnownAs",
                 "@type": "@id"
index fff77b29b00b484385a083a49ff36b04c9a92789..ef3bbe55cb6cd7553bd43eb18dc094a819dc7267 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "type": "EmojiReaction",
+  "type": "EmojiReact",
   "signature": {
     "type": "RsaSignature2017",
     "signatureValue": "fdxMfQSMwbC6wP6sh6neS/vM5879K67yQkHTbiT5Npr5wAac0y6+o3Ij+41tN3rL6wfuGTosSBTHOtta6R4GCOOhCaCSLMZKypnp1VltCzLDoyrZELnYQIC8gpUXVmIycZbREk22qWUe/w7DAFaKK4UscBlHDzeDVcA0K3Se5Sluqi9/Zh+ldAnEzj/rSEPDjrtvf5wGNf3fHxbKSRKFt90JvKK6hS+vxKUhlRFDf6/SMETw+EhwJSNW4d10yMUakqUWsFv4Acq5LW7l+HpYMvlYY1FZhNde1+uonnCyuQDyvzkff8zwtEJmAXC4RivO/VVLa17SmqheJZfI8oluVg==",
index 31830d90cfa0e226df78cef8fd118820b314706b..e917c9a688f909f6e137682e07e77465b9a3a1c1 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "type": "EmojiReaction",
+  "type": "EmojiReact",
   "signature": {
     "type": "RsaSignature2017",
     "signatureValue": "fdxMfQSMwbC6wP6sh6neS/vM5879K67yQkHTbiT5Npr5wAac0y6+o3Ij+41tN3rL6wfuGTosSBTHOtta6R4GCOOhCaCSLMZKypnp1VltCzLDoyrZELnYQIC8gpUXVmIycZbREk22qWUe/w7DAFaKK4UscBlHDzeDVcA0K3Se5Sluqi9/Zh+ldAnEzj/rSEPDjrtvf5wGNf3fHxbKSRKFt90JvKK6hS+vxKUhlRFDf6/SMETw+EhwJSNW4d10yMUakqUWsFv4Acq5LW7l+HpYMvlYY1FZhNde1+uonnCyuQDyvzkff8zwtEJmAXC4RivO/VVLa17SmqheJZfI8oluVg==",
index 3812e43ad9c51f12c79e4293b63f89abd5b405ff..fe1fecddb4a56ccd84fb0b02374077e50448252e 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "type": "EmojiReaction",
+  "type": "EmojiReact",
   "signature": {
     "type": "RsaSignature2017",
     "signatureValue": "fdxMfQSMwbC6wP6sh6neS/vM5879K67yQkHTbiT5Npr5wAac0y6+o3Ij+41tN3rL6wfuGTosSBTHOtta6R4GCOOhCaCSLMZKypnp1VltCzLDoyrZELnYQIC8gpUXVmIycZbREk22qWUe/w7DAFaKK4UscBlHDzeDVcA0K3Se5Sluqi9/Zh+ldAnEzj/rSEPDjrtvf5wGNf3fHxbKSRKFt90JvKK6hS+vxKUhlRFDf6/SMETw+EhwJSNW4d10yMUakqUWsFv4Acq5LW7l+HpYMvlYY1FZhNde1+uonnCyuQDyvzkff8zwtEJmAXC4RivO/VVLa17SmqheJZfI8oluVg==",
index ff4604a524303e676b671372862497378bad4c5d..ea6e79b441380d07934ffc7d0a1b001a893aec22 100644 (file)
@@ -877,7 +877,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
       assert reaction_activity
 
       assert reaction_activity.data["actor"] == reactor.ap_id
-      assert reaction_activity.data["type"] == "EmojiReaction"
+      assert reaction_activity.data["type"] == "EmojiReact"
       assert reaction_activity.data["content"] == "🔥"
       assert reaction_activity.data["object"] == object.data["id"]
       assert reaction_activity.data["to"] == [User.ap_followers(reactor), activity.data["actor"]]
index 0829a6ec2d1e2f47064a99ab1fcaceedeb87db12..1b12ee3a9dfd118072cdf1eef234b0863b8da98c 100644 (file)
@@ -340,7 +340,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
       assert data["object"] == activity.data["object"]
     end
 
-    test "it works for incoming misskey likes, turning them into EmojiReactions" do
+    test "it works for incoming misskey likes, turning them into EmojiReacts" do
       user = insert(:user)
       {:ok, activity} = CommonAPI.post(user, %{"status" => "hello"})
 
@@ -352,13 +352,13 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
       {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
 
       assert data["actor"] == data["actor"]
-      assert data["type"] == "EmojiReaction"
+      assert data["type"] == "EmojiReact"
       assert data["id"] == data["id"]
       assert data["object"] == activity.data["object"]
       assert data["content"] == "🍮"
     end
 
-    test "it works for incoming misskey likes that contain unicode emojis, turning them into EmojiReactions" do
+    test "it works for incoming misskey likes that contain unicode emojis, turning them into EmojiReacts" do
       user = insert(:user)
       {:ok, activity} = CommonAPI.post(user, %{"status" => "hello"})
 
@@ -371,7 +371,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
       {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
 
       assert data["actor"] == data["actor"]
-      assert data["type"] == "EmojiReaction"
+      assert data["type"] == "EmojiReact"
       assert data["id"] == data["id"]
       assert data["object"] == activity.data["object"]
       assert data["content"] == "⭐"
@@ -389,7 +389,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
       {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
 
       assert data["actor"] == "http://mastodon.example.org/users/admin"
-      assert data["type"] == "EmojiReaction"
+      assert data["type"] == "EmojiReact"
       assert data["id"] == "http://mastodon.example.org/users/admin#reactions/2"
       assert data["object"] == activity.data["object"]
       assert data["content"] == "👌"
index 1fe83cb2cab6d54415d50ea6892242ced2ebda78..2ac75c2ffdeee6291c0e3e880f962e88ba95cc45 100644 (file)
@@ -135,7 +135,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do
              NotificationView.render("index.json", %{notifications: [notification], for: follower})
   end
 
-  test "EmojiReaction notification" do
+  test "EmojiReact notification" do
     user = insert(:user)
     other_user = insert(:user)