From 0820866bb848db6b6cd227579e2bf780e3aa6f72 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 8 Oct 2019 20:00:26 +0200 Subject: [PATCH] fix lint issues and errors Signed-off-by: Thomas Citharel --- js/src/components/NavBar.vue | 1 + js/src/views/Account/children/EditIdentity.vue | 13 +++++++------ js/src/views/Home.vue | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/js/src/components/NavBar.vue b/js/src/components/NavBar.vue index ef22d4b1..6632a990 100644 --- a/js/src/components/NavBar.vue +++ b/js/src/components/NavBar.vue @@ -82,6 +82,7 @@ import { ICurrentUser, ICurrentUserRole } from '@/types/current-user.model'; import Logo from '@/components/Logo.vue'; import SearchField from '@/components/SearchField.vue'; import { RouteName } from '@/router'; +import { GraphQLError } from 'graphql'; @Component({ apollo: { diff --git a/js/src/views/Account/children/EditIdentity.vue b/js/src/views/Account/children/EditIdentity.vue index aa46a392..7233b92e 100644 --- a/js/src/views/Account/children/EditIdentity.vue +++ b/js/src/views/Account/children/EditIdentity.vue @@ -310,17 +310,18 @@ export default class EditIdentity extends Vue { } private async buildVariables() { - const oldAvatarFile = await buildFileFromIPicture(this.identity.avatar); - const oldAvatarFileContent = await readFileAsync(oldAvatarFile); - const newAvatarFileContent = await readFileAsync(this.avatarFile); - const avatarObj = buildFileVariable(this.avatarFile, 'avatar', `${this.identity.preferredUsername}'s avatar`); const res = Object.assign({}, this.identity, avatarObj); /** * If the avatar didn't change, no need to try reuploading it */ - if (oldAvatarFileContent === newAvatarFileContent) { - res.avatar = {}; + if (this.identity.avatar) { + const oldAvatarFile = await buildFileFromIPicture(this.identity.avatar) as File; + const oldAvatarFileContent = await readFileAsync(oldAvatarFile); + const newAvatarFileContent = await readFileAsync(this.avatarFile as File); + if (oldAvatarFileContent === newAvatarFileContent) { + res.avatar = null; + } } return res; } diff --git a/js/src/views/Home.vue b/js/src/views/Home.vue index c41ebf0e..a5c98a1f 100644 --- a/js/src/views/Home.vue +++ b/js/src/views/Home.vue @@ -152,7 +152,7 @@ import { IConfig } from '@/types/config.model'; }, }) export default class Home extends Vue { - events: Event[] = []; + events: IEvent[] = []; locations = []; city = { name: null }; country = { name: null }; @@ -225,8 +225,8 @@ export default class Home extends Vue { } get filteredFeaturedEvents() { - if (this.currentUser.isLoggedIn === false || !this.currentActor.id) return this.events; - return this.events.filter(event => event.organizerActor.id !== this.currentActor.id); + if (!this.currentUser.isLoggedIn || !this.currentActor.id) return this.events; + return this.events.filter(event => event.organizerActor && event.organizerActor.id !== this.currentActor.id); } geoLocalize() {