diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-11-16 19:22:32 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-11-19 09:53:13 +0300 |
commit | e2bf6b1f7ee6115a7eafa78272bdbafe7f4789c5 (patch) | |
tree | dc75020997287354570c44285165d9de70083407 /lib | |
parent | 8a7ee9fe74f64680da366b0da51038bed022061b (diff) | |
download | pleroma-e2bf6b1f7ee6115a7eafa78272bdbafe7f4789c5.tar.gz |
fix for forwarded reports
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/emails/admin_email.ex | 3 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 35 |
2 files changed, 25 insertions, 13 deletions
diff --git a/lib/pleroma/emails/admin_email.ex b/lib/pleroma/emails/admin_email.ex index 02274554f..d5757c12a 100644 --- a/lib/pleroma/emails/admin_email.ex +++ b/lib/pleroma/emails/admin_email.ex @@ -48,6 +48,9 @@ defmodule Pleroma.Emails.AdminEmail do status_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, id) "<li><a href=\"#{status_url}\">#{status_url}</li>" + %{"id" => id} when is_binary(id) -> + "<li><a href=\"#{id}\">#{id}</li>" + id when is_binary(id) -> "<li><a href=\"#{id}\">#{id}</li>" end) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 35f71b7ae..8f3ce1343 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -332,15 +332,21 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do end @spec flag(map()) :: {:ok, Activity.t()} | {:error, any()} - def flag( - %{ - actor: actor, - context: _context, - account: account, - statuses: statuses, - content: content - } = params - ) do + def flag(params) do + with {:ok, result} <- Repo.transaction(fn -> do_flag(params) end) do + result + end + end + + defp do_flag( + %{ + actor: actor, + context: _context, + account: account, + statuses: statuses, + content: content + } = params + ) do # only accept false as false value local = !(params[:local] == false) forward = !(params[:forward] == false) @@ -358,7 +364,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do {:ok, activity} <- insert(flag_data, local), {:ok, stripped_activity} <- strip_report_status_data(activity), _ <- notify_and_stream(activity), - :ok <- maybe_federate(stripped_activity) do + :ok <- + maybe_federate(stripped_activity) do User.all_superusers() |> Enum.filter(fn user -> not is_nil(user.email) end) |> Enum.each(fn superuser -> @@ -368,6 +375,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do end) {:ok, activity} + else + {:error, error} -> Repo.rollback(error) end end @@ -791,10 +800,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do where: fragment( """ - ?->>'type' != 'Create' -- This isn't a Create + ?->>'type' != 'Create' -- This isn't a Create OR ?->>'inReplyTo' is null -- this isn't a reply - OR ? && array_remove(?, ?) -- The recipient is us or one of our friends, - -- unless they are the author (because authors + OR ? && array_remove(?, ?) -- The recipient is us or one of our friends, + -- unless they are the author (because authors -- are also part of the recipients). This leads -- to a bug that self-replies by friends won't -- show up. |