Allow to disable event creation

And change the group toggle

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-09-02 15:08:47 +02:00
parent 93bb34d037
commit 69faeec14c
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
8 changed files with 20 additions and 10 deletions

View File

@ -22,8 +22,6 @@ config :mobilizon, :instance,
repository: Mix.Project.config()[:source_url], repository: Mix.Project.config()[:source_url],
allow_relay: true, allow_relay: true,
federating: true, federating: true,
# Groups are to be activated with Mobilizon 1.0.0
groups: false,
remote_limit: 100_000, remote_limit: 100_000,
upload_limit: 10_000_000, upload_limit: 10_000_000,
avatar_upload_limit: 2_000_000, avatar_upload_limit: 2_000_000,
@ -31,10 +29,10 @@ config :mobilizon, :instance,
email_from: "noreply@localhost", email_from: "noreply@localhost",
email_reply_to: "noreply@localhost" email_reply_to: "noreply@localhost"
config :mime, :types, %{ # Groups are to be activated with Mobilizon 1.0.0
"application/activity+json" => ["activity-json"], config :mobilizon, :groups, enabled: false
"application/jrd+json" => ["jrd-json"]
} config :mobilizon, :events, creation: true
# Configures the endpoint # Configures the endpoint
config :mobilizon, Mobilizon.Web.Endpoint, config :mobilizon, Mobilizon.Web.Endpoint,
@ -51,6 +49,11 @@ config :mobilizon, Mobilizon.Web.Endpoint,
cache_static_manifest: "priv/static/manifest.json", cache_static_manifest: "priv/static/manifest.json",
has_reverse_proxy: true has_reverse_proxy: true
config :mime, :types, %{
"application/activity+json" => ["activity-json"],
"application/jrd+json" => ["jrd-json"]
}
# Upload configuration # Upload configuration
config :mobilizon, Mobilizon.Web.Upload, config :mobilizon, Mobilizon.Web.Upload,
uploader: Mobilizon.Web.Upload.Uploader.Local, uploader: Mobilizon.Web.Upload.Uploader.Local,

View File

@ -18,7 +18,7 @@
v-if="config && config.features.groups" v-if="config && config.features.groups"
>{{ $t("My groups") }}</b-navbar-item >{{ $t("My groups") }}</b-navbar-item
> >
<b-navbar-item tag="span"> <b-navbar-item tag="span" v-if="config && config.features.eventCreation">
<b-button tag="router-link" :to="{ name: RouteName.CREATE_EVENT }" type="is-primary">{{ <b-button tag="router-link" :to="{ name: RouteName.CREATE_EVENT }" type="is-primary">{{
$t("Create") $t("Create")
}}</b-button> }}</b-button>

View File

@ -61,6 +61,7 @@ export const CONFIG = gql`
} }
features { features {
groups groups
eventCreation
} }
auth { auth {
ldap ldap

View File

@ -70,6 +70,7 @@ export interface IConfig {
resourceProviders: IProvider[]; resourceProviders: IProvider[];
timezones: string[]; timezones: string[];
features: { features: {
eventCreation: boolean;
groups: boolean; groups: boolean;
}; };
federating: boolean; federating: boolean;

View File

@ -120,7 +120,8 @@ defmodule Mobilizon.GraphQL.Resolvers.Config do
resource_providers: Config.instance_resource_providers(), resource_providers: Config.instance_resource_providers(),
timezones: Tzdata.zone_list(), timezones: Tzdata.zone_list(),
features: %{ features: %{
groups: Config.instance_group_feature_enabled?() groups: Config.instance_group_feature_enabled?(),
event_creation: Config.instance_event_creation_enabled?()
}, },
rules: Config.instance_rules(), rules: Config.instance_rules(),
version: Config.instance_version(), version: Config.instance_version(),

View File

@ -131,6 +131,7 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
object :features do object :features do
field(:groups, :boolean) field(:groups, :boolean)
field(:event_creation, :boolean)
end end
object :auth do object :auth do

View File

@ -227,7 +227,11 @@ defmodule Mobilizon.Config do
end end
end end
def instance_group_feature_enabled?, do: Application.get_env(:mobilizon, :instance)[:groups] def instance_group_feature_enabled?,
do: :mobilizon |> Application.get_env(:groups) |> Keyword.get(:enabled)
def instance_event_creation_enabled?,
do: :mobilizon |> Application.get_env(:events) |> Keyword.get(:creation)
def anonymous_actor_id, do: get_cached_value(:anonymous_actor_id) def anonymous_actor_id, do: get_cached_value(:anonymous_actor_id)
def relay_actor_id, do: get_cached_value(:relay_actor_id) def relay_actor_id, do: get_cached_value(:relay_actor_id)

View File

@ -7,7 +7,6 @@ defmodule Mobilizon.Web.PageController do
alias Mobilizon.Discussions.Comment alias Mobilizon.Discussions.Comment
alias Mobilizon.Events.Event alias Mobilizon.Events.Event
alias Mobilizon.Federation.ActivityPub alias Mobilizon.Federation.ActivityPub
alias Mobilizon.Posts.Post
alias Mobilizon.Tombstone alias Mobilizon.Tombstone
alias Mobilizon.Web.{ActivityPubController, Cache, PageController} alias Mobilizon.Web.{ActivityPubController, Cache, PageController}