From 38c8ec18b2eff726cbf7c9935210611842584364 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de>
Date: Sat, 6 Jul 2019 23:00:12 +0200
Subject: [PATCH] Add remove-moderator functionality

---
 .../creator/_dialogs/moderators/moderators.component.html | 8 +++++++-
 .../creator/_dialogs/moderators/moderators.component.scss | 4 ++++
 .../creator/_dialogs/moderators/moderators.component.ts   | 5 ++++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/app/components/creator/_dialogs/moderators/moderators.component.html b/src/app/components/creator/_dialogs/moderators/moderators.component.html
index bec6c56a4..b9c8fa99d 100644
--- a/src/app/components/creator/_dialogs/moderators/moderators.component.html
+++ b/src/app/components/creator/_dialogs/moderators/moderators.component.html
@@ -13,6 +13,12 @@
   </div>
   <h3 *ngIf="moderators.length === 0">No moderators yet.</h3>
   <mat-list *ngIf="moderators.length > 0">
-    <mat-list-item *ngFor="let moderator of moderators">{{moderator.userId}}</mat-list-item>
+    <mat-list-item *ngFor="let moderator of moderators">
+      {{moderator.userId}}
+      <span class="fill-remaining-space"></span>
+      <button mat-icon-button (click)="removeModerator(moderator.userId)">
+        <mat-icon class="close">close</mat-icon>
+      </button>
+    </mat-list-item>
   </mat-list>
 </div>
diff --git a/src/app/components/creator/_dialogs/moderators/moderators.component.scss b/src/app/components/creator/_dialogs/moderators/moderators.component.scss
index e7a1a2c9c..52321802b 100644
--- a/src/app/components/creator/_dialogs/moderators/moderators.component.scss
+++ b/src/app/components/creator/_dialogs/moderators/moderators.component.scss
@@ -27,6 +27,10 @@ mat-form-field {
   line-height: 100% !important;
 }
 
+.close {
+  color: var(--red);
+}
+
 .mat-list-item {
   color: var(--on-surface);
 }
diff --git a/src/app/components/creator/_dialogs/moderators/moderators.component.ts b/src/app/components/creator/_dialogs/moderators/moderators.component.ts
index 7c5ecc7a5..ea50b4093 100644
--- a/src/app/components/creator/_dialogs/moderators/moderators.component.ts
+++ b/src/app/components/creator/_dialogs/moderators/moderators.component.ts
@@ -44,7 +44,10 @@ export class ModeratorsComponent implements OnInit {
         return;
       }
       this.moderatorService.add(this.roomId, list[0].id).subscribe();
-      this.getModerators();
     });
   }
+
+  removeModerator(userId: string) {
+    this.moderatorService.delete(this.roomId, userId).subscribe();
+  }
 }
-- 
GitLab