From d4e4b84f4f58d0becca61237fd7505d5b9ef284f Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Mon, 6 Jul 2020 17:46:07 +0200
Subject: [PATCH] FEAT #14199 TIME 0:10 hide specific console in production
 mode

---
 src/frontend/app/actions/actions.service.ts | 4 ++--
 src/frontend/main.ts                        | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/frontend/app/actions/actions.service.ts b/src/frontend/app/actions/actions.service.ts
index b1ef5e31595..340e465f82d 100644
--- a/src/frontend/app/actions/actions.service.ts
+++ b/src/frontend/app/actions/actions.service.ts
@@ -213,7 +213,7 @@ export class ActionsService implements OnDestroy {
     }
 
     lockResource(userId: number = this.currentUserId, groupId: number = this.currentGroupId, basketId: number = this.currentBasketId, resIds: number[] = this.currentResIds) {
-        console.log(`Verouillage des documents ${resIds}`);
+        console.debug(`Lock resources : ${resIds}`);
 
         this.http.put(`../rest/resourcesList/users/${userId}/groups/${groupId}/baskets/${basketId}/lock`, { resources: resIds }).pipe(
             tap(() => console.debug(`Cycle lock : `, this.currentResourceLock)),
@@ -239,7 +239,7 @@ export class ActionsService implements OnDestroy {
 
     unlockResource(userId: number = this.currentUserId, groupId: number = this.currentGroupId, basketId: number = this.currentBasketId, resIds: number[] = this.currentResIds) {
         if (resIds.length > 0) {
-            console.debug(`Unlock ressource : ${resIds}`);
+            console.debug(`Unlock resources : ${resIds}`);
             this.http.put(`../rest/resourcesList/users/${userId}/groups/${groupId}/baskets/${basketId}/unlock`, { resources: resIds }).pipe(
                 catchError((err: any) => {
                     this.notify.handleErrors(err);
diff --git a/src/frontend/main.ts b/src/frontend/main.ts
index 25876d93b60..263e00094f5 100755
--- a/src/frontend/main.ts
+++ b/src/frontend/main.ts
@@ -4,6 +4,11 @@ import { enableProdMode } from '@angular/core';
 import 'hammerjs';
 
 import { AppModule } from './app/app.module';
+import { environment } from './environments/environment';
+
+if (environment.production) {
+    window.console.debug = function() {};
+    enableProdMode();
+}
 
-enableProdMode();
 platformBrowserDynamic().bootstrapModule(AppModule);
-- 
GitLab