Add toggle to disable groups

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-06-08 16:47:57 +02:00
parent 7767a6efc7
commit 7dbabcf15f
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
10 changed files with 29 additions and 8 deletions

View File

@ -21,8 +21,9 @@ config :mobilizon, :instance,
demo: false,
repository: Mix.Project.config()[:source_url],
allow_relay: true,
# Federation is to be activated with Mobilizon 1.0.0-beta.2
federating: true,
# Groups are to be activated with Mobilizon 1.0.0
groups: false,
remote_limit: 100_000,
upload_limit: 10_000_000,
avatar_upload_limit: 2_000_000,

View File

@ -87,7 +87,8 @@ config :mobilizon, :instance,
hostname: System.get_env("MOBILIZON_INSTANCE_HOST", "Mobilizon"),
email_from: System.get_env("MOBILIZON_INSTANCE_EMAIL"),
email_reply_to: System.get_env("MOBILIZON_INSTANCE_EMAIL"),
registrations_open: System.get_env("MOBILIZON_INSTANCE_REGISTRATIONS_OPEN") == "true"
registrations_open: System.get_env("MOBILIZON_INSTANCE_REGISTRATIONS_OPEN") == "true",
groups: true
# config :mobilizon, :activitypub, sign_object_fetches: false

View File

@ -12,9 +12,12 @@
<b-navbar-item tag="router-link" :to="{ name: RouteName.MY_EVENTS }">{{
$t("My events")
}}</b-navbar-item>
<b-navbar-item tag="router-link" :to="{ name: RouteName.MY_GROUPS }">{{
$t("My groups")
}}</b-navbar-item>
<b-navbar-item
tag="router-link"
:to="{ name: RouteName.MY_GROUPS }"
v-if="config && config.features.groups"
>{{ $t("My groups") }}</b-navbar-item
>
<b-navbar-item tag="span">
<b-button tag="router-link" :to="{ name: RouteName.CREATE_EVENT }" type="is-success">{{
$t("Create")

View File

@ -56,6 +56,9 @@ export const CONFIG = gql`
endpoint
software
}
features {
groups
}
}
}
`;

View File

@ -58,4 +58,7 @@ export interface IConfig {
};
resourceProviders: IProvider[];
timezones: string[];
features: {
groups: boolean;
};
}

View File

@ -51,7 +51,7 @@
/>
</b-field>
</div>
<div class="column">
<div class="column" v-if="config && config.features.groups">
<b-field :label="$t('Group')" v-if="event.organizerActor">
<group-picker-wrapper v-model="event.attributedTo" :identity="event.organizerActor" />
</b-field>

View File

@ -12,7 +12,7 @@
}}</b-radio-button>
</b-field>
<ul v-if="reports.length > 0">
<li v-for="report in reports">
<li v-for="report in reports" :key="report.id">
<router-link :to="{ name: RouteName.REPORT, params: { reportId: report.id } }">
<report-card :report="report" />
</router-link>

View File

@ -102,7 +102,10 @@ defmodule Mobilizon.GraphQL.Resolvers.Config do
}
},
resource_providers: Config.instance_resource_providers(),
timezones: Tzdata.zone_list()
timezones: Tzdata.zone_list(),
features: %{
groups: Config.instance_group_feature_enabled?()
}
}
end
end

View File

@ -22,6 +22,7 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
field(:anonymous, :anonymous)
field(:resource_providers, list_of(:resource_provider))
field(:timezones, list_of(:string))
field(:features, :features)
field(:terms, :terms, description: "The instance's terms") do
arg(:locale, :string, default_value: "en")
@ -105,6 +106,10 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
field(:software, :string)
end
object :features do
field(:groups, :boolean)
end
object :config_queries do
@desc "Get the instance config"
field :config, :config do

View File

@ -162,6 +162,8 @@ defmodule Mobilizon.Config do
end
end
def instance_group_feature_enabled?, do: Application.get_env(:mobilizon, :instance)[:groups]
def anonymous_actor_id, do: get_cached_value(:anonymous_actor_id)
def relay_actor_id, do: get_cached_value(:relay_actor_id)