forked from potsda.mn/mobilizon
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,
|
Mobilizon.Service.Activity.Member.insert_activity(member,
|
||||||
subject: "member_approved"
|
subject: "member_approved"
|
||||||
),
|
),
|
||||||
_ <-
|
_ <- maybe_refresh_group(member),
|
||||||
unless(is_nil(member.parent.domain),
|
|
||||||
do: Refresher.fetch_group(member.parent.url, member.actor)
|
|
||||||
),
|
|
||||||
Absinthe.Subscription.publish(Endpoint, member.actor,
|
Absinthe.Subscription.publish(Endpoint, member.actor,
|
||||||
group_membership_changed: [
|
group_membership_changed: [
|
||||||
Actor.preferred_username_and_domain(member.parent),
|
Actor.preferred_username_and_domain(member.parent),
|
||||||
|
@ -866,6 +863,7 @@ defmodule Mobilizon.Federation.ActivityPub do
|
||||||
Mobilizon.Service.Activity.Member.insert_activity(member,
|
Mobilizon.Service.Activity.Member.insert_activity(member,
|
||||||
subject: "member_accepted_invitation"
|
subject: "member_accepted_invitation"
|
||||||
),
|
),
|
||||||
|
_ <- maybe_refresh_group(member),
|
||||||
accept_data <- %{
|
accept_data <- %{
|
||||||
"type" => "Accept",
|
"type" => "Accept",
|
||||||
"attributedTo" => member.parent.url,
|
"attributedTo" => member.parent.url,
|
||||||
|
@ -879,6 +877,14 @@ defmodule Mobilizon.Federation.ActivityPub do
|
||||||
end
|
end
|
||||||
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()
|
@spec reject_join(Participant.t(), map()) :: {:ok, Participant.t(), Activity.t()} | any()
|
||||||
defp reject_join(%Participant{} = participant, additional) do
|
defp reject_join(%Participant{} = participant, additional) do
|
||||||
with {:ok, %Participant{} = participant} <-
|
with {:ok, %Participant{} = participant} <-
|
||||||
|
|
|
@ -109,8 +109,6 @@ defmodule Mobilizon.GraphQL.Resolvers.Member do
|
||||||
member,
|
member,
|
||||||
true
|
true
|
||||||
) do
|
) do
|
||||||
# Launch an async task to refresh the group profile, fetch resources, discussions, members
|
|
||||||
Refresher.fetch_group(member.parent.url, actor)
|
|
||||||
{:ok, member}
|
{:ok, member}
|
||||||
else
|
else
|
||||||
{:is_same_actor, false} ->
|
{:is_same_actor, false} ->
|
||||||
|
|
Loading…
Reference in a new issue