Make sure relay and anonymous actors don't automatically approve
followers Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
938f698b7a
commit
628c55cd84
|
@ -416,17 +416,18 @@ defmodule Mobilizon.Actors.Actor do
|
||||||
@spec build_relay_creation_attrs :: Ecto.Changeset.t()
|
@spec build_relay_creation_attrs :: Ecto.Changeset.t()
|
||||||
def build_relay_creation_attrs do
|
def build_relay_creation_attrs do
|
||||||
data = %{
|
data = %{
|
||||||
"name" => Config.get([:instance, :name], "Mobilizon"),
|
name: Config.get([:instance, :name], "Mobilizon"),
|
||||||
"summary" =>
|
summary:
|
||||||
Config.get(
|
Config.get(
|
||||||
[:instance, :description],
|
[:instance, :description],
|
||||||
"An internal service actor for this Mobilizon instance"
|
"An internal service actor for this Mobilizon instance"
|
||||||
),
|
),
|
||||||
"keys" => Crypto.generate_rsa_2048_private_key(),
|
keys: Crypto.generate_rsa_2048_private_key(),
|
||||||
"preferred_username" => "relay",
|
preferred_username: "relay",
|
||||||
"domain" => nil,
|
domain: nil,
|
||||||
"visibility" => :public,
|
visibility: :public,
|
||||||
"type" => :Application
|
type: :Application,
|
||||||
|
manually_approves_followers: true
|
||||||
}
|
}
|
||||||
|
|
||||||
%__MODULE__{}
|
%__MODULE__{}
|
||||||
|
@ -440,12 +441,13 @@ defmodule Mobilizon.Actors.Actor do
|
||||||
@spec build_anonymous_actor_creation_attrs :: Ecto.Changeset.t()
|
@spec build_anonymous_actor_creation_attrs :: Ecto.Changeset.t()
|
||||||
def build_anonymous_actor_creation_attrs do
|
def build_anonymous_actor_creation_attrs do
|
||||||
data = %{
|
data = %{
|
||||||
"name" => "Mobilizon Anonymous Actor",
|
name: "Mobilizon Anonymous Actor",
|
||||||
"summary" => "A fake person for anonymous participations",
|
summary: "A fake person for anonymous participations",
|
||||||
"keys" => Crypto.generate_rsa_2048_private_key(),
|
keys: Crypto.generate_rsa_2048_private_key(),
|
||||||
"preferred_username" => "anonymous",
|
preferred_username: "anonymous",
|
||||||
"domain" => nil,
|
domain: nil,
|
||||||
"type" => :Person
|
type: :Person,
|
||||||
|
manually_approves_followers: true
|
||||||
}
|
}
|
||||||
|
|
||||||
%__MODULE__{}
|
%__MODULE__{}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
defmodule Mobilizon.Storage.Repo.Migrations.RepairRelayAndAnonymousActors do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def up do
|
||||||
|
Ecto.Adapters.SQL.query!(
|
||||||
|
Mobilizon.Storage.Repo,
|
||||||
|
"UPDATE actors SET manually_approves_followers = true WHERE preferred_username = 'relay' and domain is null"
|
||||||
|
)
|
||||||
|
|
||||||
|
Ecto.Adapters.SQL.query!(
|
||||||
|
Mobilizon.Storage.Repo,
|
||||||
|
"UPDATE actors SET manually_approves_followers = true WHERE preferred_username = 'anonymous' and domain is null"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue