From 3dcef55950aa438cae6aa5b14624efc4569841ad Mon Sep 17 00:00:00 2001 From: Lukas Haase <lukas.haase@mni.thm.de> Date: Tue, 17 Aug 2021 13:24:57 +0200 Subject: [PATCH] indentation changes, allow moderator to use all settings except delete questions room --- .../shared/header/header.component.html | 15 ++++++----- .../shared/header/header.component.ts | 3 ++- .../services/http/authentication.service.ts | 26 ++++++------------- 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/app/components/shared/header/header.component.html b/src/app/components/shared/header/header.component.html index 0e259e40f..e0fd699bf 100644 --- a/src/app/components/shared/header/header.component.html +++ b/src/app/components/shared/header/header.component.html @@ -194,7 +194,7 @@ <button mat-menu-item tabindex="0" - *ngIf="user && user.role >0 && deviceType !== 'mobile' && !router.url.endsWith('moderator/comments')" + *ngIf="user && user.role > 0 && deviceType !== 'mobile' && !router.url.endsWith('moderator/comments')" routerLink="participant/room/{{shortId}}/comments/questionwall"> <mat-icon class="beamer-icon" svgIcon="beamer"> @@ -231,7 +231,8 @@ </ng-container> <!-- Session --> - <ng-container *ngIf="!router.url.endsWith('/comments') && !router.url.includes('/comment/') && !router.url.endsWith('tagcloud')"> + <ng-container + *ngIf="!router.url.endsWith('/comments') && !router.url.includes('/comment/') && !router.url.endsWith('tagcloud')"> <!-- app-room-participant-page --> <ng-container *ngIf="router.url.includes('/participant/room/')"> @@ -266,7 +267,7 @@ <!-- Room General Options - bot --> <ng-container - *ngIf="user && user.role == 3 && !router.url.includes('/participant') && !router.url.endsWith('/comments') && !router.url.includes('/comment/') && !router.url.endsWith('tagcloud')"> + *ngIf="user && user.role > 0 && !router.url.includes('/participant') && !router.url.endsWith('/comments') && !router.url.includes('/comment/') && !router.url.endsWith('tagcloud')"> <button mat-menu-item (click)="navigateModerator()" @@ -317,7 +318,7 @@ </button> <button mat-menu-item - *ngIf="user && user.role >0 && router.url.endsWith('/tagcloud')" + *ngIf="user && user.role > 0 && router.url.endsWith('/tagcloud')" tabindex="0" (click)="navigateTopicCloudConfig()"> <mat-icon aria-label="Configuration Icon">cloud</mat-icon> @@ -325,7 +326,7 @@ </button> <button mat-menu-item - *ngIf="user && user.role >0 && router.url.endsWith('/tagcloud')" + *ngIf="user && user.role > 0 && router.url.endsWith('/tagcloud')" tabindex="0" (click)="navigateTopicCloudAdministration()"> <mat-icon aria-hidden="false" @@ -354,7 +355,7 @@ <button mat-menu-item tabindex="0" - *ngIf="user && user.role == 3 && !router.url.includes('/participant') && !router.url.endsWith('/comments') && !router.url.includes('/comment/') && !router.url.endsWith('tagcloud')" + *ngIf="user && user.role > 0 && !router.url.includes('/participant') && !router.url.endsWith('/comments') && !router.url.includes('/comment/') && !router.url.endsWith('tagcloud')" (click)="blockQuestions()" [ngClass]="{'color-warn': room && room.questionsBlocked}" > @@ -461,7 +462,7 @@ *ngIf="user" (click)="showMotdDialog()"> <mat-icon class="faq"> - {{ motdState ? 'notifications_active' : 'help' }} + {{ motdState?'notifications_active':'help' }} </mat-icon> <span>{{'header.motd' | translate}}</span> </button> diff --git a/src/app/components/shared/header/header.component.ts b/src/app/components/shared/header/header.component.ts index 8bf64ce57..d5202e5fc 100644 --- a/src/app/components/shared/header/header.component.ts +++ b/src/app/components/shared/header/header.component.ts @@ -47,10 +47,11 @@ export class HeaderComponent implements OnInit { commentsCountUsers = 0; commentsCountKeywords = 0; isAdminConfigEnabled = false; - private _subscriptionRoomService = null; toggleUserActivity = false; userActivity = 0; deviceType = localStorage.getItem('deviceType'); + userRole = -1; + private _subscriptionRoomService = null; constructor(public location: Location, private authenticationService: AuthenticationService, diff --git a/src/app/services/http/authentication.service.ts b/src/app/services/http/authentication.service.ts index f15756273..633262d91 100644 --- a/src/app/services/http/authentication.service.ts +++ b/src/app/services/http/authentication.service.ts @@ -77,7 +77,7 @@ export class AuthenticationService extends BaseHttpService { return this.checkLogin(this.http.post<ClientAuthentication>(connectionUrl, { loginId: email, - password: password + password }, this.httpOptions), userRole, false).pipe( tap(x => { if (x === 'true') { @@ -154,10 +154,8 @@ export class AuthenticationService extends BaseHttpService { return this.http.post<boolean>(connectionUrl, { loginId: email, - password: password - }, this.httpOptions).pipe(map(() => { - return true; - })); + password + }, this.httpOptions).pipe(map(() => true)); } resetPassword(email: string): Observable<string> { @@ -172,11 +170,7 @@ export class AuthenticationService extends BaseHttpService { key: null, password: null }, this.httpOptions).pipe( - catchError(err => { - return of(err.error.message); - }), map((result) => { - return result; - }) + catchError(err => of(err.error.message)), map((result) => result) ); } @@ -189,14 +183,10 @@ export class AuthenticationService extends BaseHttpService { this.apiUrl.resetPassword; return this.http.post(connectionUrl, { - key: key, - password: password + key, + password }, this.httpOptions).pipe( - catchError(err => { - return of(err.error.message); - }), map((result) => { - return result; - }) + catchError(err => of(err.error.message)), map((result) => result) ); } @@ -289,7 +279,7 @@ export class AuthenticationService extends BaseHttpService { saveAccessToLocalStorage(): void { const arr = new Array(); - this.roomAccess.forEach(function (key, value) { + this.roomAccess.forEach(function(key, value) { arr.push(key + '_' + String(value)); }); localStorage.setItem(this.ROOM_ACCESS, JSON.stringify(arr)); -- GitLab