Added a demo mode to show or hide instance warnings that data is deleted

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-11-21 16:07:43 +01:00
parent 662f2ac96d
commit 1abdbce7b6
11 changed files with 21 additions and 4 deletions

View File

@ -25,6 +25,7 @@ In order to move participant stats to the event table for existing events, you n
- Add a different welcome message when coming from registration
- Link to participation page from event page when you are an organizer
- Added a warning on login that everything is deleted regularily
- Added a demo mode to show or hide instance warnings that data is deleted
- Updated Occitan translations (Quentin)
- Updated French translations (Gavy, Zilverspar, ty kayn)
- Updated Swedish translations (Anton Strömkvist)

View File

@ -18,6 +18,7 @@ config :mobilizon, :instance,
version: "1.0.0-dev",
hostname: System.get_env("MOBILIZON_INSTANCE_HOST") || "localhost",
registrations_open: System.get_env("MOBILIZON_INSTANCE_REGISTRATIONS_OPEN") || false,
demo: System.get_env("MOBILIZON_INSTANCE_DEMO_MODE") || false,
repository: Mix.Project.config()[:source_url],
allow_relay: true,
# Federation is to be activated with Mobilizon 1.0.0-beta.2

View File

@ -1,7 +1,7 @@
<template>
<div id="mobilizon">
<NavBar />
<div class="container">
<div class="container" v-if="config && config.demoMode">
<b-message type="is-danger" :title="$t('Warning').toLocaleUpperCase()" closable aria-close-label="Close">
<p>{{ $t('This is a demonstration site to test the beta version of Mobilizon.') }}</p>
<p v-html="$t('<b>Please do not use it in any real way</b>: everything you create here (accounts, events, identities, etc.) will be automatically deleted every 48 hours.')" />
@ -35,11 +35,14 @@ import { CURRENT_USER_CLIENT, UPDATE_CURRENT_USER_CLIENT } from '@/graphql/user'
import Footer from '@/components/Footer.vue';
import Logo from '@/components/Logo.vue';
import { initializeCurrentActor } from '@/utils/auth';
import { CONFIG } from '@/graphql/config';
import { IConfig } from '@/types/config.model';
@Component({
apollo: {
currentUser: {
query: CURRENT_USER_CLIENT,
},
config: CONFIG,
},
components: {
Logo,
@ -48,6 +51,8 @@ import { initializeCurrentActor } from '@/utils/auth';
},
})
export default class App extends Vue {
config!: IConfig;
async created() {
if (await this.initializeCurrentUser()) {
await initializeCurrentActor(this.$apollo.provider.defaultClient);

View File

@ -6,6 +6,7 @@ query {
name,
description,
registrationsOpen,
demoMode,
countryCode,
location {
latitude,

View File

@ -3,6 +3,7 @@ export interface IConfig {
description: string;
registrationsOpen: boolean;
demoMode: boolean;
countryCode: string;
location: {
latitude: number;

View File

@ -24,7 +24,7 @@
{{ $t('No user account with this email was found. Maybe you made a typo?') }}
</span>
<!-- Warning that we delete everything every now and then -->
<span v-if="error === LoginError.USER_DOES_NOT_EXIST">
<span v-if="error === LoginError.USER_DOES_NOT_EXIST && config.demoMode">
{{ $t('User accounts and every other data is currently deleted every 48 hours, so you may want to register again.') }}
</span>
</b-message>

View File

@ -21,6 +21,9 @@ defmodule Mobilizon.Config do
@spec instance_registrations_open? :: boolean
def instance_registrations_open?, do: to_boolean(instance_config()[:registrations_open])
@spec instance_demo_mode? :: boolean
def instance_demo_mode?, do: to_boolean(instance_config()[:demo])
@spec instance_repository :: String.t()
def instance_repository, do: instance_config()[:repository]

View File

@ -30,6 +30,7 @@ defmodule MobilizonWeb.Resolvers.Config do
%{
name: Config.instance_name(),
registrations_open: Config.instance_registrations_open?(),
demo_mode: Config.instance_demo_mode?(),
description: Config.instance_description(),
location: location,
country_code: country_code,

View File

@ -13,6 +13,7 @@ defmodule MobilizonWeb.Schema.ConfigType do
field(:description, :string)
field(:registrations_open, :boolean)
field(:demo_mode, :boolean)
field(:country_code, :string)
field(:location, :lonlat)
field(:geocoding, :geocoding)

View File

@ -72,6 +72,7 @@
</td>
</tr>
<%= render @view_module, @view_template, assigns %>
<% if Mobilizon.Config.instance_demo_mode?() do %>
<!-- BETA WARNING -->
<tr>
<td bgcolor="#f4f4f4" align="center" style="padding: 30px 10px 0px 10px;">
@ -103,6 +104,7 @@
<![endif]-->
</td>
</tr>
<% end %>
<!-- SUPPORT CALLOUT -->
<tr>
<td bgcolor="#f4f4f4" align="center" style="padding: 30px 10px 0px 10px;">

View File

@ -1,5 +1,5 @@
# source: http://localhost:4000/api
# timestamp: Wed Nov 20 2019 10:45:54 GMT+0100 (Central European Standard Time)
# timestamp: Thu Nov 21 2019 15:58:08 GMT+0100 (Central European Standard Time)
schema {
query: RootQueryType
@ -190,6 +190,7 @@ enum CommentVisibility {
"""A config object"""
type Config {
countryCode: String
demoMode: Boolean
description: String
geocoding: Geocoding
location: Lonlat