From ca2e9ce9cc98f046ea2be0a9051cdf06d253d7f6 Mon Sep 17 00:00:00 2001 From: Maxim Filippov Date: Tue, 25 Dec 2018 03:44:48 +0300 Subject: [PATCH] Revert unneeded changes --- lib/pleroma/notification.ex | 7 +------ lib/pleroma/web/activity_pub/transmogrifier.ex | 3 +-- lib/pleroma/web/common_api/utils.ex | 7 +------ 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index 457cba935..47578d60e 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -75,16 +75,11 @@ def get(%{id: user_id} = _user, id) do end end - def clear(%User{} = user) do + def clear(user) do from(n in Notification, where: n.user_id == ^user.id) |> Repo.delete_all() end - def clear(%Activity{} = activity) do - from(n in Notification, where: n.activity_id == ^activity.id) - |> Repo.delete_all() - end - def dismiss(%{id: user_id} = _user, id) do notification = Repo.get(Notification, id) diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 87514870d..e6af4b211 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -586,8 +586,7 @@ def get_obj_helper(id) do end def set_reply_to_uri(%{"inReplyTo" => inReplyTo} = object) do - with false <- is_nil(inReplyTo), - false <- String.starts_with?(inReplyTo, "http"), + with false <- String.starts_with?(inReplyTo, "http"), {:ok, %{data: replied_to_object}} <- get_obj_helper(inReplyTo) do Map.put(object, "inReplyTo", replied_to_object["external_url"] || inReplyTo) else diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index d25fef6bc..142283684 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -69,12 +69,7 @@ def to_for_user_and_mentions(_user, mentions, inReplyTo, "direct") do mentioned_users = Enum.map(mentions, fn {_, %{ap_id: ap_id}} -> ap_id end) if inReplyTo do - to = - [inReplyTo.data["actor"] | mentioned_users] - |> Enum.uniq() - |> Enum.reject(&is_nil/1) - - {to, []} + {Enum.uniq([inReplyTo.data["actor"] | mentioned_users]), []} else {mentioned_users, []} end