From 447514dfa2759e3415399412e82bf772ff119e04 Mon Sep 17 00:00:00 2001
From: "Haelwenn (lanodan) Monnier" 
Date: Wed, 18 Sep 2019 23:20:54 +0200
Subject: Bump copyright years of files changed in 2019
Done via the following command:
git diff 1e6c102bfcfe0e4835a48f2483f2376f9bf86a20 --stat --name-only | cat - | xargs sed -i 's/2017-2018 Pleroma Authors/2017-2019 Pleroma Authors/'
---
 test/web/common_api/common_api_utils_test.exs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'test/web/common_api')
diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs
index c281dd1f1..230146451 100644
--- a/test/web/common_api/common_api_utils_test.exs
+++ b/test/web/common_api/common_api_utils_test.exs
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors 
+# Copyright © 2017-2019 Pleroma Authors 
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Web.CommonAPI.UtilsTest do
-- 
cgit v1.2.3
From cf3041220a7a14dc3fac24177fac1f4aecc77f5f Mon Sep 17 00:00:00 2001
From: Egor Kislitsyn 
Date: Tue, 17 Sep 2019 15:22:46 +0700
Subject: Add support for `rel="ugc"`
---
 test/web/common_api/common_api_utils_test.exs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'test/web/common_api')
diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs
index 230146451..78cfe3c5f 100644
--- a/test/web/common_api/common_api_utils_test.exs
+++ b/test/web/common_api/common_api_utils_test.exs
@@ -157,11 +157,11 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
       text = "**hello world**\n\n*another @user__test and @user__test google.com paragraph*"
 
       expected =
-        "hello world
\nanother hello world
\nanother @user__test and @user__test and @user__test google.com paragraph
\n"
+        }" class="u-url mention" href="http://foo.com/user__test">@user__test google.com paragraph
\n)
 
       {output, _, _} = Utils.format_input(text, "text/markdown")
 
-- 
cgit v1.2.3
From 95c948110ca130559fd6a5302011aa58900274ac Mon Sep 17 00:00:00 2001
From: Egor Kislitsyn 
Date: Thu, 19 Sep 2019 14:39:52 +0700
Subject:  Add `rel="ugc"` to hashtags and mentions
---
 test/web/common_api/common_api_utils_test.exs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'test/web/common_api')
diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs
index 78cfe3c5f..2588898d0 100644
--- a/test/web/common_api/common_api_utils_test.exs
+++ b/test/web/common_api/common_api_utils_test.exs
@@ -159,9 +159,9 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
       expected =
         ~s(hello world
\nanother @user__test and @user__test and @user__test google.com paragraph
\n)
+        }" class="u-url mention" href="http://foo.com/user__test" rel="ugc">@user__test google.com paragraph\n)
 
       {output, _, _} = Utils.format_input(text, "text/markdown")
 
-- 
cgit v1.2.3
From 2c82d8603bb4c3f7281023752dc78aa31a814ab6 Mon Sep 17 00:00:00 2001
From: Ariadne Conill 
Date: Sat, 28 Sep 2019 00:24:32 +0000
Subject: common api: implement scrobbling
---
 test/web/common_api/common_api_test.exs | 39 +++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
(limited to 'test/web/common_api')
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index f28a66090..0f4a5eb25 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -510,4 +510,43 @@ defmodule Pleroma.Web.CommonAPITest do
       assert {:error, "Already voted"} == CommonAPI.vote(other_user, object, [1])
     end
   end
+
+  describe "listen/2" do
+    test "returns a valid activity" do
+      user = insert(:user)
+
+      {:ok, activity} =
+        CommonAPI.listen(user, %{
+          "title" => "lain radio episode 1",
+          "album" => "lain radio",
+          "artist" => "lain",
+          "length" => 180_000
+        })
+
+      object = Object.normalize(activity)
+
+      assert object.data["title"] == "lain radio episode 1"
+
+      assert Visibility.get_visibility(activity) == "public"
+    end
+
+    test "respects visibility=private" do
+      user = insert(:user)
+
+      {:ok, activity} =
+        CommonAPI.listen(user, %{
+          "title" => "lain radio episode 1",
+          "album" => "lain radio",
+          "artist" => "lain",
+          "length" => 180_000,
+          "visibility" => "private"
+        })
+
+      object = Object.normalize(activity)
+
+      assert object.data["title"] == "lain radio episode 1"
+
+      assert Visibility.get_visibility(activity) == "private"
+    end
+  end
 end
-- 
cgit v1.2.3
From 7d5a9f3f6d393c744364148568cfb9b0249789fc Mon Sep 17 00:00:00 2001
From: Thibaut Girka 
Date: Tue, 1 Oct 2019 19:08:25 +0200
Subject: Add tests for privately announcing statuses via API
---
 test/web/common_api/common_api_test.exs | 12 ++++++++++++
 1 file changed, 12 insertions(+)
(limited to 'test/web/common_api')
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index 0f4a5eb25..2d3c41e82 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -231,6 +231,18 @@ defmodule Pleroma.Web.CommonAPITest do
       {:ok, %Activity{}, _} = CommonAPI.repeat(activity.id, user)
     end
 
+    test "repeating a status privately" do
+      user = insert(:user)
+      other_user = insert(:user)
+
+      {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
+
+      {:ok, %Activity{} = announce_activity, _} =
+        CommonAPI.repeat(activity.id, user, %{"visibility" => "private"})
+
+      assert Visibility.is_private?(announce_activity)
+    end
+
     test "favoriting a status" do
       user = insert(:user)
       other_user = insert(:user)
-- 
cgit v1.2.3
From 276a52016307707fa6a2f91bd9a3038dcfb71ba7 Mon Sep 17 00:00:00 2001
From: lain 
Date: Sat, 5 Oct 2019 14:53:50 +0200
Subject: CommonAPI: Create profile updates as public.
This saves us lots of sending out because we can use sharedInbox.
---
 test/web/common_api/common_api_test.exs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
(limited to 'test/web/common_api')
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index 2d3c41e82..83df44c36 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -14,6 +14,8 @@ defmodule Pleroma.Web.CommonAPITest do
 
   import Pleroma.Factory
 
+  require Pleroma.Constants
+
   clear_config([:instance, :safe_dm_mentions])
   clear_config([:instance, :limit])
   clear_config([:instance, :max_pinned_statuses])
@@ -96,11 +98,13 @@ defmodule Pleroma.Web.CommonAPITest do
   test "it adds emoji when updating profiles" do
     user = insert(:user, %{name: ":firefox:"})
 
-    CommonAPI.update(user)
+    {:ok, activity} = CommonAPI.update(user)
     user = User.get_cached_by_ap_id(user.ap_id)
     [firefox] = user.info.source_data["tag"]
 
     assert firefox["name"] == ":firefox:"
+
+    assert Pleroma.Constants.as_public() in activity.recipients
   end
 
   describe "posting" do
-- 
cgit v1.2.3