Resolve merge conflicts
authorrinpatch <rinpatch@sdf.org>
Sat, 1 Jun 2019 13:29:58 +0000 (16:29 +0300)
committerrinpatch <rinpatch@sdf.org>
Sat, 1 Jun 2019 13:29:58 +0000 (16:29 +0300)
1  2 
config/config.exs
docs/config.md
lib/pleroma/object.ex
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/transmogrifier.ex
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
lib/pleroma/web/mastodon_api/views/status_view.ex
lib/pleroma/web/router.ex
test/support/http_request_mock.ex
test/web/activity_pub/transmogrifier_test.exs
test/web/mastodon_api/mastodon_api_controller_test.exs

Simple merge
diff --cc docs/config.md
Simple merge
Simple merge
index 13bb609e5536e4d793a1dd5fc94bf53bd7937a06,2110027c3da313d238f06894c21fa38a54071f78..bab6d693d87fe601cf29deab997be6fd722f42ad
@@@ -1394,9 -1364,8 +1429,9 @@@ defmodule Pleroma.Web.MastodonAPI.Masto
              display_sensitive_media: false,
              reduce_motion: false,
              max_toot_chars: limit,
-             mascot: "/images/pleroma-fox-tan-smol.png"
+             mascot: User.get_mascot(user)["url"]
            },
 +          poll_limits: Config.get([:instance, :poll_limits]),
            rights: %{
              delete_others_notice: present?(user.info.is_moderator),
              admin: present?(user.info.is_admin)
Simple merge
Simple merge
index 8422fc3d587c82d5d79e7291dc7aada910280abb,ee71de8d0631b345ec868ad7dd72b63f2e5f81b6..80832d1d8a93110fa755f12e1fb19d9b8b0e18ae
@@@ -1259,27 -1210,43 +1259,67 @@@ defmodule Pleroma.Web.ActivityPub.Trans
      end
    end
  
 +  test "Rewrites Answers to Notes" do
 +    user = insert(:user)
 +
 +    {:ok, poll_activity} =
 +      CommonAPI.post(user, %{
 +        "status" => "suya...",
 +        "poll" => %{"options" => ["suya", "suya.", "suya.."], "expires_in" => 10}
 +      })
 +
 +    poll_object = Object.normalize(poll_activity)
 +    # TODO: Replace with CommonAPI vote creation when implemented
 +    data =
 +      File.read!("test/fixtures/mastodon-vote.json")
 +      |> Poison.decode!()
 +      |> Kernel.put_in(["to"], user.ap_id)
 +      |> Kernel.put_in(["object", "inReplyTo"], poll_object.data["id"])
 +      |> Kernel.put_in(["object", "to"], user.ap_id)
 +
 +    {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
 +    {:ok, data} = Transmogrifier.prepare_outgoing(activity.data)
 +
 +    assert data["object"]["type"] == "Note"
 +  end
++
+   describe "fix_explicit_addressing" do
+     test "moves non-explicitly mentioned actors to cc" do
+       user = insert(:user)
+       explicitly_mentioned_actors = [
+         "https://pleroma.gold/users/user1",
+         "https://pleroma.gold/user2"
+       ]
+       object = %{
+         "actor" => user.ap_id,
+         "to" => explicitly_mentioned_actors ++ ["https://social.beepboop.ga/users/dirb"],
+         "cc" => [],
+         "tag" =>
+           Enum.map(explicitly_mentioned_actors, fn href ->
+             %{"type" => "Mention", "href" => href}
+           end)
+       }
+       fixed_object = Transmogrifier.fix_explicit_addressing(object)
+       assert Enum.all?(explicitly_mentioned_actors, &(&1 in fixed_object["to"]))
+       refute "https://social.beepboop.ga/users/dirb" in fixed_object["to"]
+       assert "https://social.beepboop.ga/users/dirb" in fixed_object["cc"]
+     end
+     test "does not move actor's follower collection to cc" do
+       user = insert(:user)
+       object = %{
+         "actor" => user.ap_id,
+         "to" => [user.follower_address],
+         "cc" => []
+       }
+       fixed_object = Transmogrifier.fix_explicit_addressing(object)
+       assert user.follower_address in fixed_object["to"]
+       refute user.follower_address in fixed_object["cc"]
+     end
+   end
  end