Fixed errors in client

This commit is contained in:
Finn Stutzenstein 2020-08-27 10:14:59 +02:00
parent 0367398cb5
commit a329031942
No known key found for this signature in database
GPG Key ID: 9042F605C6324654
4 changed files with 9 additions and 2 deletions

2
.gitignore vendored
View File

@ -19,7 +19,7 @@
Thumbs.db Thumbs.db
# Virtual Environment # Virtual Environment
.virtualenv*/* .virtualenv*/*
.venv/* .venv
server/.venv server/.venv
## Compatibility ## Compatibility

View File

@ -500,6 +500,9 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User, UserTi
} }
private preventAlterationOnDemoUsers(users: ViewUser | ViewUser[]): void { private preventAlterationOnDemoUsers(users: ViewUser | ViewUser[]): void {
if (!this.demoModeUserIds) {
return;
}
if (Array.isArray(users)) { if (Array.isArray(users)) {
if (users.map(user => user.id).intersect(this.demoModeUserIds).length > 0) { if (users.map(user => user.id).intersect(this.demoModeUserIds).length > 0) {
this.preventInDemo(); this.preventInDemo();

View File

@ -68,6 +68,9 @@ export class LoadFontService {
*/ */
private setCustomProjectorFont(font: any, weight: number): void { private setCustomProjectorFont(font: any, weight: number): void {
const path = font.path ? font.path : font.default; const path = font.path ? font.path : font.default;
if (!path) {
return;
}
const url = font.path ? `${this.urlPrefix}${path}` : path; const url = font.path ? `${this.urlPrefix}${path}` : path;
const fontFace = new FontFace('customProjectorFont', `url(${url})`, { weight: weight }); const fontFace = new FontFace('customProjectorFont', `url(${url})`, { weight: weight });
fontFace fontFace

View File

@ -43,10 +43,11 @@ export class VotingService {
* @returns null if no errors exist (= user can vote) or else a VotingError * @returns null if no errors exist (= user can vote) or else a VotingError
*/ */
public getVotePermissionError(poll: ViewBasePoll): VotingError | void { public getVotePermissionError(poll: ViewBasePoll): VotingError | void {
const user = this.operator.viewUser;
if (this.operator.isAnonymous) { if (this.operator.isAnonymous) {
return VotingError.USER_IS_ANONYMOUS; return VotingError.USER_IS_ANONYMOUS;
} }
const user = this.operator.user;
if (!poll.groups_id.intersect(user.groups_id).length) { if (!poll.groups_id.intersect(user.groups_id).length) {
return VotingError.USER_HAS_NO_PERMISSION; return VotingError.USER_HAS_NO_PERMISSION;
} }