From 38e0d771f2d3f9905afee7a4536e8fc201285f83 Mon Sep 17 00:00:00 2001
From: Hamza HRAMCHI <hamza.hramchi@xelians.fr>
Date: Wed, 13 Apr 2022 11:17:30 +0200
Subject: [PATCH] FIX #20499 TIME 0:10 clear cc and cci fields if disabled

---
 .../mail-editor/mail-editor.component.ts      | 24 ++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/frontend/plugins/mail-editor/mail-editor.component.ts b/src/frontend/plugins/mail-editor/mail-editor.component.ts
index 8ee013740a6..2765baa0ed9 100644
--- a/src/frontend/plugins/mail-editor/mail-editor.component.ts
+++ b/src/frontend/plugins/mail-editor/mail-editor.component.ts
@@ -442,10 +442,14 @@ export class MailEditorComponent implements OnInit, OnDestroy {
     }
 
     getCopies() {
-        return this.copies.map((item: any) => {
-            delete item.badFormat;
-            return item;
-        });
+        if (this.showCopies) {
+            return this.copies.map((item: any) => {
+                delete item.badFormat;
+                return item;
+            });
+        } else {
+            return [];
+        }
     }
 
     setInvisibleCopies(invisibleCopies: any) {
@@ -454,10 +458,14 @@ export class MailEditorComponent implements OnInit, OnDestroy {
     }
 
     getInvisibleCopies() {
-        return this.invisibleCopies.map((item: any) => {
-            delete item.badFormat;
-            return item;
-        });
+        if (this.showInvisibleCopies) {
+            return this.invisibleCopies.map((item: any) => {
+                delete item.badFormat;
+                return item;
+            });
+        } else {
+            return [];
+        }
     }
 
     isSelectedAttachMail(item: any, type: string) {
-- 
GitLab