Merge branch 'add-toggle-to-disable-groups' into 'master'

Add toggle to disable groups

See merge request framasoft/mobilizon!447
This commit is contained in:
Thomas Citharel 2020-06-09 08:58:25 +02:00
commit 164dca8562
10 changed files with 29 additions and 8 deletions

View File

@ -21,8 +21,9 @@ config :mobilizon, :instance,
demo: false, demo: false,
repository: Mix.Project.config()[:source_url], repository: Mix.Project.config()[:source_url],
allow_relay: true, allow_relay: true,
# Federation is to be activated with Mobilizon 1.0.0-beta.2
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,

View File

@ -87,7 +87,8 @@ config :mobilizon, :instance,
hostname: System.get_env("MOBILIZON_INSTANCE_HOST", "Mobilizon"), hostname: System.get_env("MOBILIZON_INSTANCE_HOST", "Mobilizon"),
email_from: System.get_env("MOBILIZON_INSTANCE_EMAIL"), email_from: System.get_env("MOBILIZON_INSTANCE_EMAIL"),
email_reply_to: 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 # config :mobilizon, :activitypub, sign_object_fetches: false

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -102,7 +102,10 @@ 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: %{
groups: Config.instance_group_feature_enabled?()
}
} }
end end
end end

View File

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

View File

@ -162,6 +162,8 @@ defmodule Mobilizon.Config do
end end
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 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)