fix lint issues and errors

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-10-08 20:00:26 +02:00
parent 2749220832
commit 0820866bb8
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
3 changed files with 11 additions and 9 deletions

View File

@ -82,6 +82,7 @@ import { ICurrentUser, ICurrentUserRole } from '@/types/current-user.model';
import Logo from '@/components/Logo.vue'; import Logo from '@/components/Logo.vue';
import SearchField from '@/components/SearchField.vue'; import SearchField from '@/components/SearchField.vue';
import { RouteName } from '@/router'; import { RouteName } from '@/router';
import { GraphQLError } from 'graphql';
@Component({ @Component({
apollo: { apollo: {

View File

@ -310,17 +310,18 @@ export default class EditIdentity extends Vue {
} }
private async buildVariables() { 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 avatarObj = buildFileVariable(this.avatarFile, 'avatar', `${this.identity.preferredUsername}'s avatar`);
const res = Object.assign({}, this.identity, avatarObj); const res = Object.assign({}, this.identity, avatarObj);
/** /**
* If the avatar didn't change, no need to try reuploading it * If the avatar didn't change, no need to try reuploading it
*/ */
if (oldAvatarFileContent === newAvatarFileContent) { if (this.identity.avatar) {
res.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; return res;
} }

View File

@ -152,7 +152,7 @@ import { IConfig } from '@/types/config.model';
}, },
}) })
export default class Home extends Vue { export default class Home extends Vue {
events: Event[] = []; events: IEvent[] = [];
locations = []; locations = [];
city = { name: null }; city = { name: null };
country = { name: null }; country = { name: null };
@ -225,8 +225,8 @@ export default class Home extends Vue {
} }
get filteredFeaturedEvents() { get filteredFeaturedEvents() {
if (this.currentUser.isLoggedIn === false || !this.currentActor.id) return this.events; if (!this.currentUser.isLoggedIn || !this.currentActor.id) return this.events;
return this.events.filter(event => event.organizerActor.id !== this.currentActor.id); return this.events.filter(event => event.organizerActor && event.organizerActor.id !== this.currentActor.id);
} }
geoLocalize() { geoLocalize() {