Allow group members to access group drafts

Closes #843

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-11-13 18:43:44 +01:00
parent 6a63ece91f
commit 6d599441a9
5 changed files with 68 additions and 5 deletions

View File

@@ -391,12 +391,15 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do
} = params
)
when object_type in ["Person", "Group", "Application", "Service", "Organization"] do
with {:ok, %Actor{suspended: false} = old_actor} <-
with author_url <- Utils.get_actor(params),
{:ok, %Actor{suspended: false} = author} <-
ActivityPubActor.get_or_fetch_actor_by_url(author_url),
{:ok, %Actor{suspended: false} = old_actor} <-
ActivityPubActor.get_or_fetch_actor_by_url(object["id"]),
object_data <-
object |> Converter.Actor.as_to_model_data(),
{:ok, %Activity{} = activity, %Actor{} = new_actor} <-
Actions.Update.update(old_actor, object_data, false) do
Actions.Update.update(old_actor, object_data, false, %{updater_actor: author}) do
{:ok, activity, new_actor}
else
e ->