Refresh after invite accept only if remote group
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
7f0256d845
commit
8185fcd0bd
|
@ -824,10 +824,7 @@ defmodule Mobilizon.Federation.ActivityPub do
|
|||
Mobilizon.Service.Activity.Member.insert_activity(member,
|
||||
subject: "member_approved"
|
||||
),
|
||||
_ <-
|
||||
unless(is_nil(member.parent.domain),
|
||||
do: Refresher.fetch_group(member.parent.url, member.actor)
|
||||
),
|
||||
_ <- maybe_refresh_group(member),
|
||||
Absinthe.Subscription.publish(Endpoint, member.actor,
|
||||
group_membership_changed: [
|
||||
Actor.preferred_username_and_domain(member.parent),
|
||||
|
@ -866,6 +863,7 @@ defmodule Mobilizon.Federation.ActivityPub do
|
|||
Mobilizon.Service.Activity.Member.insert_activity(member,
|
||||
subject: "member_accepted_invitation"
|
||||
),
|
||||
_ <- maybe_refresh_group(member),
|
||||
accept_data <- %{
|
||||
"type" => "Accept",
|
||||
"attributedTo" => member.parent.url,
|
||||
|
@ -879,6 +877,14 @@ defmodule Mobilizon.Federation.ActivityPub do
|
|||
end
|
||||
end
|
||||
|
||||
defp maybe_refresh_group(%Member{
|
||||
parent: %Actor{domain: parent_domain, url: parent_url},
|
||||
actor: %Actor{} = actor
|
||||
}) do
|
||||
unless is_nil(parent_domain),
|
||||
do: Refresher.fetch_group(parent_url, actor)
|
||||
end
|
||||
|
||||
@spec reject_join(Participant.t(), map()) :: {:ok, Participant.t(), Activity.t()} | any()
|
||||
defp reject_join(%Participant{} = participant, additional) do
|
||||
with {:ok, %Participant{} = participant} <-
|
||||
|
|
|
@ -109,8 +109,6 @@ defmodule Mobilizon.GraphQL.Resolvers.Member do
|
|||
member,
|
||||
true
|
||||
) do
|
||||
# Launch an async task to refresh the group profile, fetch resources, discussions, members
|
||||
Refresher.fetch_group(member.parent.url, actor)
|
||||
{:ok, member}
|
||||
else
|
||||
{:is_same_actor, false} ->
|
||||
|
|
Loading…
Reference in a new issue