Merge branch 'fix-register-on-strings' into 'master'

Fix register sentense string

See merge request framasoft/mobilizon!712
This commit is contained in:
Thomas Citharel 2020-11-17 11:13:43 +01:00
commit 1970061a33
5 changed files with 26 additions and 7 deletions

View File

@ -277,7 +277,6 @@
"Published events with <b>{comments}</b> comments and <b>{participations}</b> confirmed participations": "Published events with <b>{comments}</b> comments and <b>{participations}</b> confirmed participations",
"RSS/Atom Feed": "RSS/Atom Feed",
"Region": "Region",
"Register an account on Mobilizon!": "Register an account on Mobilizon!",
"Registration is allowed, anyone can register.": "Registration is allowed, anyone can register.",
"Registration is closed.": "Registration is closed.",
"Registration is currently closed.": "Registration is currently closed.",

View File

@ -563,7 +563,6 @@
"Refresh profile": "Rafraîchir le profil",
"Region": "Région",
"Register": "S'inscrire",
"Register an account on Mobilizon!": "S'inscrire sur Mobilizon !",
"Register an account on {instanceName}!": "S'inscrire sur {instanceName} !",
"Register for an event by choosing one of your identities": "S'inscrire à un évènement en choisissant une de vos identités",
"Register on this instance": "S'inscrire sur cette instance",

View File

@ -8,7 +8,7 @@ export default class IdentityEditionMixin extends Mixins(Vue) {
oldDisplayName: string | null = null;
autoUpdateUsername(newDisplayName: string | null) {
autoUpdateUsername(newDisplayName: string | null): void {
const oldUsername = IdentityEditionMixin.convertToUsername(this.oldDisplayName);
if (this.identity.preferredUsername === oldUsername) {
@ -30,7 +30,7 @@ export default class IdentityEditionMixin extends Mixins(Vue) {
.replace(/[^a-z0-9_]/g, "");
}
validateUsername() {
validateUsername(): boolean {
return (
this.identity.preferredUsername ===
IdentityEditionMixin.convertToUsername(this.identity.preferredUsername)

View File

@ -5,7 +5,9 @@
<h1 class="title" v-if="userAlreadyActivated">
{{ $t("Congratulations, your account is now created!") }}
</h1>
<h1 class="title" v-else>{{ $t("Register an account on Mobilizon!") }}</h1>
<h1 class="title" v-else>
{{ $t("Register an account on {instanceName}!", { instanceName: config.name }) }}
</h1>
<p class="content" v-if="userAlreadyActivated">
{{ $t("Now, create your first profile:") }}
</p>
@ -92,6 +94,8 @@
<script lang="ts">
import { Component, Prop } from "vue-property-decorator";
import { mixins } from "vue-class-component";
import { CONFIG } from "@/graphql/config";
import { IConfig } from "@/types/config.model";
import { IPerson } from "../../types/actor";
import { IDENTITIES, REGISTER_PERSON } from "../../graphql/actor";
import { MOBILIZON_INSTANCE_HOST } from "../../api/_entrypoint";
@ -99,13 +103,19 @@ import RouteName from "../../router/name";
import { changeIdentity } from "../../utils/auth";
import identityEditionMixin from "../../mixins/identityEdition";
@Component
@Component({
apollo: {
config: CONFIG,
},
})
export default class Register extends mixins(identityEditionMixin) {
@Prop({ type: String, required: true }) email!: string;
@Prop({ type: Boolean, required: false, default: false })
userAlreadyActivated!: boolean;
config!: IConfig;
host?: string = MOBILIZON_INSTANCE_HOST;
errors: Record<string, unknown> = {};

View File

@ -156,7 +156,9 @@ import AuthProviders from "../../components/User/AuthProviders.vue";
metaInfo() {
return {
// if no subcomponents specify a metaInfo.title, this title will be used
title: this.$t("Register an account on Mobilizon!") as string,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
title: this.title,
// all titles will be injected into this template
titleTemplate: "%s | Mobilizon",
};
@ -184,6 +186,15 @@ export default class Register extends Vue {
config!: IConfig;
get title(): string {
if (this.config) {
return this.$t("Register an account on {instanceName}!", {
instanceName: this.config.name,
}) as string;
}
return "";
}
async submit(): Promise<void> {
this.sendingForm = true;
this.credentials.locale = this.$i18n.locale;