Improve Terms of Service

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-06-19 19:27:10 +02:00
parent 9cc5cb72b5
commit f5241954bd
56 changed files with 10908 additions and 3348 deletions

View File

@@ -75,9 +75,14 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
object :admin_settings do
field(:instance_name, :string)
field(:instance_description, :string)
field(:instance_long_description, :string)
field(:contact, :string)
field(:instance_terms, :string)
field(:instance_terms_type, :instance_terms_type)
field(:instance_terms_url, :string)
field(:instance_privacy_policy, :string)
field(:instance_privacy_policy_type, :instance_privacy_type)
field(:instance_privacy_policy_url, :string)
field(:instance_rules, :string)
field(:registrations_open, :boolean)
end
@@ -88,6 +93,12 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
value(:custom, as: "CUSTOM")
end
enum :instance_privacy_type do
value(:url, as: "URL")
value(:default, as: "DEFAULT")
value(:custom, as: "CUSTOM")
end
object :admin_queries do
@desc "Get the list of action logs"
field :action_logs, type: list_of(:action_log) do
@@ -151,9 +162,14 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
field :save_admin_settings, type: :admin_settings do
arg(:instance_name, :string)
arg(:instance_description, :string)
arg(:instance_long_description, :string)
arg(:contact, :string)
arg(:instance_terms, :string)
arg(:instance_terms_type, :instance_terms_type)
arg(:instance_terms_url, :string)
arg(:instance_privacy_policy, :string)
arg(:instance_privacy_policy_type, :instance_privacy_type)
arg(:instance_privacy_policy_url, :string)
arg(:instance_rules, :string)
arg(:registrations_open, :boolean)

View File

@@ -11,6 +11,8 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
# Instance name
field(:name, :string)
field(:description, :string)
field(:long_description, :string)
field(:contact, :string)
field(:registrations_open, :boolean)
field(:registrations_whitelist, :boolean)
@@ -23,12 +25,19 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
field(:resource_providers, list_of(:resource_provider))
field(:timezones, list_of(:string))
field(:features, :features)
field(:version, :string)
field(:federating, :boolean)
field(:terms, :terms, description: "The instance's terms") do
arg(:locale, :string, default_value: "en")
resolve(&Config.terms/3)
end
field(:privacy, :privacy, description: "The instance's privacy policy") do
arg(:locale, :string, default_value: "en")
resolve(&Config.privacy/3)
end
field(:rules, :string, description: "The instance's rules")
end
@@ -38,6 +47,12 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
field(:body_html, :string)
end
object :privacy do
field(:url, :string)
field(:type, :instance_privacy_type)
field(:body_html, :string)
end
object :lonlat do
field(:longitude, :float)
field(:latitude, :float)

View File

@@ -0,0 +1,23 @@
defmodule Mobilizon.GraphQL.Schema.StatisticsType do
@moduledoc """
Schema representation for Statistics
"""
use Absinthe.Schema.Notation
alias Mobilizon.GraphQL.Resolvers.Statistics
@desc "A statistics object"
object :statistics do
# Instance name
field(:number_of_users, :integer, description: "The number of local users")
field(:number_of_events, :integer, description: "The number of local events")
field(:number_of_comments, :integer, description: "The number of local comments")
end
object :statistics_queries do
@desc "Get the instance statistics"
field :statistics, :statistics do
resolve(&Statistics.get_statistics/3)
end
end
end