Merge branch 'fixes' into 'master'

Upgrade deps and fixes

Closes #893

See merge request framasoft/mobilizon!1066
This commit is contained in:
Thomas Citharel
2021-09-29 18:56:54 +00:00
49 changed files with 1988 additions and 2878 deletions

View File

@@ -15,7 +15,7 @@
"@absinthe/socket": "^0.2.1",
"@absinthe/socket-apollo-link": "^0.2.1",
"@apollo/client": "^3.3.16",
"@mdi/font": "^5.0.45",
"@mdi/font": "^6.1.95",
"@tiptap/core": "^2.0.0-beta.41",
"@tiptap/extension-blockquote": "^2.0.0-beta.6",
"@tiptap/extension-bubble-menu": "^2.0.0-beta.9",
@@ -45,7 +45,7 @@
"lodash": "^4.17.11",
"ngeohash": "^0.6.3",
"p-debounce": "^4.0.0",
"phoenix": "^1.4.11",
"phoenix": "1.5",
"register-service-worker": "^1.7.2",
"tippy.js": "^6.2.3",
"unfetch": "^4.2.0",
@@ -61,49 +61,48 @@
"vuedraggable": "^2.24.3"
},
"devDependencies": {
"@types/jest": "^26.0.18",
"@types/jest": "^27.0.2",
"@types/leaflet": "^1.5.2",
"@types/leaflet.locatecontrol": "^0.60.7",
"@types/lodash": "^4.14.141",
"@types/ngeohash": "^0.6.2",
"@types/phoenix": "^1.5.2",
"@types/prosemirror-inputrules": "^1.0.2",
"@types/prosemirror-model": "^1.7.2",
"@types/prosemirror-state": "^1.2.4",
"@types/prosemirror-view": "^1.11.4",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@vue/cli-plugin-babel": "~5.0.0-beta.3",
"@vue/cli-plugin-e2e-cypress": "~5.0.0-beta.3",
"@vue/cli-plugin-eslint": "~5.0.0-beta.3",
"@vue/cli-plugin-pwa": "~5.0.0-beta.3",
"@vue/cli-plugin-router": "~5.0.0-beta.3",
"@vue/cli-plugin-typescript": "~5.0.0-beta.3",
"@vue/cli-plugin-unit-jest": "~5.0.0-beta.3",
"@vue/cli-service": "~5.0.0-beta.3",
"@vue/cli-plugin-babel": "~5.0.0-beta.4",
"@vue/cli-plugin-e2e-cypress": "~5.0.0-beta.4",
"@vue/cli-plugin-eslint": "~5.0.0-beta.4",
"@vue/cli-plugin-pwa": "~5.0.0-beta.4",
"@vue/cli-plugin-router": "~5.0.0-beta.4",
"@vue/cli-plugin-typescript": "~5.0.0-beta.4",
"@vue/cli-plugin-unit-jest": "~5.0.0-beta.4",
"@vue/cli-service": "~5.0.0-beta.4",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^7.0.0",
"@vue/test-utils": "^1.1.0",
"@vue/vue2-jest": "^27.0.0-alpha.2",
"cypress": "^8.3.0",
"eslint": "^7.20.0",
"eslint-plugin-cypress": "^2.10.3",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^7.6.0",
"flush-promises": "^1.0.2",
"jest": "^26.6.3",
"jest": "^27.1.0",
"jest-junit": "^12.0.0",
"mock-apollo-client": "^1.1.0",
"prettier": "^2.2.1",
"prettier-eslint": "^13.0.0",
"sass": "^1.34.1",
"sass-loader": "^12.0.0",
"ts-jest": "^26.5.3",
"typescript": "~4.1.5",
"ts-jest": "27",
"typescript": "~4.4.3",
"vue-i18n-extract": "^1.0.2",
"vue-jest": "^4.0.1",
"vue-template-compiler": "^2.6.11",
"webpack-cli": "^4.7.0"
},
"resolutions": {
"webpack": "5.44.0"
}
}

View File

@@ -209,12 +209,14 @@ export default class Followers extends Mixins(RelayMixin) {
});
await this.$apollo.queries.relayFollowers.refetch();
this.checkedRows = [];
} catch (e) {
Snackbar.open({
message: e.message,
type: "is-danger",
position: "is-bottom",
});
} catch (e: any) {
if (e.message) {
Snackbar.open({
message: e.message,
type: "is-danger",
position: "is-bottom",
});
}
}
}
@@ -228,12 +230,14 @@ export default class Followers extends Mixins(RelayMixin) {
});
await this.$apollo.queries.relayFollowers.refetch();
this.checkedRows = [];
} catch (e) {
Snackbar.open({
message: e.message,
type: "is-danger",
position: "is-bottom",
});
} catch (e: any) {
if (e.message) {
Snackbar.open({
message: e.message,
type: "is-danger",
position: "is-bottom",
});
}
}
}
@@ -250,7 +254,7 @@ export default class Followers extends Mixins(RelayMixin) {
limit: FOLLOWERS_PER_PAGE,
},
});
} catch (err) {
} catch (err: any) {
console.error(err);
}
}

View File

@@ -203,7 +203,7 @@ export default class Followings extends Mixins(RelayMixin) {
limit: FOLLOWINGS_PER_PAGE,
},
});
} catch (err) {
} catch (err: any) {
console.error(err);
}
}
@@ -254,12 +254,14 @@ export default class Followings extends Mixins(RelayMixin) {
},
});
this.newRelayAddress = "";
} catch (err) {
Snackbar.open({
message: err.message,
type: "is-danger",
position: "is-bottom",
});
} catch (err: any) {
if (err.message) {
Snackbar.open({
message: err.message,
type: "is-danger",
position: "is-bottom",
});
}
}
}
@@ -295,12 +297,14 @@ export default class Followings extends Mixins(RelayMixin) {
});
await this.$apollo.queries.relayFollowings.refetch();
this.checkedRows = [];
} catch (e) {
Snackbar.open({
message: e.message,
type: "is-danger",
position: "is-bottom",
});
} catch (e: any) {
if (e.message) {
Snackbar.open({
message: e.message,
type: "is-danger",
position: "is-bottom",
});
}
}
}
}

View File

@@ -322,12 +322,14 @@ export default class Comment extends Vue {
position: "is-bottom-right",
duration: 5000,
});
} catch (e) {
Snackbar.open({
message: e.message,
type: "is-danger",
position: "is-bottom",
});
} catch (e: any) {
if (e.message) {
Snackbar.open({
message: e.message,
type: "is-danger",
position: "is-bottom",
});
}
}
}
}
@@ -398,6 +400,7 @@ a.comment-link {
color: $white;
.reply-btn,
small,
span,
strong,
.icons button {
color: $white;

View File

@@ -12,7 +12,7 @@
>{{ $t("Comments are closed for everybody else.") }}</b-notification
>
<article class="media">
<figure class="media-left">
<figure class="media-left" v-if="newComment.actor">
<identity-picker-wrapper :inline="false" v-model="newComment.actor" />
</figure>
<div class="media-content">
@@ -213,7 +213,7 @@ export default class CommentTree extends Vue {
// and reset the new comment field
this.newComment = new CommentModel();
} catch (errors) {
} catch (errors: any) {
console.error(errors);
if (errors.graphQLErrors && errors.graphQLErrors.length > 0) {
const error = errors.graphQLErrors[0];
@@ -295,7 +295,7 @@ export default class CommentTree extends Vue {
},
});
// this.comments = this.comments.filter(commentItem => commentItem.id !== comment.id);
} catch (error) {
} catch (error: any) {
console.error(error);
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
this.$notifier.error(error.graphQLErrors[0].message);

View File

@@ -331,7 +331,7 @@ export default class EditorComponent extends Vue {
})
.run();
}
} catch (error) {
} catch (error: any) {
console.error(error);
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
this.$notifier.error(error.graphQLErrors[0].message);

View File

@@ -86,11 +86,13 @@
/></a>
<a
:href="telegramShareUrl"
class="telegram"
target="_blank"
rel="nofollow noopener"
title="Telegram"
><b-icon icon="telegram" size="is-large" type="is-primary"
/></a>
>
<telegram-logo />
</a>
<a
:href="linkedInShareUrl"
target="_blank"
@@ -126,11 +128,13 @@ import { EventStatus, EventVisibility } from "@/types/enums";
import { IEvent } from "../../types/event.model";
import DiasporaLogo from "../Share/DiasporaLogo.vue";
import MastodonLogo from "../Share/MastodonLogo.vue";
import TelegramLogo from "../Share/TelegramLogo.vue";
@Component({
components: {
DiasporaLogo,
MastodonLogo,
TelegramLogo,
},
})
export default class ShareEventModal extends Vue {
@@ -207,7 +211,8 @@ export default class ShareEventModal extends Vue {
</script>
<style lang="scss" scoped>
.diaspora,
.mastodon {
.mastodon,
.telegram {
::v-deep span svg {
width: 2.25rem;
}

View File

@@ -16,7 +16,7 @@
:data="filteredTags"
autocomplete
:allow-new="true"
:field="path"
:field="'title'"
icon="label"
maxlength="20"
maxtags="10"

View File

@@ -38,7 +38,7 @@ export default class Invitations extends Vue {
if (data) {
this.$emit("accept-invitation", data.acceptInvitation);
}
} catch (error) {
} catch (error: any) {
console.error(error);
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
this.$notifier.error(error.graphQLErrors[0].message);
@@ -60,7 +60,7 @@ export default class Invitations extends Vue {
if (data) {
this.$emit("reject-invitation", data.rejectInvitation);
}
} catch (error) {
} catch (error: any) {
console.error(error);
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
this.$notifier.error(error.graphQLErrors[0].message);

View File

@@ -83,11 +83,13 @@
/></a>
<a
:href="telegramShareUrl"
class="telegram"
target="_blank"
rel="nofollow noopener"
title="Telegram"
><b-icon icon="telegram" size="is-large" type="is-primary"
/></a>
>
<telegram-logo />
</a>
<a
title="Diaspora"
:href="diasporaShareUrl"
@@ -115,12 +117,14 @@ import { Component, Prop, Vue, Ref } from "vue-property-decorator";
import { GroupVisibility } from "@/types/enums";
import DiasporaLogo from "../Share/DiasporaLogo.vue";
import MastodonLogo from "../Share/MastodonLogo.vue";
import TelegramLogo from "../Share/MastodonLogo.vue";
import { displayName, IGroup } from "@/types/actor";
@Component({
components: {
DiasporaLogo,
MastodonLogo,
TelegramLogo,
},
})
export default class ShareGroupModal extends Vue {
@@ -194,7 +198,8 @@ export default class ShareGroupModal extends Vue {
</script>
<style lang="scss" scoped>
.diaspora,
.mastodon {
.mastodon,
.telegram {
::v-deep span svg {
width: 2.25rem;
}

View File

@@ -249,7 +249,7 @@ export default class ParticipationWithoutAccount extends Vue {
data.joinEvent.metadata.cancellationToken
);
}
} catch (e) {
} catch (e: any) {
if (
["TextEncoder is not defined", "crypto.subtle is undefined"].includes(
e.message

View File

@@ -110,7 +110,7 @@ export default class FolderItem extends Mixins(ResourceMixin) {
return undefined;
}
return data.updateResource;
} catch (e) {
} catch (e: any) {
Snackbar.open({
message: e.message,
type: "is-danger",

View File

@@ -60,7 +60,7 @@ export default class NotificationsOnboarding extends mixins(Onboarding) {
async updateSetting(variables: Record<string, unknown>): Promise<void> {
try {
this.doUpdateSetting(variables);
} catch (e) {
} catch (e: any) {
Snackbar.open({
message: e.message,
type: "is-danger",

View File

@@ -0,0 +1,16 @@
<template>
<span class="icon has-text-primary is-large">
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<title>Telegram</title>
<path
d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"
/>
</svg>
</span>
</template>
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
@Component
export default class TelegramLogo extends Vue {}
</script>

View File

@@ -55,7 +55,7 @@ export default class Todo extends Vue {
},
});
this.editMode = false;
} catch (e) {
} catch (e: any) {
Snackbar.open({
message: e.message,
type: "is-danger",

View File

@@ -91,7 +91,7 @@ export default class Todo extends Vue {
},
});
this.editMode = false;
} catch (e) {
} catch (e: any) {
Snackbar.open({
message: e.message,
type: "is-danger",

View File

@@ -101,7 +101,7 @@ export default class EventMixin extends mixins(Vue) {
if (resultData) {
this.participationCancelledMessage();
}
} catch (error) {
} catch (error: any) {
Snackbar.open({
message: error.message,
type: "is-danger",
@@ -183,7 +183,7 @@ export default class EventMixin extends mixins(Vue) {
position: "is-bottom-right",
duration: 5000,
});
} catch (error) {
} catch (error: any) {
Snackbar.open({
message: error.message,
type: "is-danger",

View File

@@ -2,6 +2,4 @@ declare module "@absinthe/socket";
declare module "@absinthe/socket-apollo-link";
declare module "phoenix";
declare module "apollo-absinthe-upload-link";

View File

@@ -9,7 +9,9 @@
class="list-item"
v-for="identity in identities"
:key="identity.id"
:class="{ 'is-active': identity.id === currentIdentity.id }"
:class="{
'is-active': currentIdentity && identity.id === currentIdentity.id,
}"
@click="changeCurrentIdentity(identity)"
>
<div class="media">

View File

@@ -1,7 +1,7 @@
<template>
<div class="identity-picker">
<div
v-if="inline"
v-if="inline && currentIdentity"
class="inline box"
:class="{
'has-background-grey-lighter': masked,
@@ -39,14 +39,14 @@
</b-button>
</div>
</div>
<span v-else class="block" @click="activateModal">
<span v-else-if="currentIdentity" class="block" @click="activateModal">
<figure class="image is-48x48" v-if="currentIdentity.avatar">
<img class="is-rounded" :src="currentIdentity.avatar.url" alt="" />
</figure>
<b-icon v-else size="is-large" icon="account-circle" />
</span>
<b-modal v-model="isComponentModalActive" has-modal-card>
<identity-picker v-model="currentIdentity" @input="relay" />
<identity-picker v-model="currentIdentity" />
</b-modal>
</div>
</template>
@@ -69,21 +69,22 @@ export default class IdentityPickerWrapper extends Vue {
@Prop({ default: true, type: Boolean }) inline!: boolean;
@Prop({ type: Boolean, required: false, default: false }) masked = false;
@Prop({ type: Boolean, required: false, default: false }) masked!: boolean;
isComponentModalActive = false;
identities: IActor[] = [];
currentIdentity: IActor = this.value;
@Watch("value")
updateCurrentActor(value: IActor): void {
this.currentIdentity = value;
}
relay(identity: IActor): void {
this.currentIdentity = identity;
get currentIdentity(): IActor | undefined {
return this.value;
}
set currentIdentity(identity: IActor | undefined) {
this.$emit("input", identity);
this.isComponentModalActive = false;
}

View File

@@ -210,7 +210,7 @@ export default class Register extends mixins(identityEditionMixin) {
await this.$router.push({ name: RouteName.HOME });
}
}
} catch (errorCatched) {
} catch (errorCatched: any) {
this.errors = errorCatched.graphQLErrors.reduce(
(acc: { [key: string]: string }, error: any) => {
acc[error.details || error.field] = error.message;

View File

@@ -14,10 +14,10 @@
</li>
</ul>
</nav>
<section v-if="adminSettings">
<section v-if="settingsToWrite">
<form @submit.prevent="updateSettings">
<b-field :label="$t('Instance Name')" label-for="instance-name">
<b-input v-model="adminSettings.instanceName" id="instance-name" />
<b-input v-model="settingsToWrite.instanceName" id="instance-name" />
</b-field>
<div class="field">
<label class="label has-help" for="instance-description">{{
@@ -32,9 +32,9 @@
</small>
<b-input
type="textarea"
v-model="adminSettings.instanceDescription"
v-model="settingsToWrite.instanceDescription"
rows="2"
id="instance-name"
id="instance-description"
/>
</div>
<div class="field">
@@ -49,7 +49,7 @@
}}
</small>
<b-input
v-model="adminSettings.instanceSlogan"
v-model="settingsToWrite.instanceSlogan"
:placeholder="$t('Gather ⋅ Organize ⋅ Mobilize')"
id="instance-slogan"
/>
@@ -61,11 +61,11 @@
<small>
{{ $t("Can be an email or a link, or just plain text.") }}
</small>
<b-input v-model="adminSettings.contact" id="instance-contact" />
<b-input v-model="settingsToWrite.contact" id="instance-contact" />
</div>
<b-field :label="$t('Allow registrations')">
<b-switch v-model="adminSettings.registrationsOpen">
<p class="content" v-if="adminSettings.registrationsOpen">
<b-switch v-model="settingsToWrite.registrationsOpen">
<p class="content" v-if="settingsToWrite.registrationsOpen">
{{ $t("Registration is allowed, anyone can register.") }}
</p>
<p class="content" v-else>{{ $t("Registration is closed.") }}</p>
@@ -105,7 +105,7 @@
</small>
<b-input
type="textarea"
v-model="adminSettings.instanceLongDescription"
v-model="settingsToWrite.instanceLongDescription"
rows="4"
id="instance-long-description"
/>
@@ -123,7 +123,7 @@
</small>
<b-input
type="textarea"
v-model="adminSettings.instanceRules"
v-model="settingsToWrite.instanceRules"
id="instance-rules"
/>
</div>
@@ -136,7 +136,7 @@
</legend>
<b-field>
<b-radio
v-model="adminSettings.instanceTermsType"
v-model="settingsToWrite.instanceTermsType"
name="instanceTermsType"
:native-value="InstanceTermsType.DEFAULT"
>{{ $t("Default Mobilizon terms") }}</b-radio
@@ -144,7 +144,7 @@
</b-field>
<b-field>
<b-radio
v-model="adminSettings.instanceTermsType"
v-model="settingsToWrite.instanceTermsType"
name="instanceTermsType"
:native-value="InstanceTermsType.URL"
>{{ $t("Custom URL") }}</b-radio
@@ -152,7 +152,7 @@
</b-field>
<b-field>
<b-radio
v-model="adminSettings.instanceTermsType"
v-model="settingsToWrite.instanceTermsType"
name="instanceTermsType"
:native-value="InstanceTermsType.CUSTOM"
>{{ $t("Custom text") }}</b-radio
@@ -164,7 +164,8 @@
<div
class="notification"
v-if="
adminSettings.instanceTermsType === InstanceTermsType.DEFAULT
settingsToWrite.instanceTermsType ===
InstanceTermsType.DEFAULT
"
>
<b>{{ $t("Default") }}</b>
@@ -189,7 +190,9 @@
</div>
<div
class="notification"
v-if="adminSettings.instanceTermsType === InstanceTermsType.URL"
v-if="
settingsToWrite.instanceTermsType === InstanceTermsType.URL
"
>
<b>{{ $t("URL") }}</b>
<p class="content">
@@ -199,7 +202,7 @@
<div
class="notification"
v-if="
adminSettings.instanceTermsType === InstanceTermsType.CUSTOM
settingsToWrite.instanceTermsType === InstanceTermsType.CUSTOM
"
>
<b>{{ $t("Custom") }}</b>
@@ -223,15 +226,25 @@
</b-field>
<b-field
:label="$t('Instance Terms URL')"
v-if="adminSettings.instanceTermsType === InstanceTermsType.URL"
label-for="instanceTermsUrl"
v-if="settingsToWrite.instanceTermsType === InstanceTermsType.URL"
>
<b-input type="URL" v-model="adminSettings.instanceTermsUrl" />
<b-input
type="URL"
v-model="settingsToWrite.instanceTermsUrl"
id="instanceTermsUrl"
/>
</b-field>
<b-field
:label="$t('Instance Terms')"
v-if="adminSettings.instanceTermsType === InstanceTermsType.CUSTOM"
label-for="instanceTerms"
v-if="settingsToWrite.instanceTermsType === InstanceTermsType.CUSTOM"
>
<b-input type="textarea" v-model="adminSettings.instanceTerms" />
<b-input
type="textarea"
v-model="settingsToWrite.instanceTerms"
id="instanceTerms"
/>
</b-field>
<b-field :label="$t('Instance Privacy Policy Source')">
<div class="columns">
@@ -242,7 +255,7 @@
</legend>
<b-field>
<b-radio
v-model="adminSettings.instancePrivacyPolicyType"
v-model="settingsToWrite.instancePrivacyPolicyType"
name="instancePrivacyType"
:native-value="InstancePrivacyType.DEFAULT"
>{{ $t("Default Mobilizon privacy policy") }}</b-radio
@@ -250,7 +263,7 @@
</b-field>
<b-field>
<b-radio
v-model="adminSettings.instancePrivacyPolicyType"
v-model="settingsToWrite.instancePrivacyPolicyType"
name="instancePrivacyType"
:native-value="InstancePrivacyType.URL"
>{{ $t("Custom URL") }}</b-radio
@@ -258,7 +271,7 @@
</b-field>
<b-field>
<b-radio
v-model="adminSettings.instancePrivacyPolicyType"
v-model="settingsToWrite.instancePrivacyPolicyType"
name="instancePrivacyType"
:native-value="InstancePrivacyType.CUSTOM"
>{{ $t("Custom text") }}</b-radio
@@ -270,7 +283,7 @@
<div
class="notification"
v-if="
adminSettings.instancePrivacyPolicyType ===
settingsToWrite.instancePrivacyPolicyType ===
InstancePrivacyType.DEFAULT
"
>
@@ -292,7 +305,7 @@
<div
class="notification"
v-if="
adminSettings.instancePrivacyPolicyType ===
settingsToWrite.instancePrivacyPolicyType ===
InstancePrivacyType.URL
"
>
@@ -304,7 +317,7 @@
<div
class="notification"
v-if="
adminSettings.instancePrivacyPolicyType ===
settingsToWrite.instancePrivacyPolicyType ===
InstancePrivacyType.CUSTOM
"
>
@@ -329,25 +342,30 @@
</b-field>
<b-field
:label="$t('Instance Privacy Policy URL')"
label-for="instancePrivacyPolicyUrl"
v-if="
adminSettings.instancePrivacyPolicyType === InstancePrivacyType.URL
settingsToWrite.instancePrivacyPolicyType ===
InstancePrivacyType.URL
"
>
<b-input
type="URL"
v-model="adminSettings.instancePrivacyPolicyUrl"
v-model="settingsToWrite.instancePrivacyPolicyUrl"
id="instancePrivacyPolicyUrl"
/>
</b-field>
<b-field
:label="$t('Instance Privacy Policy')"
label-for="instancePrivacyPolicy"
v-if="
adminSettings.instancePrivacyPolicyType ===
settingsToWrite.instancePrivacyPolicyType ===
InstancePrivacyType.CUSTOM
"
>
<b-input
type="textarea"
v-model="adminSettings.instancePrivacyPolicy"
v-model="settingsToWrite.instancePrivacyPolicy"
id="instancePrivacyPolicy"
/>
</b-field>
<b-button native-type="submit" type="is-primary">{{
@@ -358,7 +376,7 @@
</div>
</template>
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import { Component, Vue, Watch } from "vue-property-decorator";
import {
ADMIN_SETTINGS,
SAVE_ADMIN_SETTINGS,
@@ -380,7 +398,29 @@ import RouteName from "../../router/name";
},
})
export default class Settings extends Vue {
adminSettings!: IAdminSettings;
adminSettings: IAdminSettings = {
instanceName: "",
instanceDescription: "",
instanceSlogan: "",
instanceLongDescription: "",
contact: "",
instanceTerms: "",
instanceTermsType: InstanceTermsType.DEFAULT,
instanceTermsUrl: null,
instancePrivacyPolicy: "",
instancePrivacyPolicyType: InstanceTermsType.DEFAULT,
instancePrivacyPolicyUrl: null,
instanceRules: "",
registrationsOpen: false,
instanceLanguages: [],
};
settingsToWrite: IAdminSettings = { ...this.adminSettings };
@Watch("adminSettings")
updateSettingsToWrite(): void {
this.settingsToWrite = { ...this.adminSettings };
}
languages!: ILanguage[];
@@ -408,7 +448,7 @@ export default class Settings extends Vue {
}
async updateSettings(): Promise<void> {
const variables = { ...this.adminSettings };
const variables = { ...this.settingsToWrite };
try {
await this.$apollo.mutate({
mutation: SAVE_ADMIN_SETTINGS,

View File

@@ -133,7 +133,7 @@ export default class CreateDiscussion extends Vue {
slug: data.createDiscussion.slug,
},
});
} catch (error) {
} catch (error: any) {
console.error(error);
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
if (error.graphQLErrors[0].field == "title") {

View File

@@ -174,7 +174,7 @@ export default class CreateGroup extends mixins(IdentityEditionMixin) {
displayName: this.group.displayName(),
}) as string
);
} catch (err) {
} catch (err: any) {
this.handleError(err);
}
}

View File

@@ -704,7 +704,7 @@ export default class Group extends mixins(GroupMixin) {
},
],
});
} catch (error) {
} catch (error: any) {
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
this.$notifier.error(error.graphQLErrors[0].message);
}
@@ -754,7 +754,7 @@ export default class Group extends mixins(GroupMixin) {
this.$notifier.success(
this.$t("Group {groupTitle} reported", { groupTitle }) as string
);
} catch (error) {
} catch (error: any) {
console.error(error);
this.$notifier.error(
this.$t("Error while reporting group {groupTitle}", {

View File

@@ -246,7 +246,7 @@ export default class GroupFollowers extends mixins(GroupMixin) {
username: follower.actor.preferredUsername,
});
this.$notifier.success(message as string);
} catch (error) {
} catch (error: any) {
console.error(error);
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
this.$notifier.error(error.graphQLErrors[0].message);

View File

@@ -335,7 +335,7 @@ export default class GroupMembers extends mixins(GroupMixin) {
}) as string
);
this.newMemberUsername = "";
} catch (error) {
} catch (error: any) {
console.error(error);
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
this.inviteError = error.graphQLErrors[0].message;
@@ -402,7 +402,7 @@ export default class GroupMembers extends mixins(GroupMixin) {
group: this.group.name || usernameWithDomain(this.group),
}) as string
);
} catch (error) {
} catch (error: any) {
console.error(error);
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
this.$notifier.error(error.graphQLErrors[0].message);
@@ -458,7 +458,7 @@ export default class GroupMembers extends mixins(GroupMixin) {
successMessage = "The member role was updated to simple member";
}
this.$notifier.success(this.$t(successMessage) as string);
} catch (error) {
} catch (error: any) {
console.error(error);
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
this.$notifier.error(error.graphQLErrors[0].message);

View File

@@ -238,7 +238,7 @@ export default class GroupSettings extends mixins(GroupMixin) {
variables,
});
this.$notifier.success(this.$t("Group settings saved") as string);
} catch (err) {
} catch (err: any) {
this.handleError(err);
}
}

View File

@@ -156,7 +156,7 @@ export default class MyGroups extends Vue {
},
],
});
} catch (error) {
} catch (error: any) {
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
this.$notifier.error(error.graphQLErrors[0].message);
}

View File

@@ -323,7 +323,7 @@ export default class EditPost extends mixins(GroupMixin) {
params: { slug: data.createPost.slug },
});
}
} catch (error) {
} catch (error: any) {
console.error(error);
this.errors = error.graphQLErrors.reduce(
(acc: { [key: string]: any }, localError: any) => {
@@ -384,7 +384,7 @@ export default class EditPost extends mixins(GroupMixin) {
obj.picture = { mediaId: this.editablePost.picture.id };
}
}
} catch (e) {
} catch (e: any) {
console.error(e);
}
return obj;

View File

@@ -441,7 +441,7 @@ export default class Resources extends Mixins(ResourceMixin) {
this.newResource.title = "";
this.newResource.summary = "";
this.newResource.resourceUrl = "";
} catch (err) {
} catch (err: any) {
console.error(err);
this.modalError = err.graphQLErrors[0].message;
}
@@ -461,7 +461,7 @@ export default class Resources extends Mixins(ResourceMixin) {
this.newResource.summary = data.previewResourceLink.description;
this.newResource.metadata = data.previewResourceLink;
this.newResource.type = "link";
} catch (err) {
} catch (err: any) {
console.error(err);
this.modalError = err.graphQLErrors[0].message;
}
@@ -568,7 +568,7 @@ export default class Resources extends Mixins(ResourceMixin) {
(id) => id !== resourceID
);
delete this.checkedResources[resourceID];
} catch (e) {
} catch (e: any) {
console.error(e);
}
}
@@ -705,7 +705,7 @@ export default class Resources extends Mixins(ResourceMixin) {
console.log("Finished adding resource to new parent");
},
});
} catch (e) {
} catch (e: any) {
console.error(e);
}
}
@@ -740,7 +740,7 @@ export default class Resources extends Mixins(ResourceMixin) {
params: { path },
query: { ...this.$route.query, ...args },
});
} catch (e) {
} catch (e: any) {
if (isNavigationFailure(e, NavigationFailureType.redirected)) {
throw Error(e.toString());
}

View File

@@ -303,7 +303,7 @@ export default class AccountSettings extends Vue {
);
this.newEmail = "";
this.passwordForEmailChange = "";
} catch (err) {
} catch (err: any) {
this.handleErrors("email", err);
}
}
@@ -325,7 +325,7 @@ export default class AccountSettings extends Vue {
this.$notifier.success(
this.$t("The password was successfully changed") as string
);
} catch (err) {
} catch (err: any) {
this.handleErrors("password", err);
}
}
@@ -359,7 +359,7 @@ export default class AccountSettings extends Vue {
});
return await this.$router.push({ name: RouteName.HOME });
} catch (err) {
} catch (err: any) {
this.deletePasswordErrors = err.graphQLErrors.map(
({ message }: GraphQLError) => message
);

View File

@@ -233,7 +233,7 @@ export default class Login extends Vue {
}
this.$router.push({ name: RouteName.HOME });
return;
} catch (err) {
} catch (err: any) {
this.submitted = false;
if (err.graphQLErrors) {
err.graphQLErrors.forEach(({ message }: { message: string }) => {
@@ -257,7 +257,7 @@ export default class Login extends Vue {
});
try {
await initializeCurrentActor(this.$apollo.provider.defaultClient);
} catch (err) {
} catch (err: any) {
if (err instanceof NoIdentitiesException) {
await this.$router.push({
name: RouteName.REGISTER_PROFILE,

View File

@@ -95,7 +95,7 @@ export default class PasswordReset extends Vue {
saveUserData(data.resetPassword);
this.$router.push({ name: RouteName.HOME });
return;
} catch (err) {
} catch (err: any) {
err.graphQLErrors.forEach(({ message }: { message: any }) => {
this.errors.push(message);
});

View File

@@ -256,7 +256,7 @@ export default class Register extends Vue {
name: RouteName.REGISTER_PROFILE,
params: { email: this.credentials.email },
});
} catch (error) {
} catch (error: any) {
console.error(error);
this.errors = error.graphQLErrors.reduce(
(acc: string[], localError: any) => {

View File

@@ -117,13 +117,15 @@ export default class SendPasswordReset extends Vue {
});
this.validationSent = true;
} catch (err) {
} catch (err: any) {
console.error(err);
err.graphQLErrors.forEach(({ message }: { message: string }) => {
if (this.errors.indexOf(message) < 0) {
this.errors.push(message);
}
});
if (err.graphQLErrors) {
err.graphQLErrors.forEach(({ message }: { message: string }) => {
if (this.errors.indexOf(message) < 0) {
this.errors.push(message);
}
});
}
}
}

View File

@@ -12,14 +12,14 @@ import {
split,
} from "@apollo/client/core";
import { RetryLink } from "@apollo/client/link/retry";
import buildCurrentUserResolver from "@/apollo/user";
import { AUTH_ACCESS_TOKEN } from "@/constants";
import { logout } from "@/utils/auth";
import { Socket as PhoenixSocket } from "phoenix";
import * as AbsintheSocket from "@absinthe/socket";
import { createAbsintheSocketLink } from "@absinthe/socket-apollo-link";
import { getMainDefinition } from "@apollo/client/utilities";
import fetch from "unfetch";
import buildCurrentUserResolver from "@/apollo/user";
import { AUTH_ACCESS_TOKEN } from "@/constants";
import { logout } from "@/utils/auth";
import { GRAPHQL_API_ENDPOINT, GRAPHQL_API_FULL_PATH } from "./api/_entrypoint";
import {
possibleTypes,

File diff suppressed because it is too large Load Diff