refactor: rename externalUrls to externalLinks

This commit is contained in:
Massedil
2025-09-03 21:45:41 +02:00
parent 48ae930b64
commit 66f3956d14
11 changed files with 37 additions and 37 deletions

View File

@@ -88,7 +88,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Config do
get_in(Application.get_env(:web_push_encryption, :vapid_details), [:public_key])
%{
external_urls: Config.external_urls(),
external_links: Config.external_links(),
name: Config.instance_name(),
registrations_open: Config.instance_registrations_open?(),
registrations_moderation: Config.instance_registrations_moderation?(),

View File

@@ -160,19 +160,19 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
field(:instance_languages, list_of(:string), description: "The instance's languages")
field(:external_urls, list_of(:external_url),
field(:external_links, list_of(:external_link),
description: "List of URL that will be shown to users"
)
end
object :external_url do
object :external_link do
meta(:authorize, :all)
field(:label, non_null(:string), description: "A human-readable label for the external URL")
field(:url, non_null(:string), description: "The actual external URL")
field(:enabled, non_null(:boolean), description: "Whether the external URL is enabled")
field(:label, non_null(:string), description: "A human-readable label for the external link")
field(:url, non_null(:string), description: "The external link URL")
field(:enabled, non_null(:boolean), description: "Whether the link URL is enabled")
end
input_object :external_url_input do
input_object :external_link_input do
meta(:authorize, :administrator)
field(:label, non_null(:string))
field(:url, non_null(:string))
@@ -494,8 +494,8 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
arg(:instance_languages, list_of(:string), description: "The instance's languages")
arg(:external_urls, list_of(:external_url_input),
description: "Array of external URLs with label, status, and id"
arg(:external_links, list_of(:external_link_input),
description: "Array of external links with label, status, and id"
)
middleware(Rajska.QueryAuthorization, permit: :administrator)

View File

@@ -104,7 +104,7 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
field(:search, :search_settings, description: "The instance's search settings")
field(:external_urls, list_of(:external_url),
field(:external_links, list_of(:external_link),
description: "List of URL that will be shown to users"
)
end

View File

@@ -59,13 +59,13 @@ defmodule Mobilizon.Config do
instance_config()[:name]
)
@spec external_urls :: String.t()
def external_urls do
config_cached_value("instance", "external_urls", [])
|> Enum.map(&transform_external_url/1)
@spec external_links :: String.t()
def external_links do
config_cached_value("instance", "external_links", [])
|> Enum.map(&transform_external_link/1)
end
def transform_external_url(map) do
def transform_external_link(map) do
%{
enabled: Map.fetch!(map, "enabled"),
label: Map.fetch!(map, "label"),
@@ -490,7 +490,7 @@ defmodule Mobilizon.Config do
instance_privacy_policy_url: instance_privacy_url(),
instance_rules: instance_rules(),
instance_languages: instance_languages(),
external_urls: external_urls()
external_links: external_links()
}
end