From e23ed017e78a6d9a769c92029b5af9cded37a1e4 Mon Sep 17 00:00:00 2001
From: Uwe Trotzek <uwe.trotzek@gmail.com>
Date: Wed, 16 Sep 2020 16:29:37 +0200
Subject: [PATCH] [BUGFIX] Send workspace notifications to selected recipients
 only

When a users sends a draft version to another stage a modal opens
to let the user decide which users should be notified about this.

This patch ensures that only the selected persons will get an email.
Prior to this only the last user of the list got an e-mail.

Resolves: #92316
Change-Id: Ia4014878f6b30a3773b5d38e01d5379094394c32
Releases: master, 10.4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65746
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
---
 .../backend/Resources/Public/TypeScript/Utility.ts   | 12 +++++++++++-
 .../backend/Resources/Public/JavaScript/Utility.js   |  2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Utility.ts b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Utility.ts
index cb5530e98115..143bf309b2bd 100644
--- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Utility.ts
+++ b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Utility.ts
@@ -109,7 +109,17 @@ class Utility {
       const value = element.value;
 
       if (name) {
-        obj[name] = value;
+        if (element instanceof HTMLInputElement && element.type == 'checkbox') {
+          if (obj[name] === undefined) {
+            obj[name] = [];
+          }
+          if (element.checked){
+            obj[name].push(value);
+          }
+
+        }else{
+          obj[name] = value;
+        }
       }
     });
 
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Utility.js b/typo3/sysext/backend/Resources/Public/JavaScript/Utility.js
index f55519af6de4..fb7375e6b24e 100644
--- a/typo3/sysext/backend/Resources/Public/JavaScript/Utility.js
+++ b/typo3/sysext/backend/Resources/Public/JavaScript/Utility.js
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports"],(function(t,e){"use strict";return class{static trimExplode(t,e){return e.split(t).map(t=>t.trim()).filter(t=>""!==t)}static intExplode(t,e,r=!1){return e.split(t).map(t=>parseInt(t,10)).filter(t=>!isNaN(t)||r&&0===t)}static isNumber(t){return!isNaN(parseFloat(t.toString()))&&isFinite(t)}static getParameterFromUrl(t,e){if("function"!=typeof t.split)return"";const r=t.split("?");let i="";if(r.length>=2){const t=r.join("?"),n=encodeURIComponent(e)+"=",s=t.split(/[&;]/g);for(let t=s.length;t-- >0;)if(-1!==s[t].lastIndexOf(n,0)){i=s[t].split("=")[1];break}}return i}static updateQueryStringParameter(t,e,r){const i=new RegExp("([?&])"+e+"=.*?(&|$)","i"),n=t.includes("?")?"&":"?";return t.match(i)?t.replace(i,"$1"+e+"="+r+"$2"):t+n+e+"="+r}static convertFormToObject(t){const e={};return t.querySelectorAll("input, select, textarea").forEach(t=>{const r=t.name,i=t.value;r&&(e[r]=i)}),e}}}));
\ No newline at end of file
+define(["require","exports"],(function(t,e){"use strict";return class{static trimExplode(t,e){return e.split(t).map(t=>t.trim()).filter(t=>""!==t)}static intExplode(t,e,r=!1){return e.split(t).map(t=>parseInt(t,10)).filter(t=>!isNaN(t)||r&&0===t)}static isNumber(t){return!isNaN(parseFloat(t.toString()))&&isFinite(t)}static getParameterFromUrl(t,e){if("function"!=typeof t.split)return"";const r=t.split("?");let i="";if(r.length>=2){const t=r.join("?"),n=encodeURIComponent(e)+"=",s=t.split(/[&;]/g);for(let t=s.length;t-- >0;)if(-1!==s[t].lastIndexOf(n,0)){i=s[t].split("=")[1];break}}return i}static updateQueryStringParameter(t,e,r){const i=new RegExp("([?&])"+e+"=.*?(&|$)","i"),n=t.includes("?")?"&":"?";return t.match(i)?t.replace(i,"$1"+e+"="+r+"$2"):t+n+e+"="+r}static convertFormToObject(t){const e={};return t.querySelectorAll("input, select, textarea").forEach(t=>{const r=t.name,i=t.value;r&&(t instanceof HTMLInputElement&&"checkbox"==t.type?(void 0===e[r]&&(e[r]=[]),t.checked&&e[r].push(i)):e[r]=i)}),e}}}));
\ No newline at end of file
-- 
GitLab