Fix terms with no settings

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-03-01 18:29:48 +01:00
parent 44c87abb15
commit 80bfd3db01
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
6 changed files with 17 additions and 15 deletions

View File

@ -115,7 +115,6 @@
<script lang="ts"> <script lang="ts">
import { CONTACT } from "@/graphql/config"; import { CONTACT } from "@/graphql/config";
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from "vue-property-decorator";
import InstanceContactLink from "@/components/About/InstanceContactLink.vue";
@Component({ @Component({
apollo: { apollo: {
@ -131,9 +130,6 @@ import InstanceContactLink from "@/components/About/InstanceContactLink.vue";
titleTemplate: "%s | Mobilizon", titleTemplate: "%s | Mobilizon",
}; };
}, },
components: {
InstanceContactLink,
},
}) })
export default class ErrorComponent extends Vue { export default class ErrorComponent extends Vue {
@Prop({ required: true, type: Error }) error!: Error; @Prop({ required: true, type: Error }) error!: Error;

View File

@ -955,5 +955,6 @@
"The group's physical address was changed.": "The group's physical address was changed.", "The group's physical address was changed.": "The group's physical address was changed.",
"The group's avatar was changed.": "The group's avatar was changed.", "The group's avatar was changed.": "The group's avatar was changed.",
"The group's banner was changed.": "The group's banner was changed.", "The group's banner was changed.": "The group's banner was changed.",
"The group's short description was changed.": "The group's short description was changed." "The group's short description was changed.": "The group's short description was changed.",
"No information": "No information"
} }

View File

@ -1049,5 +1049,6 @@
"{profile} updated the member {member}.": "{profile} a mis à jour le ou la membre {member}.", "{profile} updated the member {member}.": "{profile} a mis à jour le ou la membre {member}.",
"{title} ({count} todos)": "{title} ({count} todos)", "{title} ({count} todos)": "{title} ({count} todos)",
"{username} was invited to {group}": "{username} a été invité à {group}", "{username} was invited to {group}": "{username} a été invité à {group}",
"© The OpenStreetMap Contributors": "© Les Contributeur⋅ices OpenStreetMap" "© The OpenStreetMap Contributors": "© Les Contributeur⋅ices OpenStreetMap",
"No information": "Non renseigné"
} }

View File

@ -25,7 +25,11 @@
</div> </div>
<div class="column contact"> <div class="column contact">
<h4>{{ $t("Contact") }}</h4> <h4>{{ $t("Contact") }}</h4>
<instance-contact-link :contact="config.contact" /> <instance-contact-link
v-if="config && config.contact"
:contact="config.contact"
/>
<p v-else>{{ $t("No information") }}</p>
</div> </div>
</section> </section>
<hr /> <hr />

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="container section"> <div class="container section">
<h2 class="title">{{ $t("Privacy Policy") }}</h2> <h2 class="title">{{ $t("Privacy Policy") }}</h2>
<div class="content" v-html="config.privacy.bodyHtml" /> <div class="content" v-if="config" v-html="config.privacy.bodyHtml" />
</div> </div>
</template> </template>
@ -37,14 +37,14 @@ export default class Privacy extends Vue {
@Watch("config", { deep: true }) @Watch("config", { deep: true })
watchConfig(config: IConfig): void { watchConfig(config: IConfig): void {
if (config.privacy.type) { if (config?.privacy?.type) {
this.redirectToUrl(); this.redirectToUrl();
} }
} }
redirectToUrl(): void { redirectToUrl(): void {
if (this.config.privacy.type === InstancePrivacyType.URL) { if (this.config?.privacy?.type === InstancePrivacyType.URL) {
window.location.replace(this.config.privacy.url); window.location.replace(this.config?.privacy?.url);
} }
} }
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="container section"> <div class="container section">
<h2 class="title">{{ $t("Terms") }}</h2> <h2 class="title">{{ $t("Terms") }}</h2>
<div class="content" v-html="config.terms.bodyHtml" /> <div class="content" v-if="config" v-html="config.terms.bodyHtml" />
</div> </div>
</template> </template>
@ -37,14 +37,14 @@ export default class Terms extends Vue {
@Watch("config", { deep: true }) @Watch("config", { deep: true })
watchConfig(config: IConfig): void { watchConfig(config: IConfig): void {
if (config.terms.type) { if (config?.terms?.type) {
this.redirectToUrl(); this.redirectToUrl();
} }
} }
redirectToUrl(): void { redirectToUrl(): void {
if (this.config.terms.type === InstanceTermsType.URL) { if (this.config?.terms?.type === InstanceTermsType.URL) {
window.location.replace(this.config.terms.url); window.location.replace(this.config?.terms?.url);
} }
} }
} }