Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel
authorlain <lain@soykaf.club>
Wed, 4 Dec 2019 15:35:59 +0000 (16:35 +0100)
committerlain <lain@soykaf.club>
Wed, 4 Dec 2019 15:35:59 +0000 (16:35 +0100)
13 files changed:
1  2 
lib/pleroma/object/containment.ex
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/transmogrifier.ex
lib/pleroma/web/common_api/common_api.ex
lib/pleroma/web/mastodon_api/controllers/status_controller.ex
test/notification_test.exs
test/object_test.exs
test/user_test.exs
test/web/activity_pub/transmogrifier_test.exs
test/web/common_api/common_api_test.exs
test/web/mastodon_api/views/notification_view_test.exs
test/web/ostatus/ostatus_controller_test.exs
test/web/streamer/streamer_test.exs

Simple merge
index a25bb1978b58de793f6b50a92efd7ad84a49dc1e,ce95fb6babf84a0c7ac38359c7bae335f2dea5aa..6603e4929d50c384f2ee122426515f7433f3e3d8
@@@ -569,21 -566,45 +569,49 @@@ defmodule Pleroma.Web.ActivityPub.Trans
      end
    end
  
 -  def handle_incoming(
 -        %{"type" => "Like", "object" => object_id, "actor" => _actor, "id" => id} = data,
 -        _options
 -      ) do
 -    with actor <- Containment.get_actor(data),
 -         {:ok, %User{} = actor} <- User.get_or_fetch_by_ap_id(actor),
 -         {:ok, object} <- get_obj_helper(object_id),
 -         {:ok, activity, _object} <- ActivityPub.like(actor, object, id, false) do
+   @misskey_reactions %{
+     "like" => "👍",
+     "love" => "❤️",
+     "laugh" => "😆",
+     "hmm" => "🤔",
+     "surprise" => "😮",
+     "congrats" => "🎉",
+     "angry" => "💢",
+     "confused" => "😥",
+     "rip" => "😇",
+     "pudding" => "🍮",
+     "star" => "⭐"
+   }
+   @doc "Rewrite misskey likes into EmojiReactions"
+   def handle_incoming(
+         %{
+           "type" => "Like",
+           "_misskey_reaction" => reaction
+         } = data,
+         options
+       ) do
+     data
+     |> Map.put("type", "EmojiReaction")
+     |> Map.put("content", @misskey_reactions[reaction] || reaction)
+     |> handle_incoming(options)
+   end
 +  def handle_incoming(%{"type" => "Like"} = data, _options) do
 +    with {_, {:ok, cast_data_sym}} <-
 +           {:casting_data,
 +            data |> LikeValidator.cast_data() |> Ecto.Changeset.apply_action(:insert)},
 +         {_, cast_data} <-
 +           {:stringify_keys, ObjectValidator.stringify_keys(cast_data_sym |> Map.from_struct())},
 +         :ok <- ObjectValidator.fetch_actor_and_object(cast_data),
 +         {_, {:ok, cast_data}} <- {:maybe_add_context, maybe_add_context_from_object(cast_data)},
 +         {_, {:ok, cast_data}} <-
 +           {:maybe_add_recipients, maybe_add_recipients_from_object(cast_data)},
 +         {_, {:ok, activity, _meta}} <-
 +           {:common_pipeline, Pipeline.common_pipeline(cast_data, local: false)} do
        {:ok, activity}
      else
 -      _e -> :error
 +      e -> {:error, e}
      end
    end
  
Simple merge
Simple merge
Simple merge
Simple merge