From a32903194205eb7b3c1f6244fe4e6f48e67ab04d Mon Sep 17 00:00:00 2001 From: Finn Stutzenstein Date: Thu, 27 Aug 2020 10:14:59 +0200 Subject: [PATCH] Fixed errors in client --- .gitignore | 2 +- .../src/app/core/repositories/users/user-repository.service.ts | 3 +++ client/src/app/core/ui-services/load-font.service.ts | 3 +++ client/src/app/core/ui-services/voting.service.ts | 3 ++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 7f0c6c5d1..cf1a6e29b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,7 @@ Thumbs.db # Virtual Environment .virtualenv*/* -.venv/* +.venv server/.venv ## Compatibility diff --git a/client/src/app/core/repositories/users/user-repository.service.ts b/client/src/app/core/repositories/users/user-repository.service.ts index 0912b3455..6fdbdafb7 100644 --- a/client/src/app/core/repositories/users/user-repository.service.ts +++ b/client/src/app/core/repositories/users/user-repository.service.ts @@ -500,6 +500,9 @@ export class UserRepositoryService extends BaseRepository user.id).intersect(this.demoModeUserIds).length > 0) { this.preventInDemo(); diff --git a/client/src/app/core/ui-services/load-font.service.ts b/client/src/app/core/ui-services/load-font.service.ts index b25260844..8b1fa3037 100644 --- a/client/src/app/core/ui-services/load-font.service.ts +++ b/client/src/app/core/ui-services/load-font.service.ts @@ -68,6 +68,9 @@ export class LoadFontService { */ private setCustomProjectorFont(font: any, weight: number): void { const path = font.path ? font.path : font.default; + if (!path) { + return; + } const url = font.path ? `${this.urlPrefix}${path}` : path; const fontFace = new FontFace('customProjectorFont', `url(${url})`, { weight: weight }); fontFace diff --git a/client/src/app/core/ui-services/voting.service.ts b/client/src/app/core/ui-services/voting.service.ts index 9930af398..0af871c12 100644 --- a/client/src/app/core/ui-services/voting.service.ts +++ b/client/src/app/core/ui-services/voting.service.ts @@ -43,10 +43,11 @@ export class VotingService { * @returns null if no errors exist (= user can vote) or else a VotingError */ public getVotePermissionError(poll: ViewBasePoll): VotingError | void { - const user = this.operator.viewUser; if (this.operator.isAnonymous) { return VotingError.USER_IS_ANONYMOUS; } + + const user = this.operator.user; if (!poll.groups_id.intersect(user.groups_id).length) { return VotingError.USER_HAS_NO_PERMISSION; }