Adjust code style in user repo

Cleans up return statements in void functions
This commit is contained in:
Sean 2020-08-31 12:14:56 +02:00
parent 2759f8ce2b
commit 594777960b

View File

@ -500,20 +500,17 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User, UserTi
}
private preventAlterationOnDemoUsers(users: ViewUser | ViewUser[]): void {
if (!this.demoModeUserIds) {
return;
}
if (Array.isArray(users)) {
if (users.map(user => user.id).intersect(this.demoModeUserIds).length > 0) {
if (this.demoModeUserIds && users.map(user => user.id).intersect(this.demoModeUserIds).length > 0) {
this.preventInDemo();
}
} else if (this.demoModeUserIds.some(userId => userId === users.id)) {
} else if (this.demoModeUserIds?.some(userId => userId === users.id)) {
this.preventInDemo();
}
}
private preventInDemo(): void {
if (this.demoModeUserIds) {
if (this.demoModeUserIds && this.demoModeUserIds.length) {
throw new PreventedInDemo();
}
}