Merge branch 'allow-disabling-event-creation' into 'master'

Allow to disable event creation

See merge request framasoft/mobilizon!560
This commit is contained in:
Thomas Citharel 2020-09-02 15:32:29 +02:00
commit 08f9ae4549
8 changed files with 20 additions and 10 deletions

View File

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

View File

@ -18,7 +18,7 @@
v-if="config && config.features.groups"
>{{ $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">{{
$t("Create")
}}</b-button>

View File

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

View File

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

View File

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

View File

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

View File

@ -227,7 +227,11 @@ defmodule Mobilizon.Config do
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 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.Events.Event
alias Mobilizon.Federation.ActivityPub
alias Mobilizon.Posts.Post
alias Mobilizon.Tombstone
alias Mobilizon.Web.{ActivityPubController, Cache, PageController}