From b7b365b292dbb9480c313dcae166c9e79cd2c3d1 Mon Sep 17 00:00:00 2001
From: Hagen <hagen.dressler@mni.thm.de>
Date: Thu, 22 Mar 2018 03:38:25 +0100
Subject: [PATCH] Move component comment path

---
 src/app/app-routing.module.ts                  |  2 +-
 src/app/app.module.ts                          |  2 +-
 .../comment-list/comment-list.component.html   |  0
 .../comment-list/comment-list.component.scss   |  0
 .../comment-list.component.spec.ts             |  0
 .../comment-list/comment-list.component.ts     | 18 +++++-------------
 .../room-participant-page.component.html       |  2 +-
 7 files changed, 8 insertions(+), 16 deletions(-)
 rename src/app/components/{fragments => pages}/comment-list/comment-list.component.html (100%)
 rename src/app/components/{fragments => pages}/comment-list/comment-list.component.scss (100%)
 rename src/app/components/{fragments => pages}/comment-list/comment-list.component.spec.ts (100%)
 rename src/app/components/{fragments => pages}/comment-list/comment-list.component.ts (82%)

diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index b88ff247f..ef8e78458 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -9,7 +9,7 @@ import { AuthenticationGuard } from './guards/authentication.guard';
 import { UserRole } from './models/user-roles.enum';
 import { RoomParticipantPageComponent } from './components/pages/room-participant-page/room-participant-page.component';
 import { RoomCreatorPageComponent } from './components/pages/room-creator-page/room-creator-page.component';
-import { CommentListComponent } from './components/fragments/comment-list/comment-list.component';
+import { CommentListComponent } from './components/pages/comment-list/comment-list.component';
 import { ContentListComponent } from './components/fragments/content-list/content-list.component';
 import { StatisticsComponent } from './components/fragments/statistics/statistics.component';
 import { ContentCreatePageComponent } from './components/pages/content-create-page/content-create-page.component';
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index cdb2b87b8..f386baf32 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -7,7 +7,7 @@ import { RoomJoinComponent } from './components/fragments/room-join/room-join.co
 import { LoginComponent } from './components/fragments/login/login.component';
 import { RegisterComponent } from './components/dialogs/register/register.component';
 import { PasswordResetComponent } from './components/dialogs/password-reset/password-reset.component';
-import { CommentListComponent } from './components/fragments/comment-list/comment-list.component';
+import { CommentListComponent } from './components/pages/comment-list/comment-list.component';
 import { AppRoutingModule } from './app-routing.module';
 import { FormsModule, ReactiveFormsModule } from '@angular/forms';
 import { PageNotFoundPageComponent } from './components/pages/page-not-found-page/page-not-found-page.component';
diff --git a/src/app/components/fragments/comment-list/comment-list.component.html b/src/app/components/pages/comment-list/comment-list.component.html
similarity index 100%
rename from src/app/components/fragments/comment-list/comment-list.component.html
rename to src/app/components/pages/comment-list/comment-list.component.html
diff --git a/src/app/components/fragments/comment-list/comment-list.component.scss b/src/app/components/pages/comment-list/comment-list.component.scss
similarity index 100%
rename from src/app/components/fragments/comment-list/comment-list.component.scss
rename to src/app/components/pages/comment-list/comment-list.component.scss
diff --git a/src/app/components/fragments/comment-list/comment-list.component.spec.ts b/src/app/components/pages/comment-list/comment-list.component.spec.ts
similarity index 100%
rename from src/app/components/fragments/comment-list/comment-list.component.spec.ts
rename to src/app/components/pages/comment-list/comment-list.component.spec.ts
diff --git a/src/app/components/fragments/comment-list/comment-list.component.ts b/src/app/components/pages/comment-list/comment-list.component.ts
similarity index 82%
rename from src/app/components/fragments/comment-list/comment-list.component.ts
rename to src/app/components/pages/comment-list/comment-list.component.ts
index ff2e3707a..7cad6d866 100644
--- a/src/app/components/fragments/comment-list/comment-list.component.ts
+++ b/src/app/components/pages/comment-list/comment-list.component.ts
@@ -45,19 +45,11 @@ export class CommentListComponent implements OnInit {
   }
 
   getComments(roomId: string): void {
-    if (this.userRole === UserRole.CREATOR) {
-      this.commentService.getComments(roomId)
-        .subscribe(comments => {
-          this.comments = comments;
-          this.isLoading = false;
-        });
-    } else if (this.userRole === UserRole.PARTICIPANT) {
-      this.commentService.searchComments(roomId, this.user.id)
-        .subscribe(comments => {
-          this.comments = comments;
-          this.isLoading = false;
-        });
-    }
+    this.commentService.getComments(roomId)
+      .subscribe(comments => {
+        this.comments = comments;
+        this.isLoading = false;
+      });
   }
 
   setRead(comment: Comment): void {
diff --git a/src/app/components/pages/room-participant-page/room-participant-page.component.html b/src/app/components/pages/room-participant-page/room-participant-page.component.html
index 3b69ee966..e9444018f 100644
--- a/src/app/components/pages/room-participant-page/room-participant-page.component.html
+++ b/src/app/components/pages/room-participant-page/room-participant-page.component.html
@@ -16,7 +16,7 @@
       <mat-grid-list cols="2" rowHeight="2:1">
         <mat-grid-tile>
           <button mat-icon-button color="primary" matTooltip="Create comment"
-                  routerLink="/participant/room/{{ room.id }}/create-comment">
+                  routerLink="/participant/room/{{ room.shortId }}/create-comment">
             <mat-icon>question_answer</mat-icon>
           </button>
         </mat-grid-tile>
-- 
GitLab