Fix lint issues

And disable eslint when building in prod mode

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-11-30 10:24:11 +01:00
parent da42522073
commit 2d541f2e32
161 changed files with 3869 additions and 1236 deletions

View File

@@ -3,7 +3,9 @@
<nav class="breadcrumb" aria-label="breadcrumbs">
<ul>
<li>
<router-link :to="{ name: RouteName.ACCOUNT_SETTINGS }">{{ $t("Account") }}</router-link>
<router-link :to="{ name: RouteName.ACCOUNT_SETTINGS }">{{
$t("Account")
}}</router-link>
</li>
<li class="is-active">
<router-link :to="{ name: RouteName.ACCOUNT_SETTINGS_GENERAL }">{{
@@ -26,9 +28,12 @@
</i18n>
<b-message v-if="!canChangeEmail" type="is-warning" :closable="false">
{{
$t("Your email address was automatically set based on your {provider} account.", {
provider: providerName(loggedUser.provider),
})
$t(
"Your email address was automatically set based on your {provider} account.",
{
provider: providerName(loggedUser.provider),
}
)
}}
</b-message>
<b-notification
@@ -40,9 +45,19 @@
v-for="error in changeEmailErrors"
>{{ error }}</b-notification
>
<form @submit.prevent="resetEmailAction" ref="emailForm" class="form" v-if="canChangeEmail">
<form
@submit.prevent="resetEmailAction"
ref="emailForm"
class="form"
v-if="canChangeEmail"
>
<b-field :label="$t('New email')">
<b-input aria-required="true" required type="email" v-model="newEmail" />
<b-input
aria-required="true"
required
type="email"
v-model="newEmail"
/>
</b-field>
<p class="help">{{ $t("You'll receive a confirmation email.") }}</p>
<b-field :label="$t('Password')">
@@ -67,9 +82,12 @@
</div>
<b-message v-if="!canChangePassword" type="is-warning" :closable="false">
{{
$t("You can't change your password because you are registered through {provider}.", {
provider: providerName(loggedUser.provider),
})
$t(
"You can't change your password because you are registered through {provider}.",
{
provider: providerName(loggedUser.provider),
}
)
}}
</b-message>
<b-notification
@@ -109,7 +127,9 @@
</b-field>
<button
class="button is-primary"
:disabled="!($refs.passwordForm && $refs.passwordForm.checkValidity())"
:disabled="
!($refs.passwordForm && $refs.passwordForm.checkValidity())
"
>
{{ $t("Change my password") }}
</button>
@@ -117,7 +137,9 @@
<div class="setting-title">
<h2>{{ $t("Delete account") }}</h2>
</div>
<p class="content">{{ $t("Deleting my account will delete all of my identities.") }}</p>
<p class="content">
{{ $t("Deleting my account will delete all of my identities.") }}
</p>
<b-button @click="openDeleteAccountModal" type="is-danger">
{{ $t("Delete my account") }}
</b-button>
@@ -132,8 +154,12 @@
<div class="hero-body has-text-centered">
<div class="container">
<div class="columns">
<div class="column is-one-third-desktop is-offset-one-third-desktop">
<h1 class="title">{{ $t("Deleting your Mobilizon account") }}</h1>
<div
class="column is-one-third-desktop is-offset-one-third-desktop"
>
<h1 class="title">
{{ $t("Deleting your Mobilizon account") }}
</h1>
<p class="content">
{{
$t(
@@ -141,10 +167,14 @@
)
}}
<br />
<b>{{ $t("There will be no way to recover your data.") }}</b>
<b>{{
$t("There will be no way to recover your data.")
}}</b>
</p>
<p class="content" v-if="hasUserGotAPassword">
{{ $t("Please enter your password to confirm this action.") }}
{{
$t("Please enter your password to confirm this action.")
}}
</p>
<form @submit.prevent="deleteAccount">
<b-field v-if="hasUserGotAPassword">
@@ -156,12 +186,19 @@
:placeholder="$t('Password')"
/>
</b-field>
<b-button native-type="submit" type="is-danger" size="is-large">
<b-button
native-type="submit"
type="is-danger"
size="is-large"
>
{{ $t("Delete everything") }}
</b-button>
</form>
<div class="cancel-button">
<b-button type="is-light" @click="isDeleteAccountModalActive = false">
<b-button
type="is-light"
@click="isDeleteAccountModalActive = false"
>
{{ $t("Cancel") }}
</b-button>
</div>
@@ -179,7 +216,12 @@
import { IAuthProvider } from "@/types/enums";
import { Component, Vue, Ref } from "vue-property-decorator";
import { Route } from "vue-router";
import { CHANGE_EMAIL, CHANGE_PASSWORD, DELETE_ACCOUNT, LOGGED_USER } from "../../graphql/user";
import {
CHANGE_EMAIL,
CHANGE_PASSWORD,
DELETE_ACCOUNT,
LOGGED_USER,
} from "../../graphql/user";
import RouteName from "../../router/name";
import { IUser } from "../../types/current-user.model";
import { logout, SELECTED_PROVIDERS } from "../../utils/auth";
@@ -248,7 +290,9 @@ export default class AccountSettings extends Vue {
},
});
this.$notifier.success(this.$t("The password was successfully changed") as string);
this.$notifier.success(
this.$t("The password was successfully changed") as string
);
} catch (err) {
this.handleErrors("password", err);
}
@@ -264,12 +308,16 @@ export default class AccountSettings extends Vue {
await this.$apollo.mutate({
mutation: DELETE_ACCOUNT,
variables: {
password: this.hasUserGotAPassword ? this.passwordForAccountDeletion : null,
password: this.hasUserGotAPassword
? this.passwordForAccountDeletion
: null,
},
});
await logout(this.$apollo.provider.defaultClient);
this.$buefy.notification.open({
message: this.$t("Your account has been successfully deleted") as string,
message: this.$t(
"Your account has been successfully deleted"
) as string,
type: "is-success",
position: "is-bottom-right",
duration: 5000,
@@ -300,7 +348,8 @@ export default class AccountSettings extends Vue {
get hasUserGotAPassword(): boolean {
return (
this.loggedUser &&
(this.loggedUser.provider == null || this.loggedUser.provider === IAuthProvider.LDAP)
(this.loggedUser.provider == null ||
this.loggedUser.provider === IAuthProvider.LDAP)
);
}

View File

@@ -3,7 +3,9 @@
<nav class="breadcrumb" aria-label="breadcrumbs">
<ul>
<li>
<router-link :to="{ name: RouteName.ACCOUNT_SETTINGS }">{{ $t("Account") }}</router-link>
<router-link :to="{ name: RouteName.ACCOUNT_SETTINGS }">{{
$t("Account")
}}</router-link>
</li>
<li class="is-active">
<router-link :to="{ name: RouteName.NOTIFICATIONS }">{{
@@ -27,11 +29,16 @@
{{ $t("Other notification options:") }}
</p>
<div class="field">
<b-checkbox v-model="notificationOnDay" @input="updateSetting({ notificationOnDay })">
<b-checkbox
v-model="notificationOnDay"
@input="updateSetting({ notificationOnDay })"
>
<strong>{{ $t("Notification on the day of the event") }}</strong>
<p>
{{
$t("We'll use your timezone settings to send a recap of the morning of the event.")
$t(
"We'll use your timezone settings to send a recap of the morning of the event."
)
}}
</p>
<div v-if="loggedUser.settings && loggedUser.settings.timezone">
@@ -40,18 +47,29 @@
timezone: loggedUser.settings.timezone,
})
}}</em>
<router-link class="change-timezone" :to="{ name: RouteName.PREFERENCES }">{{
$t("Change timezone")
}}</router-link>
<router-link
class="change-timezone"
:to="{ name: RouteName.PREFERENCES }"
>{{ $t("Change timezone") }}</router-link
>
</div>
<span v-else>{{ $t("You can pick your timezone into your preferences.") }}</span>
<span v-else>{{
$t("You can pick your timezone into your preferences.")
}}</span>
</b-checkbox>
</div>
<div class="field">
<b-checkbox v-model="notificationEachWeek" @input="updateSetting({ notificationEachWeek })">
<b-checkbox
v-model="notificationEachWeek"
@input="updateSetting({ notificationEachWeek })"
>
<strong>{{ $t("Recap every week") }}</strong>
<p>
{{ $t("You'll get a weekly recap every Monday for upcoming events, if you have any.") }}
{{
$t(
"You'll get a weekly recap every Monday for upcoming events, if you have any."
)
}}
</p>
</b-checkbox>
</div>
@@ -76,7 +94,9 @@
<h2>{{ $t("Organizer notifications") }}</h2>
</div>
<div class="field is-primary">
<strong>{{ $t("Notifications for manually approved participations to an event") }}</strong>
<strong>{{
$t("Notifications for manually approved participations to an event")
}}</strong>
<p>
{{
$t(
@@ -130,7 +150,9 @@ export default class Notifications extends Vue {
mounted(): void {
this.notificationPendingParticipationValues = {
[INotificationPendingEnum.NONE]: this.$t("Do not receive any mail"),
[INotificationPendingEnum.DIRECT]: this.$t("Receive one email per request"),
[INotificationPendingEnum.DIRECT]: this.$t(
"Receive one email per request"
),
[INotificationPendingEnum.ONE_HOUR]: this.$t("Hourly email summary"),
[INotificationPendingEnum.ONE_DAY]: this.$t("Daily email summary"),
};

View File

@@ -3,10 +3,14 @@
<nav class="breadcrumb" aria-label="breadcrumbs">
<ul>
<li>
<router-link :to="{ name: RouteName.ACCOUNT_SETTINGS }">{{ $t("Account") }}</router-link>
<router-link :to="{ name: RouteName.ACCOUNT_SETTINGS }">{{
$t("Account")
}}</router-link>
</li>
<li class="is-active">
<router-link :to="{ name: RouteName.PREFERENCES }">{{ $t("Preferences") }}</router-link>
<router-link :to="{ name: RouteName.PREFERENCES }">{{
$t("Preferences")
}}</router-link>
</li>
</ul>
</nav>
@@ -28,7 +32,11 @@
:loading="!config || !loggedUser"
v-model="selectedTimezone"
>
<optgroup :label="group" v-for="(groupTimezones, group) in timezones" :key="group">
<optgroup
:label="group"
v-for="(groupTimezones, group) in timezones"
:key="group"
>
<option
v-for="timezone in groupTimezones"
:value="`${group}/${timezone}`"
@@ -44,7 +52,9 @@
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
})
}}</em>
<b-message v-else type="is-danger">{{ $t("Unable to detect timezone.") }}</b-message>
<b-message v-else type="is-danger">{{
$t("Unable to detect timezone.")
}}</b-message>
</div>
</div>
</template>
@@ -52,7 +62,11 @@
import { Component, Vue, Watch } from "vue-property-decorator";
import { saveLocaleData } from "@/utils/auth";
import { TIMEZONES } from "../../graphql/config";
import { USER_SETTINGS, SET_USER_SETTINGS, UPDATE_USER_LOCALE } from "../../graphql/user";
import {
USER_SETTINGS,
SET_USER_SETTINGS,
UPDATE_USER_LOCALE,
} from "../../graphql/user";
import { IConfig } from "../../types/config.model";
import { IUser } from "../../types/current-user.model";
import langs from "../../i18n/langs.json";
@@ -93,28 +107,39 @@ export default class Preferences extends Vue {
// eslint-disable-next-line class-methods-use-this
sanitize(timezone: string): string {
return timezone.split("_").join(" ").replace("St ", "St. ").split("/").join(" - ");
return timezone
.split("_")
.join(" ")
.replace("St ", "St. ")
.split("/")
.join(" - ");
}
get timezones(): Record<string, string[]> {
if (!this.config || !this.config.timezones) return {};
return this.config.timezones.reduce((acc: { [key: string]: Array<string> }, val: string) => {
const components = val.split("/");
const [prefix, suffix] = [components.shift() as string, components.join("/")];
const pushOrCreate = (
acc2: { [key: string]: Array<string> },
prefix2: string,
suffix2: string
) => {
// eslint-disable-next-line no-param-reassign
(acc2[prefix2] = acc2[prefix2] || []).push(suffix2);
return acc2;
};
if (suffix) {
return pushOrCreate(acc, prefix, suffix);
}
return pushOrCreate(acc, this.$t("Other") as string, prefix);
}, {});
return this.config.timezones.reduce(
(acc: { [key: string]: Array<string> }, val: string) => {
const components = val.split("/");
const [prefix, suffix] = [
components.shift() as string,
components.join("/"),
];
const pushOrCreate = (
acc2: { [key: string]: Array<string> },
prefix2: string,
suffix2: string
) => {
// eslint-disable-next-line no-param-reassign
(acc2[prefix2] = acc2[prefix2] || []).push(suffix2);
return acc2;
};
if (suffix) {
return pushOrCreate(acc, prefix, suffix);
}
return pushOrCreate(acc, this.$t("Other") as string, prefix);
},
{}
);
}
@Watch("selectedTimezone")