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 119cb5f71d
commit a53100ef6e
11 changed files with 21 additions and 4 deletions

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>
@@ -203,4 +203,4 @@ export default class Login extends Vue {
.container .columns {
margin: 1rem auto 3rem;
}
</style>
</style>