From c8f31e0bc2764c924a4045e007e828052c837ac2 Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Sat, 9 Mar 2019 14:08:41 +0100 Subject: [PATCH 01/11] Implement mastodon's reblog hiding feature --- lib/pleroma/user.ex | 4 ++++ lib/pleroma/user/info.ex | 13 +++++++++++++ lib/pleroma/web/activity_pub/activity_pub.ex | 10 +++++++++- lib/pleroma/web/common_api/common_api.ex | 16 ++++++++++++++++ .../web/mastodon_api/mastodon_api_controller.ex | 13 +++++++++++++ .../web/mastodon_api/views/account_view.ex | 2 +- 6 files changed, 56 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 1ce9882f6..467cb910b 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -1385,4 +1385,8 @@ defp paginate(query, page, page_size) do offset: ^((page - 1) * page_size) ) end + + def showing_reblogs?(%User{} = user, %User{} = target) do + target.id not in user.info.muted_reblogs + end end diff --git a/lib/pleroma/user/info.ex b/lib/pleroma/user/info.ex index e3fd65a6e..35586e212 100644 --- a/lib/pleroma/user/info.ex +++ b/lib/pleroma/user/info.ex @@ -21,6 +21,7 @@ defmodule Pleroma.User.Info do field(:blocks, {:array, :string}, default: []) field(:domain_blocks, {:array, :string}, default: []) field(:mutes, {:array, :string}, default: []) + field(:muted_reblogs, {:array, :string}, default: []) field(:deactivated, :boolean, default: false) field(:no_rich_text, :boolean, default: false) field(:ap_enabled, :boolean, default: false) @@ -259,4 +260,16 @@ def roles(%Info{is_moderator: is_moderator, is_admin: is_admin}) do moderator: is_moderator } end + + def add_reblog_mute(info, id) do + params = %{muted_reblogs: info.muted_reblogs ++ [id]} + + cast(info, params, [:muted_reblogs]) + end + + def remove_reblog_mute(info, id) do + params = %{muted_reblogs: List.delete(info.muted_reblogs, id)} + + cast(info, params, [:muted_reblogs]) + end end diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 70db419ca..779ee139b 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -951,9 +951,17 @@ def contain_broken_threads(%Activity{} = activity, %User{} = user) do entire_thread_visible_for_user?(activity, user) end + # filter out muted threads + def contain_muted_boosts(%Activity{data: %{"type" => "Announce"}} = activity, %User{} = user) do + id = User.get_by_ap_id(activity.actor).id + id not in user.info.muted_reblogs + end + + def contain_muted_boosts(%Activity{} = _activity, %User{} = _user), do: true + # do post-processing on a specific activity def contain_activity(%Activity{} = activity, %User{} = user) do - contain_broken_threads(activity, user) + contain_broken_threads(activity, user) and contain_muted_boosts(activity, user) end # do post-processing on a timeline diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index de0759fb0..035c59387 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -299,4 +299,20 @@ def report(user, data) do {:account, nil} -> {:error, "Account not found"} end end + + def hide_reblogs(user, id) do + if id not in user.info.muted_reblogs do + info_changeset = User.Info.add_reblog_mute(user.info, id) + changeset = Ecto.Changeset.change(user) |> Ecto.Changeset.put_embed(:info, info_changeset) + User.update_and_set_cache(changeset) + end + end + + def show_reblogs(user, id) do + if id in user.info.muted_reblogs do + info_changeset = User.Info.remove_reblog_mute(user.info, id) + changeset = Ecto.Changeset.change(user) |> Ecto.Changeset.put_embed(:info, info_changeset) + User.update_and_set_cache(changeset) + end + end end diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 265bf837e..570bf0c0f 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -723,11 +723,24 @@ def reject_follow_request(%{assigns: %{user: followed}} = conn, %{"id" => id}) d def follow(%{assigns: %{user: follower}} = conn, %{"id" => id}) do with %User{} = followed <- Repo.get(User, id), + false <- User.following?(follower, followed), {:ok, follower, followed, _} <- CommonAPI.follow(follower, followed) do conn |> put_view(AccountView) |> render("relationship.json", %{user: follower, target: followed}) else + true -> + case conn.params["reblogs"] do + true -> CommonAPI.show_reblogs(follower, id) + false -> CommonAPI.hide_reblogs(follower, id) + end + + followed = Repo.get(User, id) + + conn + |> put_view(AccountView) + |> render("relationship.json", %{user: follower, target: followed}) + {:error, message} -> conn |> put_resp_content_type("application/json") diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index c32f27be2..b5f3bbb9d 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -55,7 +55,7 @@ def render("relationship.json", %{user: %User{} = user, target: %User{} = target muting_notifications: false, requested: requested, domain_blocking: false, - showing_reblogs: false, + showing_reblogs: User.showing_reblogs?(user, target), endorsed: false } end From 13c298d3543b08e656068a0f50acb35f036bdaaa Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Sat, 9 Mar 2019 14:22:55 +0100 Subject: [PATCH 02/11] Fix tests to assume reblogs shown by default --- test/web/mastodon_api/account_view_test.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/web/mastodon_api/account_view_test.exs b/test/web/mastodon_api/account_view_test.exs index c2ffc21da..6dc60afe9 100644 --- a/test/web/mastodon_api/account_view_test.exs +++ b/test/web/mastodon_api/account_view_test.exs @@ -144,7 +144,7 @@ test "represent a relationship" do muting_notifications: false, requested: false, domain_blocking: false, - showing_reblogs: false, + showing_reblogs: true, endorsed: false } @@ -202,7 +202,7 @@ test "represent an embedded relationship" do muting_notifications: false, requested: false, domain_blocking: false, - showing_reblogs: false, + showing_reblogs: true, endorsed: false } } From fe4c1d26fcbe5ce260bde94e75f617ae0fcb338f Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Sat, 9 Mar 2019 16:24:32 +0100 Subject: [PATCH 03/11] Add ActivityPub.contain_activity checks to streamer --- lib/pleroma/web/streamer.ex | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex index 5850a9579..bd91e1f50 100644 --- a/lib/pleroma/web/streamer.ex +++ b/lib/pleroma/web/streamer.ex @@ -12,6 +12,7 @@ defmodule Pleroma.Web.Streamer do alias Pleroma.User alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.MastodonAPI.NotificationView + alias Pleroma.Web.ActivityPub.ActivityPub @keepalive_interval :timer.seconds(30) @@ -203,7 +204,9 @@ def push_to_socket(topics, topic, %Activity{data: %{"type" => "Announce"}} = ite parent = Object.normalize(item.data["object"]) unless is_nil(parent) or item.actor in blocks or item.actor in mutes or - parent.data["actor"] in blocks or parent.data["actor"] in mutes do + not ActivityPub.contain_activity(item, user) or + parent.data["actor"] in blocks or + parent.data["actor"] in mutes do send(socket.transport_pid, {:text, represent_update(item, user)}) end else @@ -233,7 +236,8 @@ def push_to_socket(topics, topic, item) do blocks = user.info.blocks || [] mutes = user.info.mutes || [] - unless item.actor in blocks or item.actor in mutes do + unless item.actor in blocks or item.actor in mutes or + not ActivityPub.contain_activity(item, user) do send(socket.transport_pid, {:text, represent_update(item, user)}) end else From aa71139e4a9913cc5baf3f5f567bcef4ae59a8c0 Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Sat, 9 Mar 2019 16:31:53 +0100 Subject: [PATCH 04/11] Fix elixir 1.8 vs 1.7 format conflict --- lib/pleroma/web/streamer.ex | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex index bd91e1f50..a04ee1b6e 100644 --- a/lib/pleroma/web/streamer.ex +++ b/lib/pleroma/web/streamer.ex @@ -204,8 +204,7 @@ def push_to_socket(topics, topic, %Activity{data: %{"type" => "Announce"}} = ite parent = Object.normalize(item.data["object"]) unless is_nil(parent) or item.actor in blocks or item.actor in mutes or - not ActivityPub.contain_activity(item, user) or - parent.data["actor"] in blocks or + not ActivityPub.contain_activity(item, user) or parent.data["actor"] in blocks or parent.data["actor"] in mutes do send(socket.transport_pid, {:text, represent_update(item, user)}) end From 15b21d1983fad08e71f6fd7adffbcfd6f2d8cba1 Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Mon, 11 Mar 2019 16:57:54 +0100 Subject: [PATCH 05/11] refactor filtering mechanism --- lib/pleroma/web/activity_pub/activity_pub.ex | 21 ++++++++++++------- .../mastodon_api/mastodon_api_controller.ex | 2 +- lib/pleroma/web/streamer.ex | 2 ++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 779ee139b..5d9ce7fd7 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -679,6 +679,18 @@ defp restrict_pinned(query, %{"pinned" => "true", "pinned_activity_ids" => ids}) defp restrict_pinned(query, _), do: query + defp restrict_muted_reblogs(query, %{"muting_user" => %User{info: info}}) do + muted_reblogs = info.muted_reblogs || [] + + from( + activity in query, + where: fragment("not ?->>'type' = 'Announce'", activity.data), + where: fragment("not ? = ANY(?)", activity.actor, ^muted_reblogs) + ) + end + + defp restrict_muted_reblogs(query, _), do: query + def fetch_activities_query(recipients, opts \\ %{}) do base_query = from( @@ -706,6 +718,7 @@ def fetch_activities_query(recipients, opts \\ %{}) do |> restrict_replies(opts) |> restrict_reblogs(opts) |> restrict_pinned(opts) + |> restrict_muted_reblogs(opts) end def fetch_activities(recipients, opts \\ %{}) do @@ -951,17 +964,11 @@ def contain_broken_threads(%Activity{} = activity, %User{} = user) do entire_thread_visible_for_user?(activity, user) end - # filter out muted threads - def contain_muted_boosts(%Activity{data: %{"type" => "Announce"}} = activity, %User{} = user) do - id = User.get_by_ap_id(activity.actor).id - id not in user.info.muted_reblogs - end - def contain_muted_boosts(%Activity{} = _activity, %User{} = _user), do: true # do post-processing on a specific activity def contain_activity(%Activity{} = activity, %User{} = user) do - contain_broken_threads(activity, user) and contain_muted_boosts(activity, user) + contain_broken_threads(activity, user) end # do post-processing on a timeline diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 570bf0c0f..68b7d8b49 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -735,7 +735,7 @@ def follow(%{assigns: %{user: follower}} = conn, %{"id" => id}) do false -> CommonAPI.hide_reblogs(follower, id) end - followed = Repo.get(User, id) + followed = User.get_cached_by_id(id) conn |> put_view(AccountView) diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex index a04ee1b6e..b87db941b 100644 --- a/lib/pleroma/web/streamer.ex +++ b/lib/pleroma/web/streamer.ex @@ -200,10 +200,12 @@ def push_to_socket(topics, topic, %Activity{data: %{"type" => "Announce"}} = ite user = User.get_cached_by_ap_id(socket.assigns[:user].ap_id) blocks = user.info.blocks || [] mutes = user.info.mutes || [] + reblog_mutes = user.info.reblog_mutes || [] parent = Object.normalize(item.data["object"]) unless is_nil(parent) or item.actor in blocks or item.actor in mutes or + item.actor in reblog_mutes or not ActivityPub.contain_activity(item, user) or parent.data["actor"] in blocks or parent.data["actor"] in mutes do send(socket.transport_pid, {:text, represent_update(item, user)}) From be465c762be19eda6725d4f323798caa23241715 Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Mon, 11 Mar 2019 19:59:25 +0100 Subject: [PATCH 06/11] formatting --- lib/pleroma/web/streamer.ex | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex index b87db941b..fa0fb2ac8 100644 --- a/lib/pleroma/web/streamer.ex +++ b/lib/pleroma/web/streamer.ex @@ -205,9 +205,8 @@ def push_to_socket(topics, topic, %Activity{data: %{"type" => "Announce"}} = ite parent = Object.normalize(item.data["object"]) unless is_nil(parent) or item.actor in blocks or item.actor in mutes or - item.actor in reblog_mutes or - not ActivityPub.contain_activity(item, user) or parent.data["actor"] in blocks or - parent.data["actor"] in mutes do + item.actor in reblog_mutes or not ActivityPub.contain_activity(item, user) or + parent.data["actor"] in blocks or parent.data["actor"] in mutes do send(socket.transport_pid, {:text, represent_update(item, user)}) end else From da53c079db91ce5d7ba14809f5e99b10d3ae307a Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Fri, 15 Mar 2019 14:06:58 +0100 Subject: [PATCH 07/11] Refactor to store user ap_id, add tests --- lib/pleroma/user.ex | 2 +- lib/pleroma/user/info.ex | 8 ++--- lib/pleroma/web/common_api/common_api.ex | 16 ++++++---- .../mastodon_api/mastodon_api_controller.ex | 11 +++---- lib/pleroma/web/streamer.ex | 2 +- test/web/activity_pub/activity_pub_test.exs | 13 ++++++++ test/web/common_api/common_api_test.exs | 23 ++++++++++++++ test/web/streamer_test.exs | 30 +++++++++++++++++++ 8 files changed, 88 insertions(+), 17 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 467cb910b..692ae836c 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -1387,6 +1387,6 @@ defp paginate(query, page, page_size) do end def showing_reblogs?(%User{} = user, %User{} = target) do - target.id not in user.info.muted_reblogs + target.ap_id not in user.info.muted_reblogs end end diff --git a/lib/pleroma/user/info.ex b/lib/pleroma/user/info.ex index 35586e212..70b72710b 100644 --- a/lib/pleroma/user/info.ex +++ b/lib/pleroma/user/info.ex @@ -261,14 +261,14 @@ def roles(%Info{is_moderator: is_moderator, is_admin: is_admin}) do } end - def add_reblog_mute(info, id) do - params = %{muted_reblogs: info.muted_reblogs ++ [id]} + def add_reblog_mute(info, ap_id) do + params = %{muted_reblogs: info.muted_reblogs ++ [ap_id]} cast(info, params, [:muted_reblogs]) end - def remove_reblog_mute(info, id) do - params = %{muted_reblogs: List.delete(info.muted_reblogs, id)} + def remove_reblog_mute(info, ap_id) do + params = %{muted_reblogs: List.delete(info.muted_reblogs, ap_id)} cast(info, params, [:muted_reblogs]) end diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index 035c59387..84d66efc9 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -300,17 +300,21 @@ def report(user, data) do end end - def hide_reblogs(user, id) do - if id not in user.info.muted_reblogs do - info_changeset = User.Info.add_reblog_mute(user.info, id) + def hide_reblogs(user, muted) do + ap_id = muted.ap_id + + if ap_id not in user.info.muted_reblogs do + info_changeset = User.Info.add_reblog_mute(user.info, ap_id) changeset = Ecto.Changeset.change(user) |> Ecto.Changeset.put_embed(:info, info_changeset) User.update_and_set_cache(changeset) end end - def show_reblogs(user, id) do - if id in user.info.muted_reblogs do - info_changeset = User.Info.remove_reblog_mute(user.info, id) + def show_reblogs(user, muted) do + ap_id = muted.ap_id + + if ap_id in user.info.muted_reblogs do + info_changeset = User.Info.remove_reblog_mute(user.info, ap_id) changeset = Ecto.Changeset.change(user) |> Ecto.Changeset.put_embed(:info, info_changeset) User.update_and_set_cache(changeset) end diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 68b7d8b49..952aa2453 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -730,13 +730,14 @@ def follow(%{assigns: %{user: follower}} = conn, %{"id" => id}) do |> render("relationship.json", %{user: follower, target: followed}) else true -> - case conn.params["reblogs"] do - true -> CommonAPI.show_reblogs(follower, id) - false -> CommonAPI.hide_reblogs(follower, id) - end - followed = User.get_cached_by_id(id) + {:ok, follower} = + case conn.params["reblogs"] do + true -> CommonAPI.show_reblogs(follower, followed) + false -> CommonAPI.hide_reblogs(follower, followed) + end + conn |> put_view(AccountView) |> render("relationship.json", %{user: follower, target: followed}) diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex index fa0fb2ac8..a0863a062 100644 --- a/lib/pleroma/web/streamer.ex +++ b/lib/pleroma/web/streamer.ex @@ -200,7 +200,7 @@ def push_to_socket(topics, topic, %Activity{data: %{"type" => "Announce"}} = ite user = User.get_cached_by_ap_id(socket.assigns[:user].ap_id) blocks = user.info.blocks || [] mutes = user.info.mutes || [] - reblog_mutes = user.info.reblog_mutes || [] + reblog_mutes = user.info.muted_reblogs || [] parent = Object.normalize(item.data["object"]) diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index 2b83bfb1d..035778218 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -424,6 +424,19 @@ test "retrieves ids up to max_id" do assert length(activities) == 20 assert last == last_expected end + + test "doesn't return reblogs for users for whom reblogs have been muted" do + activity = insert(:note_activity) + user = insert(:user) + booster = insert(:user) + {:ok, user} = CommonAPI.hide_reblogs(user, booster) + + {:ok, activity, _} = CommonAPI.repeat(activity.id, booster) + + activities = ActivityPub.fetch_activities([], %{"muting_user" => user}) + + refute Enum.member?(activities, activity) + end end describe "like an object" do diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 181813c76..f83f80b40 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -221,4 +221,27 @@ test "creates a report" do } = flag_activity end end + + describe "reblog muting" do + setup do + muter = insert(:user) + + muted = insert(:user) + + [muter: muter, muted: muted] + end + + test "add a reblog mute", %{muter: muter, muted: muted} do + {:ok, muter} = CommonAPI.hide_reblogs(muter, muted) + + assert Pleroma.User.showing_reblogs?(muter, muted) == false + end + + test "remove a reblog mute", %{muter: muter, muted: muted} do + {:ok, muter} = CommonAPI.hide_reblogs(muter, muted) + {:ok, muter} = CommonAPI.show_reblogs(muter, muted) + + assert Pleroma.User.showing_reblogs?(muter, muted) == true + end + end end diff --git a/test/web/streamer_test.exs b/test/web/streamer_test.exs index 0a2e91298..f00577a8a 100644 --- a/test/web/streamer_test.exs +++ b/test/web/streamer_test.exs @@ -202,4 +202,34 @@ test "it send wanted private posts to list" do Task.await(task) end + + test "it doesn't send muted reblogs" do + user1 = insert(:user) + user2 = insert(:user) + user3 = insert(:user) + CommonAPI.hide_reblogs(user1, user2.ap_id) + + task = + Task.async(fn -> + refute_receive {:text, _}, 1_000 + end) + + fake_socket = %{ + transport_pid: task.pid, + assigns: %{ + user: user1 + } + } + + {:ok, create_activity} = CommonAPI.post(user3, %{"status" => "I'm kawen"}) + {:ok, announce_activity, _} = CommonAPI.repeat(create_activity.id, user2) + + topics = %{ + "public" => [fake_socket] + } + + Streamer.push_to_socket(topics, "public", announce_activity) + + Task.await(task) + end end From ebfc10c834907011c3ac632ea876ce18e9d3c9e4 Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Fri, 15 Mar 2019 14:13:42 +0100 Subject: [PATCH 08/11] Fix streamer test --- test/web/streamer_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/web/streamer_test.exs b/test/web/streamer_test.exs index f00577a8a..bfe18cb7f 100644 --- a/test/web/streamer_test.exs +++ b/test/web/streamer_test.exs @@ -207,7 +207,7 @@ test "it doesn't send muted reblogs" do user1 = insert(:user) user2 = insert(:user) user3 = insert(:user) - CommonAPI.hide_reblogs(user1, user2.ap_id) + CommonAPI.hide_reblogs(user1, user2) task = Task.async(fn -> From 094e1ef048f972fc3ead8d597ac9dbe6f5f62f34 Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Fri, 15 Mar 2019 14:28:14 +0100 Subject: [PATCH 09/11] formatting --- lib/pleroma/user/info.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/user/info.ex b/lib/pleroma/user/info.ex index 70b72710b..740a46727 100644 --- a/lib/pleroma/user/info.ex +++ b/lib/pleroma/user/info.ex @@ -260,7 +260,7 @@ def roles(%Info{is_moderator: is_moderator, is_admin: is_admin}) do moderator: is_moderator } end - + def add_reblog_mute(info, ap_id) do params = %{muted_reblogs: info.muted_reblogs ++ [ap_id]} From dfeb3aec44efb9ffdbe9e6409a79aa50b7e268a8 Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Fri, 15 Mar 2019 14:36:07 +0100 Subject: [PATCH 10/11] fix credo warning --- lib/pleroma/web/streamer.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex index a0863a062..7425bfb54 100644 --- a/lib/pleroma/web/streamer.ex +++ b/lib/pleroma/web/streamer.ex @@ -10,9 +10,9 @@ defmodule Pleroma.Web.Streamer do alias Pleroma.Object alias Pleroma.Repo alias Pleroma.User + alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.MastodonAPI.NotificationView - alias Pleroma.Web.ActivityPub.ActivityPub @keepalive_interval :timer.seconds(30) From d8244c2a1bfc54b9dfa70be3ce49db961205f883 Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Fri, 15 Mar 2019 15:03:03 +0100 Subject: [PATCH 11/11] remove unused function --- lib/pleroma/web/activity_pub/activity_pub.ex | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 5d9ce7fd7..a65d6e020 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -964,8 +964,6 @@ def contain_broken_threads(%Activity{} = activity, %User{} = user) do entire_thread_visible_for_user?(activity, user) end - def contain_muted_boosts(%Activity{} = _activity, %User{} = _user), do: true - # do post-processing on a specific activity def contain_activity(%Activity{} = activity, %User{} = user) do contain_broken_threads(activity, user)