Merge remote-tracking branch 'pleroma/develop' into cycles-base-url
authorAlex Gleason <alex@alexgleason.me>
Mon, 31 May 2021 21:49:46 +0000 (16:49 -0500)
committerAlex Gleason <alex@alexgleason.me>
Mon, 31 May 2021 21:49:46 +0000 (16:49 -0500)
20 files changed:
1  2 
lib/pleroma/application.ex
lib/pleroma/formatter.ex
lib/pleroma/object.ex
lib/pleroma/upload.ex
lib/pleroma/user.ex
lib/pleroma/web/feed/feed_view.ex
lib/pleroma/web/mastodon_api/views/instance_view.ex
lib/pleroma/web/mastodon_api/views/status_view.ex
lib/pleroma/web/media_proxy.ex
lib/pleroma/web/templates/feed/feed/_activity.atom.eex
lib/pleroma/web/templates/feed/feed/_activity.rss.eex
lib/pleroma/web/templates/feed/feed/_tag_activity.atom.eex
lib/pleroma/web/web_finger.ex
test/pleroma/user_test.exs
test/pleroma/web/activity_pub/mrf/simple_policy_test.exs
test/pleroma/web/admin_api/controllers/user_controller_test.exs
test/pleroma/web/common_api_test.exs
test/pleroma/web/mastodon_api/views/account_view_test.exs
test/pleroma/web/media_proxy_test.exs
test/pleroma/web/web_finger_test.exs

Simple merge
Simple merge
Simple merge
Simple merge
index 4c697cb1be3f91d230abcc6e9a067412fd66de4e,b78777141b84a000bff81647790aafe22f7dc79c..9365fae2b7a58ff98b013844420a6b797653a963
@@@ -372,8 -373,10 +373,10 @@@ defmodule Pleroma.User d
    end
  
    # Should probably be renamed or removed
 -  def ap_id(%User{nickname: nickname}), do: "#{Web.base_url()}/users/#{nickname}"
+   @spec ap_id(User.t()) :: String.t()
 +  def ap_id(%User{nickname: nickname}), do: "#{Endpoint.url()}/users/#{nickname}"
  
+   @spec ap_followers(User.t()) :: String.t()
    def ap_followers(%User{follower_address: fa}) when is_binary(fa), do: fa
    def ap_followers(%User{} = user), do: "#{ap_id(user)}/followers"
  
Simple merge
index 510cac2364add180e48534d8f4ad1ccdee4c9a7f,dac68d8e606899a8926bc42c46ce563e5dc8a215..005705d973fdf78b8cad45a8f51e2894d4377df1
@@@ -23,7 -23,8 +23,9 @@@ defmodule Pleroma.Web.MastodonAPI.Insta
          streaming_api: Pleroma.Web.Endpoint.websocket_url()
        },
        stats: Pleroma.Stats.get_stats(),
-       thumbnail: Pleroma.Web.Endpoint.url() <> Keyword.get(instance, :instance_thumbnail),
+       thumbnail:
 -        URI.merge(Pleroma.Web.base_url(), Keyword.get(instance, :instance_thumbnail)) |> to_string,
++        URI.merge(Pleroma.Web.Endpoint.url(), Keyword.get(instance, :instance_thumbnail))
++        |> to_string,
        languages: ["en"],
        registrations: Keyword.get(instance, :registrations_open),
        approval_required: Keyword.get(instance, :account_approval_required),
index 7df5912010f6d8dc149f8f1be14e2bccf080bbb5,d0d4bb4b3d81a66cbbe02579faa1ba9f10f8fc2c..5c32078aadf89fe25244e045c0f75feb29c32345
@@@ -121,8 -121,13 +121,13 @@@ defmodule Pleroma.Web.MediaProxy d
      end
    end
  
+   def decode_url(encoded) do
+     [_, "proxy", sig, base64 | _] = URI.parse(encoded).path |> String.split("/")
+     decode_url(sig, base64)
+   end
    defp signed_url(url) do
 -    :crypto.hmac(:sha, Config.get([Web.Endpoint, :secret_key_base]), url)
 +    :crypto.hmac(:sha, Config.get([Endpoint, :secret_key_base]), url)
    end
  
    def filename(url_or_path) do
Simple merge
Simple merge
index 5ab3a48ad97881b6858e19c325415221ab8bb490,be94c93c2bf7144112e707117b75896ebc74ce96..1af1b85a3a04eecac7712c2e1bbb8324484e7ec7
@@@ -514,9 -519,30 +519,30 @@@ defmodule Pleroma.Web.CommonAPITest d
        {:ok, activity} = CommonAPI.post(user, %{status: "hey :blank:"})
  
        assert %{"blank" => url} = Object.normalize(activity).data["emoji"]
 -      assert url == "#{Pleroma.Web.base_url()}/emoji/blank.png"
 +      assert url == "#{Pleroma.Web.Endpoint.url()}/emoji/blank.png"
      end
  
+     test "it copies emoji from the subject of the parent post" do
+       %Object{} =
+         object =
+         Object.normalize("https://patch.cx/objects/a399c28e-c821-4820-bc3e-4afeb044c16f",
+           fetch: true
+         )
+       activity = Activity.get_create_by_object_ap_id(object.data["id"])
+       user = insert(:user)
+       {:ok, reply_activity} =
+         CommonAPI.post(user, %{
+           in_reply_to_id: activity.id,
+           status: ":joker_disapprove:",
+           spoiler_text: ":joker_smile:"
+         })
+       assert Object.normalize(reply_activity).data["emoji"][":joker_smile:"]
+       refute Object.normalize(reply_activity).data["emoji"][":joker_disapprove:"]
+     end
      test "deactivated users can't post" do
        user = insert(:user, is_active: false)
        assert {:error, _} = CommonAPI.post(user, %{status: "ye"})
Simple merge
Simple merge