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()
|
||||
def build_relay_creation_attrs do
|
||||
data = %{
|
||||
"name" => Config.get([:instance, :name], "Mobilizon"),
|
||||
"summary" =>
|
||||
name: Config.get([:instance, :name], "Mobilizon"),
|
||||
summary:
|
||||
Config.get(
|
||||
[:instance, :description],
|
||||
"An internal service actor for this Mobilizon instance"
|
||||
),
|
||||
"keys" => Crypto.generate_rsa_2048_private_key(),
|
||||
"preferred_username" => "relay",
|
||||
"domain" => nil,
|
||||
"visibility" => :public,
|
||||
"type" => :Application
|
||||
keys: Crypto.generate_rsa_2048_private_key(),
|
||||
preferred_username: "relay",
|
||||
domain: nil,
|
||||
visibility: :public,
|
||||
type: :Application,
|
||||
manually_approves_followers: true
|
||||
}
|
||||
|
||||
%__MODULE__{}
|
||||
|
@ -440,12 +441,13 @@ defmodule Mobilizon.Actors.Actor do
|
|||
@spec build_anonymous_actor_creation_attrs :: Ecto.Changeset.t()
|
||||
def build_anonymous_actor_creation_attrs do
|
||||
data = %{
|
||||
"name" => "Mobilizon Anonymous Actor",
|
||||
"summary" => "A fake person for anonymous participations",
|
||||
"keys" => Crypto.generate_rsa_2048_private_key(),
|
||||
"preferred_username" => "anonymous",
|
||||
"domain" => nil,
|
||||
"type" => :Person
|
||||
name: "Mobilizon Anonymous Actor",
|
||||
summary: "A fake person for anonymous participations",
|
||||
keys: Crypto.generate_rsa_2048_private_key(),
|
||||
preferred_username: "anonymous",
|
||||
domain: nil,
|
||||
type: :Person,
|
||||
manually_approves_followers: true
|
||||
}
|
||||
|
||||
%__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