fix(backend): validate length of instance actor details and set description column to text

Closes #1393

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2024-01-04 13:02:05 +01:00
parent eb43b7c79c
commit f7585cfc75
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
2 changed files with 19 additions and 0 deletions

View File

@ -34,6 +34,10 @@ defmodule Mobilizon.Instances.InstanceActor do
instance_actor
|> cast(attrs, @attrs)
|> validate_required(@required_attrs)
|> validate_length(:domain, max: 254)
|> validate_length(:instance_name, max: 254)
|> validate_length(:software, max: 254)
|> validate_length(:software_version, max: 254)
|> unique_constraint(:domain)
end
end

View File

@ -0,0 +1,15 @@
defmodule Mobilizon.Storage.Repo.Migrations.ChangeActorInstanceDescriptionTypeToText do
use Ecto.Migration
def up do
alter table(:instance_actors) do
modify(:instance_description, :text)
end
end
def down do
alter table(:instance_actors) do
modify(:instance_description, :string)
end
end
end