From 30f027a99e77ca1337c3ff042452ad14f1217b7f Mon Sep 17 00:00:00 2001
From: Louis Peter <Louis.Peter@mni.thm.de>
Date: Fri, 5 Apr 2019 16:16:36 +0200
Subject: [PATCH] Trying to update commentThreshold value from room, still not
 working

---
 .../shared/_dialogs/room-create/room-create.component.html  | 2 +-
 .../shared/_dialogs/room-create/room-create.component.ts    | 6 +++---
 src/app/services/http/room.service.ts                       | 3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/app/components/shared/_dialogs/room-create/room-create.component.html b/src/app/components/shared/_dialogs/room-create/room-create.component.html
index b3e1ce6e5..1c8f06136 100644
--- a/src/app/components/shared/_dialogs/room-create/room-create.component.html
+++ b/src/app/components/shared/_dialogs/room-create/room-create.component.html
@@ -1,4 +1,4 @@
-<form (ngSubmit)="addRoom(longRoomName.value, description.value)">
+<form (ngSubmit)="addRoom(longRoomName.value, description.value, -100)">
   <div fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px">
     <mat-form-field>
       <input (keypress)="resetEmptyInputs()" matInput #longRoomName class="input-block" type="text"
diff --git a/src/app/components/shared/_dialogs/room-create/room-create.component.ts b/src/app/components/shared/_dialogs/room-create/room-create.component.ts
index 921235ab4..d0ad04a12 100644
--- a/src/app/components/shared/_dialogs/room-create/room-create.component.ts
+++ b/src/app/components/shared/_dialogs/room-create/room-create.component.ts
@@ -40,7 +40,7 @@ export class RoomCreateComponent implements OnInit {
     this.emptyInputs = false;
   }
 
-  addRoom(longRoomName: string, description: string) {
+  addRoom(longRoomName: string, description: string, commentThreshold: number) {
     longRoomName = longRoomName.trim();
     if (!longRoomName) {
       this.emptyInputs = true;
@@ -49,10 +49,10 @@ export class RoomCreateComponent implements OnInit {
     this.roomService.addRoom({
       name: longRoomName,
       abbreviation: '00000000',
-      description: description
+      description: description,
+      commentThreshold: commentThreshold
     } as Room).subscribe(room => {
       this.room = room;
-      room.commentThreshold = -100;
       let msg1: string;
       let msg2: string;
       this.translateService.get('home-page.created-1').subscribe(msg => { msg1 = msg; });
diff --git a/src/app/services/http/room.service.ts b/src/app/services/http/room.service.ts
index b2bea4914..b1e9903cd 100644
--- a/src/app/services/http/room.service.ts
+++ b/src/app/services/http/room.service.ts
@@ -51,7 +51,8 @@ export class RoomService extends BaseHttpService {
     const connectionUrl = this.apiUrl.base + this.apiUrl.rooms + '/';
     return this.http.post<Room>(connectionUrl, {
       ownerId: this.authService.getUser().id,
-      abbreviation: room.abbreviation, name: room.name, closed: room.closed, description: room.description
+      abbreviation: room.abbreviation, name: room.name, closed: room.closed, description: room.description,
+      commentThreshold: room.commentThreshold
     }, httpOptions);
   }
 
-- 
GitLab