From 6e940cfcf567469acebd2ab3bb8bfffdce8d236e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20K=C3=A4sler?= <tom.kaesler@mni.thm.de> Date: Wed, 24 Jul 2019 12:13:16 +0200 Subject: [PATCH] Break apart role concept Have a user home where all visited and created sessions are in one list Add icons for the room list to identify the role --- src/app/app-routing.module.ts | 5 ++ src/app/app.module.ts | 6 ++ .../creator/creator-routing.module.ts | 15 ----- src/app/components/creator/creator.module.ts | 2 - .../home-creator-page.component.html | 0 .../home-creator-page.component.scss | 0 .../home-creator-page.component.spec.ts | 0 .../home-creator-page.component.ts | 0 .../home-participant-page.component.html | 2 +- .../home-participant-page.component.scss | 0 .../home-participant-page.component.spec.ts | 0 .../home-participant-page.component.ts | 0 .../home/user-home/user-home.component.html | 14 ++++ .../home/user-home/user-home.component.scss | 13 ++++ .../home/user-home/user-home.component.ts | 39 +++++++++++ .../participant/participant-routing.module.ts | 7 -- .../participant/participant.module.ts | 2 - .../shared/header/header.component.html | 6 +- .../shared/login/login.component.ts | 6 +- .../shared/room-join/room-join.component.ts | 8 ++- .../shared/room-list/room-list.component.html | 12 +++- .../shared/room-list/room-list.component.ts | 67 +++++++++++++------ src/app/models/moderator.ts | 5 +- src/app/models/room-role-mixin.ts | 6 ++ src/app/models/user-roles.enum.ts | 4 +- src/assets/i18n/home/de.json | 3 +- src/assets/i18n/home/en.json | 3 +- 27 files changed, 158 insertions(+), 67 deletions(-) rename src/app/components/{creator => home}/home-creator-page/home-creator-page.component.html (100%) rename src/app/components/{creator => home}/home-creator-page/home-creator-page.component.scss (100%) rename src/app/components/{creator => home}/home-creator-page/home-creator-page.component.spec.ts (100%) rename src/app/components/{creator => home}/home-creator-page/home-creator-page.component.ts (100%) rename src/app/components/{participant => home}/home-participant-page/home-participant-page.component.html (97%) rename src/app/components/{participant => home}/home-participant-page/home-participant-page.component.scss (100%) rename src/app/components/{participant => home}/home-participant-page/home-participant-page.component.spec.ts (100%) rename src/app/components/{participant => home}/home-participant-page/home-participant-page.component.ts (100%) create mode 100644 src/app/components/home/user-home/user-home.component.html create mode 100644 src/app/components/home/user-home/user-home.component.scss create mode 100644 src/app/components/home/user-home/user-home.component.ts create mode 100644 src/app/models/room-role-mixin.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index a599b06ef..889a9ee26 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { PageNotFoundComponent } from './components/shared/page-not-found/page-not-found.component'; import { HomePageComponent } from './components/home/home-page/home-page.component'; +import { UserHomeComponent } from './components/home/user-home/user-home.component'; const routes: Routes = [ { @@ -13,6 +14,10 @@ const routes: Routes = [ path: 'home', component: HomePageComponent }, + { + path: 'user', + component: UserHomeComponent + }, { path: 'creator', loadChildren: './components/creator/creator.module#CreatorModule' diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 5826c74e1..4af59f9a4 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -28,6 +28,7 @@ import { LanguageService } from './services/util/language.service'; import { MarkdownService, MarkedOptions } from 'ngx-markdown'; import { NewLandingComponent } from './components/home/new-landing/new-landing.component'; import { HomePageComponent } from './components/home/home-page/home-page.component'; +import { UserHomeComponent } from './components/home/user-home/user-home.component'; import { AppConfig } from './app.config'; import { ThemeModule } from '../theme/theme.module'; import { ServiceWorkerModule } from '@angular/service-worker'; @@ -37,6 +38,8 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { HttpClient } from '@angular/common/http'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { DemoVideoComponent } from './components/home/_dialogs/demo-video/demo-video.component'; +import { HomeCreatorPageComponent } from './components/home/home-creator-page/home-creator-page.component'; +import { HomeParticipantPageComponent } from './components/home/home-participant-page/home-participant-page.component'; export function dialogClose(dialogResult: any) { } @@ -54,6 +57,9 @@ export function initializeApp(appConfig: AppConfig) { NewLandingComponent, HomePageComponent, DemoVideoComponent + UserHomeComponent, + HomeCreatorPageComponent, + HomeParticipantPageComponent ], entryComponents: [ RegisterComponent, diff --git a/src/app/components/creator/creator-routing.module.ts b/src/app/components/creator/creator-routing.module.ts index e7528ff67..eef47c99d 100644 --- a/src/app/components/creator/creator-routing.module.ts +++ b/src/app/components/creator/creator-routing.module.ts @@ -1,6 +1,5 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { HomeCreatorPageComponent } from './home-creator-page/home-creator-page.component'; import { AuthenticationGuard } from '../../guards/authentication.guard'; import { UserRole } from '../../models/user-roles.enum'; import { RoomCreatorPageComponent } from './room-creator-page/room-creator-page.component'; @@ -13,58 +12,44 @@ import { ContentPresentationComponent } from './content-presentation/content-pre import { CommentPageComponent } from '../shared/comment-page/comment-page.component'; const routes: Routes = [ - { - path: '', - component: HomeCreatorPageComponent, - canActivate: [AuthenticationGuard], - data: { roles: [UserRole.CREATOR] } - }, { path: 'room/:roomId', component: RoomCreatorPageComponent, - canActivate: [AuthenticationGuard], data: { roles: [UserRole.CREATOR] } }, { path: 'room/:roomId/create-content', component: ContentCreatePageComponent, canActivate: [AuthenticationGuard], - data: { roles: [UserRole.CREATOR] } }, { path: 'room/:roomId/statistics', component: StatisticsPageComponent, canActivate: [AuthenticationGuard], - data: { roles: [UserRole.CREATOR] } }, { path: 'room/:roomId/statistics/:contentId', component: StatisticComponent, - canActivate: [AuthenticationGuard], data: { roles: [UserRole.CREATOR] } }, { path: 'room/:roomId/comments', component: CommentPageComponent, - canActivate: [AuthenticationGuard], data: { roles: [UserRole.CREATOR] } }, { path: 'room/:roomId/feedback-barometer', component: FeedbackBarometerPageComponent, - canActivate: [AuthenticationGuard], data: { roles: [UserRole.CREATOR] } }, { path: 'room/:roomId/:contentGroup', component: ContentListComponent, - canActivate: [AuthenticationGuard], data: { roles: [UserRole.CREATOR] } }, { path: 'room/:roomId/:contentGroup/presentation', component: ContentPresentationComponent, - canActivate: [AuthenticationGuard], data: { roles: [UserRole.CREATOR] } } ]; diff --git a/src/app/components/creator/creator.module.ts b/src/app/components/creator/creator.module.ts index 1f37d69db..b2838e0e1 100644 --- a/src/app/components/creator/creator.module.ts +++ b/src/app/components/creator/creator.module.ts @@ -6,7 +6,6 @@ import { ContentCreatePageComponent } from './content-create-page/content-create import { ContentLikertCreatorComponent } from './content-likert-creator/content-likert-creator.component'; import { ContentTextCreatorComponent } from './content-text-creator/content-text-creator.component'; import { ContentYesNoCreatorComponent } from './content-yes-no-creator/content-yes-no-creator.component'; -import { HomeCreatorPageComponent } from './home-creator-page/home-creator-page.component'; import { RoomCreatorPageComponent } from './room-creator-page/room-creator-page.component'; import { EssentialsModule } from '../essentials/essentials.module'; import { RoomDeleteComponent } from './_dialogs/room-delete/room-delete.component'; @@ -47,7 +46,6 @@ import { ModeratorDeleteComponent } from './_dialogs/moderator-delete/moderator- ContentLikertCreatorComponent, ContentTextCreatorComponent, ContentYesNoCreatorComponent, - HomeCreatorPageComponent, RoomCreatorPageComponent, RoomDeleteComponent, RoomEditComponent, diff --git a/src/app/components/creator/home-creator-page/home-creator-page.component.html b/src/app/components/home/home-creator-page/home-creator-page.component.html similarity index 100% rename from src/app/components/creator/home-creator-page/home-creator-page.component.html rename to src/app/components/home/home-creator-page/home-creator-page.component.html diff --git a/src/app/components/creator/home-creator-page/home-creator-page.component.scss b/src/app/components/home/home-creator-page/home-creator-page.component.scss similarity index 100% rename from src/app/components/creator/home-creator-page/home-creator-page.component.scss rename to src/app/components/home/home-creator-page/home-creator-page.component.scss diff --git a/src/app/components/creator/home-creator-page/home-creator-page.component.spec.ts b/src/app/components/home/home-creator-page/home-creator-page.component.spec.ts similarity index 100% rename from src/app/components/creator/home-creator-page/home-creator-page.component.spec.ts rename to src/app/components/home/home-creator-page/home-creator-page.component.spec.ts diff --git a/src/app/components/creator/home-creator-page/home-creator-page.component.ts b/src/app/components/home/home-creator-page/home-creator-page.component.ts similarity index 100% rename from src/app/components/creator/home-creator-page/home-creator-page.component.ts rename to src/app/components/home/home-creator-page/home-creator-page.component.ts diff --git a/src/app/components/participant/home-participant-page/home-participant-page.component.html b/src/app/components/home/home-participant-page/home-participant-page.component.html similarity index 97% rename from src/app/components/participant/home-participant-page/home-participant-page.component.html rename to src/app/components/home/home-participant-page/home-participant-page.component.html index 4e955fc36..cac8bd808 100644 --- a/src/app/components/participant/home-participant-page/home-participant-page.component.html +++ b/src/app/components/home/home-participant-page/home-participant-page.component.html @@ -1,4 +1,4 @@ -<div fxLayout="column" fxLayoutAlign="start" fxLayoutGap="20px" fxFill> +<div fxLayout="column" fxLayoutAlign="start" fxLayoutGap="20px" > <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="5px"> <app-room-join></app-room-join> </div> diff --git a/src/app/components/participant/home-participant-page/home-participant-page.component.scss b/src/app/components/home/home-participant-page/home-participant-page.component.scss similarity index 100% rename from src/app/components/participant/home-participant-page/home-participant-page.component.scss rename to src/app/components/home/home-participant-page/home-participant-page.component.scss diff --git a/src/app/components/participant/home-participant-page/home-participant-page.component.spec.ts b/src/app/components/home/home-participant-page/home-participant-page.component.spec.ts similarity index 100% rename from src/app/components/participant/home-participant-page/home-participant-page.component.spec.ts rename to src/app/components/home/home-participant-page/home-participant-page.component.spec.ts diff --git a/src/app/components/participant/home-participant-page/home-participant-page.component.ts b/src/app/components/home/home-participant-page/home-participant-page.component.ts similarity index 100% rename from src/app/components/participant/home-participant-page/home-participant-page.component.ts rename to src/app/components/home/home-participant-page/home-participant-page.component.ts diff --git a/src/app/components/home/user-home/user-home.component.html b/src/app/components/home/user-home/user-home.component.html new file mode 100644 index 000000000..049c78a89 --- /dev/null +++ b/src/app/components/home/user-home/user-home.component.html @@ -0,0 +1,14 @@ +<div fxLayout="column" fxLayoutAlign="start" fxLayoutGap="20px" > + <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="15px"> + <app-room-join></app-room-join> + </div> + <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="15px"> + <button mat-raised-button (click)="openCreateRoomDialog()"> + <mat-icon>add</mat-icon> + {{ 'home-page.create-session' | translate }}</button> + </div> + <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="15px"> + <app-room-list [user]="user"></app-room-list> + </div> +</div> + diff --git a/src/app/components/home/user-home/user-home.component.scss b/src/app/components/home/user-home/user-home.component.scss new file mode 100644 index 000000000..60a955b56 --- /dev/null +++ b/src/app/components/home/user-home/user-home.component.scss @@ -0,0 +1,13 @@ +app-room-list { + width: 100%; + max-width: 800px; +} + +.mat-raised-button { + background-color: var(--primary); + color: var(--on-primary); +} + +app-join-room { + max-width: 800px; +} diff --git a/src/app/components/home/user-home/user-home.component.ts b/src/app/components/home/user-home/user-home.component.ts new file mode 100644 index 000000000..e1d0b3b69 --- /dev/null +++ b/src/app/components/home/user-home/user-home.component.ts @@ -0,0 +1,39 @@ +import { Component, OnInit } from '@angular/core'; +import { MatDialog } from '@angular/material'; +import { TranslateService } from '@ngx-translate/core'; +import { LanguageService } from '../../../services/util/language.service'; +import { RoomCreateComponent } from '../../shared/_dialogs/room-create/room-create.component'; +import { UserRole } from '../../../models/user-roles.enum'; +import { User } from '../../../models/user'; +import { AuthenticationService } from '../../../services/http/authentication.service'; + +@Component({ + selector: 'app-user-home', + templateUrl: './user-home.component.html', + styleUrls: [ './user-home.component.scss' ] +}) +export class UserHomeComponent implements OnInit { + user: User; + creatorRole: UserRole = UserRole.CREATOR; + participantRole: UserRole = UserRole.PARTICIPANT; + + constructor( + public dialog: MatDialog, + private translateService: TranslateService, + protected langService: LanguageService, + private authenticationService: AuthenticationService + ) { + langService.langEmitter.subscribe(lang => translateService.use(lang)); + } + + ngOnInit() { + this.translateService.use(localStorage.getItem('currentLang')); + this.authenticationService.watchUser.subscribe(newUser => this.user = newUser); + } + + openCreateRoomDialog(): void { + this.dialog.open(RoomCreateComponent, { + width: '350px' + }); + } +} diff --git a/src/app/components/participant/participant-routing.module.ts b/src/app/components/participant/participant-routing.module.ts index 5b266e444..9c7b4ce2d 100644 --- a/src/app/components/participant/participant-routing.module.ts +++ b/src/app/components/participant/participant-routing.module.ts @@ -1,6 +1,5 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { HomeParticipantPageComponent } from './home-participant-page/home-participant-page.component'; import { AuthenticationGuard } from '../../guards/authentication.guard'; import { UserRole } from '../../models/user-roles.enum'; import { RoomParticipantPageComponent } from './room-participant-page/room-participant-page.component'; @@ -11,12 +10,6 @@ import { StatisticComponent } from '../shared/statistic/statistic.component'; import { CommentPageComponent } from '../shared/comment-page/comment-page.component'; const routes: Routes = [ - { - path: '', - component: HomeParticipantPageComponent, - canActivate: [AuthenticationGuard], - data: { roles: [UserRole.PARTICIPANT] } - }, { path: 'room/:roomId', component: RoomParticipantPageComponent, diff --git a/src/app/components/participant/participant.module.ts b/src/app/components/participant/participant.module.ts index 77d5bb077..3467598d6 100644 --- a/src/app/components/participant/participant.module.ts +++ b/src/app/components/participant/participant.module.ts @@ -4,7 +4,6 @@ import { ParticipantRoutingModule } from './participant-routing.module'; import { EssentialsModule } from '../essentials/essentials.module'; import { ContentChoiceParticipantComponent } from './content-choice-participant/content-choice-participant.component'; import { ContentTextParticipantComponent } from './content-text-participant/content-text-participant.component'; -import { HomeParticipantPageComponent } from './home-participant-page/home-participant-page.component'; import { RoomParticipantPageComponent } from './room-participant-page/room-participant-page.component'; import { SharedModule } from '../shared/shared.module'; import { ParticipantContentCarouselPageComponent } from './participant-content-carousel-page/participant-content-carousel-page.component'; @@ -30,7 +29,6 @@ import { TranslateHttpLoader } from '@ngx-translate/http-loader'; declarations: [ ContentChoiceParticipantComponent, ContentTextParticipantComponent, - HomeParticipantPageComponent, RoomParticipantPageComponent, ParticipantContentCarouselPageComponent ] diff --git a/src/app/components/shared/header/header.component.html b/src/app/components/shared/header/header.component.html index 5a6c37104..109f4dddd 100644 --- a/src/app/components/shared/header/header.component.html +++ b/src/app/components/shared/header/header.component.html @@ -88,13 +88,9 @@ </mat-menu> <mat-menu #loginMenu="matMenu" [overlapTrigger]="false"> - <button mat-menu-item (click)=login(true)> - <mat-icon>record_voice_over</mat-icon> - <span>{{ 'login-page.creator' | translate }}</span> - </button> <button mat-menu-item (click)=login(false)> <mat-icon>supervisor_account</mat-icon> - <span>{{ 'login-page.participant' | translate }}</span> + <span>{{ 'login-page.login' | translate }}</span> </button> </mat-menu> diff --git a/src/app/components/shared/login/login.component.ts b/src/app/components/shared/login/login.component.ts index c17738384..254387173 100644 --- a/src/app/components/shared/login/login.component.ts +++ b/src/app/components/shared/login/login.component.ts @@ -102,11 +102,7 @@ export class LoginComponent implements OnInit, OnChanges { }); this.dialog.closeAll(); if (this.isStandard) { - if (this.role === UserRole.CREATOR) { - this.router.navigate(['creator']); - } else { - this.router.navigate(['participant']); - } + this.router.navigate(['user']); } } else if (loginSuccessful === 'activation') { this.activateUser(); diff --git a/src/app/components/shared/room-join/room-join.component.ts b/src/app/components/shared/room-join/room-join.component.ts index 3afb6cafe..4d9ab6ebe 100644 --- a/src/app/components/shared/room-join/room-join.component.ts +++ b/src/app/components/shared/room-join/room-join.component.ts @@ -89,7 +89,11 @@ export class RoomJoinComponent implements OnInit { } addAndNavigate() { - this.roomService.addToHistory(this.room.id); - this.router.navigate([`/participant/room/${this.room.shortId}/comments`]); + if (this.user.id === this.room.ownerId) { + this.router.navigate([`/creator/room/${this.room.shortId}/comments`]); + } else { + this.roomService.addToHistory(this.room.id); + this.router.navigate([`/participant/room/${this.room.shortId}/comments`]); + } } } diff --git a/src/app/components/shared/room-list/room-list.component.html b/src/app/components/shared/room-list/room-list.component.html index c4794149e..679d6e117 100644 --- a/src/app/components/shared/room-list/room-list.component.html +++ b/src/app/components/shared/room-list/room-list.component.html @@ -4,18 +4,24 @@ </div> </div> -<div *ngIf="rooms && rooms.length != 0"> +<div *ngIf="roomsWithRole && roomsWithRole.length != 0"> <mat-expansion-panel [disabled]="true" id="matPanelHeader"> <mat-expansion-panel-header> + <mat-panel-title class="headerTitle">Role</mat-panel-title> <mat-panel-title class="headerTitle">Session</mat-panel-title> <mat-panel-description class="headerTitle">ID</mat-panel-description> </mat-expansion-panel-header> </mat-expansion-panel> - <mat-expansion-panel *ngFor="let room of rooms" class="matPanel"> + <mat-expansion-panel *ngFor="let room of roomsWithRole" class="matPanel"> <mat-expansion-panel-header class="matPanelListHeader"> - <button mat-flat-button routerLink="/{{ baseUrl }}/room/{{ room.shortId }}" (click)="setCurrentRoom(room.shortId)"> + <button mat-flat-button routerLink="/{{ roleToString(room.role) }}/room/{{ room.shortId }}" (click)="setCurrentRoom(room.shortId)"> <mat-icon>input</mat-icon> </button> + <mat-panel-title class="panelTitle" [ngSwitch]="room.role"> + <mat-icon *ngSwitchCase="creatorRole">record_voice_over</mat-icon> + <mat-icon *ngSwitchCase="participantRole">face</mat-icon> + <mat-icon *ngSwitchCase="executiveModeratorRole">gavel</mat-icon> + </mat-panel-title> <mat-panel-title class="panelTitle"> {{ room.name }} </mat-panel-title> diff --git a/src/app/components/shared/room-list/room-list.component.ts b/src/app/components/shared/room-list/room-list.component.ts index e55aaaf4b..329a3ef22 100644 --- a/src/app/components/shared/room-list/room-list.component.ts +++ b/src/app/components/shared/room-list/room-list.component.ts @@ -1,9 +1,13 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input } from '@angular/core'; import { Room } from '../../../models/room'; +import { RoomRoleMixin } from '../../../models/room-role-mixin'; +import { User } from '../../../models/user'; +import { UserRole } from '../../../models/user-roles.enum'; +import { Moderator } from '../../../models/moderator'; import { RoomService } from '../../../services/http/room.service'; import { EventService } from '../../../services/util/event.service'; import { AuthenticationService } from '../../../services/http/authentication.service'; -import { UserRole } from '../../../models/user-roles.enum'; +import { ModeratorService } from '../../../services/http/moderator.service'; @Component({ selector: 'app-room-list', @@ -11,48 +15,71 @@ import { UserRole } from '../../../models/user-roles.enum'; styleUrls: ['./room-list.component.scss'] }) export class RoomListComponent implements OnInit { - rooms: Room[]; + @Input() user: User; + rooms: Room[] = []; + roomsWithRole: RoomRoleMixin[]; closedRooms: Room[]; baseUrl: string; isLoading = true; + creatorRole = UserRole.CREATOR; + participantRole = UserRole.PARTICIPANT; + executiveModeratorRole = UserRole.EXECUTIVE_MODERATOR; + constructor( private roomService: RoomService, public eventService: EventService, - protected authenticationService: AuthenticationService) { + protected authenticationService: AuthenticationService, + private moderatorService: ModeratorService + ) { } ngOnInit() { this.getRooms(); - this.getPath(); this.eventService.on<any>('RoomDeleted').subscribe(payload => { this.rooms = this.rooms.filter(r => r.id !== payload.id); }); } - getPath() { - if (this.authenticationService.getRole() === UserRole.CREATOR) { - this.baseUrl = 'creator'; - } else { - this.baseUrl = 'participant'; - } - } - getRooms(): void { - if (this.authenticationService.getRole() === UserRole.CREATOR) { - this.roomService.getCreatorRooms().subscribe(rooms => this.updateRoomList(rooms)); - } else if (this.authenticationService.getRole() === UserRole.PARTICIPANT) { - this.roomService.getParticipantRooms().subscribe(rooms => this.updateRoomList(rooms)); - } + this.roomService.getCreatorRooms().subscribe(rooms => this.updateRoomList(rooms, true)); + this.roomService.getParticipantRooms().subscribe(rooms => this.updateRoomList(rooms)); } - updateRoomList(rooms: Room[]) { - this.rooms = rooms; + updateRoomList(rooms: Room[], isOwner: boolean = false) { + this.rooms = this.rooms.concat(rooms); this.closedRooms = this.rooms.filter(room => room.closed); + this.roomsWithRole = this.rooms.map(room => { + const roomWithRole: RoomRoleMixin = <RoomRoleMixin>room; + if (isOwner) { + roomWithRole.role = UserRole.CREATOR; + } else { + roomWithRole.role = UserRole.PARTICIPANT; + this.moderatorService.get(room.id).subscribe((moderators: Moderator[]) => { + for (const m of moderators) { + if (m.userId === this.user.id) { + roomWithRole.role = UserRole.EXECUTIVE_MODERATOR; + } + } + }); + } + return roomWithRole; + }); this.isLoading = false; } setCurrentRoom(shortId: string) { localStorage.setItem('shortId', shortId); } + + roleToString(role: UserRole): string { + switch (role) { + case UserRole.CREATOR: + return 'creator'; + case UserRole.PARTICIPANT: + return 'participant'; + case UserRole.EXECUTIVE_MODERATOR: + return 'moderator'; + } + } } diff --git a/src/app/models/moderator.ts b/src/app/models/moderator.ts index acd96fc89..ff213d9c3 100644 --- a/src/app/models/moderator.ts +++ b/src/app/models/moderator.ts @@ -1,14 +1,15 @@ import { ModeratorRole } from './moderator-roles.enum'; +import { UserRole } from './user-roles.enum'; export class Moderator { userId: string; loginId: string; - roles: ModeratorRole[]; + roles: UserRole[]; constructor( userId: string = '', loginId: string = '', - roles: ModeratorRole[] = [] + roles: UserRole[] = [] ) { this.userId = userId; this.loginId = loginId; diff --git a/src/app/models/room-role-mixin.ts b/src/app/models/room-role-mixin.ts new file mode 100644 index 000000000..d34c57bdd --- /dev/null +++ b/src/app/models/room-role-mixin.ts @@ -0,0 +1,6 @@ +import { Room } from './room'; +import { UserRole } from './user-roles.enum'; + +export class RoomRoleMixin extends Room { + role: UserRole; +} diff --git a/src/app/models/user-roles.enum.ts b/src/app/models/user-roles.enum.ts index 71cc81615..9e62fc2a6 100644 --- a/src/app/models/user-roles.enum.ts +++ b/src/app/models/user-roles.enum.ts @@ -1,4 +1,6 @@ export enum UserRole { PARTICIPANT, - CREATOR + CREATOR, + EDITING_MODERATOR, + EXECUTIVE_MODERATOR } diff --git a/src/assets/i18n/home/de.json b/src/assets/i18n/home/de.json index c3a3e4632..5d611b0fd 100644 --- a/src/assets/i18n/home/de.json +++ b/src/assets/i18n/home/de.json @@ -24,7 +24,8 @@ "password-reset": "Passwort vergessen?", "not-registered": "Noch kein Konto?", "register": "Registrieren", - "welcome": "Online fragen | Fragen voten" + "welcome": "Online fragen | Fragen voten", + "login": "Login" }, "home-page": { "join-demo-session": "Öffentliche Session betreten", diff --git a/src/assets/i18n/home/en.json b/src/assets/i18n/home/en.json index 8553f3ec0..1bfb3b521 100644 --- a/src/assets/i18n/home/en.json +++ b/src/assets/i18n/home/en.json @@ -24,7 +24,8 @@ "password-reset": "Forgot your password?", "not-registered": "Don't have an account yet?", "register": "Register", - "welcome": "Ask online | vote questions" + "welcome": "Ask online | vote questions", + "login": "Login" }, "home-page": { "join-demo-session": "Join public session", -- GitLab