From 12a4be70e0c63b34b22366e089c5e59054934e34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de>
Date: Wed, 14 Mar 2018 17:13:33 +0100
Subject: [PATCH] Adjust room list so that the getRooms() distinguishes between
 participant and creator

---
 src/app/room-list/room-list.component.ts |  3 ++-
 src/app/room.service.ts                  | 13 ++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/app/room-list/room-list.component.ts b/src/app/room-list/room-list.component.ts
index 83c3ada7c..9e0dd6e4a 100644
--- a/src/app/room-list/room-list.component.ts
+++ b/src/app/room-list/room-list.component.ts
@@ -17,7 +17,8 @@ export class RoomListComponent implements OnInit {
 
   constructor(
     private roomService: RoomService,
-    protected authenticationService: AuthenticationService) {}
+    protected authenticationService: AuthenticationService) {
+  }
 
   ngOnInit() {
     this.getRooms();
diff --git a/src/app/room.service.ts b/src/app/room.service.ts
index a479c71b1..e293c6d33 100644
--- a/src/app/room.service.ts
+++ b/src/app/room.service.ts
@@ -21,7 +21,7 @@ export class RoomService extends ErrorHandlingService {
     super();
   }
 
-  getRooms(): Observable<Room[]> {
+  getCreatorRooms(): Observable<Room[]> {
     const url = this.apiBaseUrl + this.roomsUrl + this.findRoomsUrl;
     return this.http.post<Room[]>(url, {
       properties: { ownerId: this.authService.getUser().userId },
@@ -32,6 +32,17 @@ export class RoomService extends ErrorHandlingService {
     );
   }
 
+  getParticipantRooms(): Observable<Room[]> {
+    const url = this.apiBaseUrl + this.roomsUrl + this.findRoomsUrl;
+    return this.http.post<Room[]>(url, {
+      properties: {},
+      externalFilters: { inHistoryOfUserId: this.authService.getUser().userId }
+    }).pipe(
+      tap(_ => ''),
+      catchError(this.handleError('getRooms', []))
+    );
+  }
+
   addRoom(room: Room): Observable<Room> {
     const connectionUrl = this.apiBaseUrl + this.roomsUrl + '/';
     return this.http.post<Room>(connectionUrl, {
-- 
GitLab