Add fields limits to instance metadata, add tests
This commit is contained in:
parent
0883a706dc
commit
5a8e0208b1
|
@ -38,7 +38,8 @@ def render("show.json", _) do
|
||||||
metadata: %{
|
metadata: %{
|
||||||
account_activation_required: Keyword.get(instance, :account_activation_required),
|
account_activation_required: Keyword.get(instance, :account_activation_required),
|
||||||
features: features(),
|
features: features(),
|
||||||
federation: federation()
|
federation: federation(),
|
||||||
|
fields_limits: fields_limits()
|
||||||
},
|
},
|
||||||
vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
|
vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
|
||||||
}
|
}
|
||||||
|
@ -89,4 +90,13 @@ def federation do
|
||||||
end
|
end
|
||||||
|> Map.put(:enabled, Config.get([:instance, :federating]))
|
|> Map.put(:enabled, Config.get([:instance, :federating]))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def fields_limits do
|
||||||
|
%{
|
||||||
|
maxFields: Config.get([:instance, :max_account_fields]),
|
||||||
|
maxRemoteFields: Config.get([:instance, :max_remote_account_fields]),
|
||||||
|
nameLength: Config.get([:instance, :account_field_name_length]),
|
||||||
|
valueLength: Config.get([:instance, :account_field_value_length])
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,8 +35,10 @@ test "get instance information", %{conn: conn} do
|
||||||
"background_image" => _
|
"background_image" => _
|
||||||
} = result
|
} = result
|
||||||
|
|
||||||
|
assert result["pleroma"]["metadata"]["account_activation_required"] != nil
|
||||||
assert result["pleroma"]["metadata"]["features"]
|
assert result["pleroma"]["metadata"]["features"]
|
||||||
assert result["pleroma"]["metadata"]["federation"]
|
assert result["pleroma"]["metadata"]["federation"]
|
||||||
|
assert result["pleroma"]["metadata"]["fields_limits"]
|
||||||
assert result["pleroma"]["vapid_public_key"]
|
assert result["pleroma"]["vapid_public_key"]
|
||||||
|
|
||||||
assert email == from_config_email
|
assert email == from_config_email
|
||||||
|
|
Loading…
Reference in New Issue