From f786a7aac0884ca05091f041ec78564172a0e344 Mon Sep 17 00:00:00 2001 From: aynsix Date: Fri, 28 May 2021 15:08:18 +0300 Subject: [PATCH] PHRAS-3452 fix remove user --- Phraseanet-production-client/config/config.js | 2 +- .../dist/authenticate.js | 2 +- .../dist/authenticate.min.js | 2 +- Phraseanet-production-client/dist/commons.js | 2 +- .../dist/commons.min.js | 2 +- .../dist/production.js | 45 ++++++++++++++----- .../dist/production.min.js | 45 ++++++++++++++----- .../components/record/recordPush/feedback.js | 45 ++++++++++++++----- .../Phrasea/Twig/PhraseanetExtension.php | 2 +- 9 files changed, 108 insertions(+), 39 deletions(-) diff --git a/Phraseanet-production-client/config/config.js b/Phraseanet-production-client/config/config.js index 151b8e683f..46f6587de3 100644 --- a/Phraseanet-production-client/config/config.js +++ b/Phraseanet-production-client/config/config.js @@ -13,5 +13,5 @@ module.exports = { setupDir: _root + 'tests/setup/node.js', karmaConf: _root + 'config/karma.conf.js', // change this version when you change JS file for lazy loading - jsFileVersion: 19 + jsFileVersion: 20 }; diff --git a/Phraseanet-production-client/dist/authenticate.js b/Phraseanet-production-client/dist/authenticate.js index c8af7e9238..8a649de699 100644 --- a/Phraseanet-production-client/dist/authenticate.js +++ b/Phraseanet-production-client/dist/authenticate.js @@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=19"; +/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=20"; /******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ function onScriptComplete() { diff --git a/Phraseanet-production-client/dist/authenticate.min.js b/Phraseanet-production-client/dist/authenticate.min.js index 40d264c47e..3ddd2408c6 100644 --- a/Phraseanet-production-client/dist/authenticate.min.js +++ b/Phraseanet-production-client/dist/authenticate.min.js @@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=19"; +/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=20"; /******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ function onScriptComplete() { diff --git a/Phraseanet-production-client/dist/commons.js b/Phraseanet-production-client/dist/commons.js index 21f6f7f0a4..25d5eb5a8a 100644 --- a/Phraseanet-production-client/dist/commons.js +++ b/Phraseanet-production-client/dist/commons.js @@ -91,7 +91,7 @@ /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=19"; +/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=20"; /******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ function onScriptComplete() { diff --git a/Phraseanet-production-client/dist/commons.min.js b/Phraseanet-production-client/dist/commons.min.js index 6e0296862f..35e07e44ef 100644 --- a/Phraseanet-production-client/dist/commons.min.js +++ b/Phraseanet-production-client/dist/commons.min.js @@ -91,7 +91,7 @@ /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=19"; +/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=20"; /******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ function onScriptComplete() { diff --git a/Phraseanet-production-client/dist/production.js b/Phraseanet-production-client/dist/production.js index e41fb79a70..d07798bec5 100644 --- a/Phraseanet-production-client/dist/production.js +++ b/Phraseanet-production-client/dist/production.js @@ -60539,6 +60539,26 @@ var Feedback = function Feedback(services, options) { _.each((0, _jquery2.default)('.badges.selectionnable').children(), function (item) { var $elem = (0, _jquery2.default)(item); if ($elem.hasClass('selected')) { + var userEmail = $elem.find('.user-email').val(); + + var action = (0, _jquery2.default)('input[name="feedbackAction"]').val(); + + if (action == 'adduser') { + var value = (0, _jquery2.default)('#newParticipantsUser').val(); + var actualParticipantsName = value.split('; '); + // remove the user in the list of new participant if yet exist + var key = _jquery2.default.inArray(userEmail, actualParticipantsName); + if (key > -1) { + actualParticipantsName.splice(key, 1); + if (actualParticipantsName.length != 0) { + value = actualParticipantsName.join('; '); + (0, _jquery2.default)('#newParticipantsUser').val(value); + } else { + (0, _jquery2.default)('#newParticipantsUser').val(''); + } + } + } + $elem.fadeOut(function () { $elem.remove(); }); @@ -60818,18 +60838,21 @@ var Feedback = function Feedback(services, options) { this.container.on('click', '.user_content .badges .badge .deleter', function (event) { var $elem = (0, _jquery2.default)(this).closest('.badge'); var userEmailEl = $elem.find('.user-email').val(); + var action = (0, _jquery2.default)('input[name="feedbackAction"]').val(); - var value = (0, _jquery2.default)('#newParticipantsUser').val(); - var actualParticipantsName = value.split('; '); - // remove the user in the list of new participant if yet exist - var key = _jquery2.default.inArray(userEmailEl, actualParticipantsName); - if (key > -1) { - actualParticipantsName.splice(key, 1); - if (actualParticipantsName.length != 0) { - value = actualParticipantsName.join('; '); - (0, _jquery2.default)('#newParticipantsUser').val(value); - } else { - (0, _jquery2.default)('#newParticipantsUser').val(''); + if (action == 'adduser') { + var value = (0, _jquery2.default)('#newParticipantsUser').val(); + var actualParticipantsName = value.split('; '); + // remove the user in the list of new participant if yet exist + var key = _jquery2.default.inArray(userEmailEl, actualParticipantsName); + if (key > -1) { + actualParticipantsName.splice(key, 1); + if (actualParticipantsName.length != 0) { + value = actualParticipantsName.join('; '); + (0, _jquery2.default)('#newParticipantsUser').val(value); + } else { + (0, _jquery2.default)('#newParticipantsUser').val(''); + } } } diff --git a/Phraseanet-production-client/dist/production.min.js b/Phraseanet-production-client/dist/production.min.js index e41fb79a70..d07798bec5 100644 --- a/Phraseanet-production-client/dist/production.min.js +++ b/Phraseanet-production-client/dist/production.min.js @@ -60539,6 +60539,26 @@ var Feedback = function Feedback(services, options) { _.each((0, _jquery2.default)('.badges.selectionnable').children(), function (item) { var $elem = (0, _jquery2.default)(item); if ($elem.hasClass('selected')) { + var userEmail = $elem.find('.user-email').val(); + + var action = (0, _jquery2.default)('input[name="feedbackAction"]').val(); + + if (action == 'adduser') { + var value = (0, _jquery2.default)('#newParticipantsUser').val(); + var actualParticipantsName = value.split('; '); + // remove the user in the list of new participant if yet exist + var key = _jquery2.default.inArray(userEmail, actualParticipantsName); + if (key > -1) { + actualParticipantsName.splice(key, 1); + if (actualParticipantsName.length != 0) { + value = actualParticipantsName.join('; '); + (0, _jquery2.default)('#newParticipantsUser').val(value); + } else { + (0, _jquery2.default)('#newParticipantsUser').val(''); + } + } + } + $elem.fadeOut(function () { $elem.remove(); }); @@ -60818,18 +60838,21 @@ var Feedback = function Feedback(services, options) { this.container.on('click', '.user_content .badges .badge .deleter', function (event) { var $elem = (0, _jquery2.default)(this).closest('.badge'); var userEmailEl = $elem.find('.user-email').val(); + var action = (0, _jquery2.default)('input[name="feedbackAction"]').val(); - var value = (0, _jquery2.default)('#newParticipantsUser').val(); - var actualParticipantsName = value.split('; '); - // remove the user in the list of new participant if yet exist - var key = _jquery2.default.inArray(userEmailEl, actualParticipantsName); - if (key > -1) { - actualParticipantsName.splice(key, 1); - if (actualParticipantsName.length != 0) { - value = actualParticipantsName.join('; '); - (0, _jquery2.default)('#newParticipantsUser').val(value); - } else { - (0, _jquery2.default)('#newParticipantsUser').val(''); + if (action == 'adduser') { + var value = (0, _jquery2.default)('#newParticipantsUser').val(); + var actualParticipantsName = value.split('; '); + // remove the user in the list of new participant if yet exist + var key = _jquery2.default.inArray(userEmailEl, actualParticipantsName); + if (key > -1) { + actualParticipantsName.splice(key, 1); + if (actualParticipantsName.length != 0) { + value = actualParticipantsName.join('; '); + (0, _jquery2.default)('#newParticipantsUser').val(value); + } else { + (0, _jquery2.default)('#newParticipantsUser').val(''); + } } } diff --git a/Phraseanet-production-client/src/components/record/recordPush/feedback.js b/Phraseanet-production-client/src/components/record/recordPush/feedback.js index 93cb2d1f78..8e24732541 100644 --- a/Phraseanet-production-client/src/components/record/recordPush/feedback.js +++ b/Phraseanet-production-client/src/components/record/recordPush/feedback.js @@ -82,6 +82,26 @@ const Feedback = function (services, options) { _.each($('.badges.selectionnable').children(), function(item) { var $elem = $(item); if($elem.hasClass('selected')) { + let userEmail = $elem.find('.user-email').val(); + + let action = $('input[name="feedbackAction"]').val(); + + if (action == 'adduser') { + let value = $('#newParticipantsUser').val(); + let actualParticipantsName = value.split('; '); + // remove the user in the list of new participant if yet exist + let key = $.inArray(userEmail, actualParticipantsName); + if (key > -1) { + actualParticipantsName.splice(key, 1); + if (actualParticipantsName.length != 0) { + value = actualParticipantsName.join('; '); + $('#newParticipantsUser').val(value); + } else { + $('#newParticipantsUser').val(''); + } + } + } + $elem.fadeOut(function () { $elem.remove(); }); @@ -369,18 +389,21 @@ const Feedback = function (services, options) { this.container.on('click', '.user_content .badges .badge .deleter', function (event) { var $elem = $(this).closest('.badge'); let userEmailEl = $elem.find('.user-email').val(); + let action = $('input[name="feedbackAction"]').val(); - let value = $('#newParticipantsUser').val(); - let actualParticipantsName = value.split('; '); - // remove the user in the list of new participant if yet exist - let key = $.inArray(userEmailEl, actualParticipantsName); - if (key > -1) { - actualParticipantsName.splice(key, 1); - if (actualParticipantsName.length != 0) { - value = actualParticipantsName.join('; '); - $('#newParticipantsUser').val(value); - } else { - $('#newParticipantsUser').val(''); + if (action == 'adduser') { + let value = $('#newParticipantsUser').val(); + let actualParticipantsName = value.split('; '); + // remove the user in the list of new participant if yet exist + let key = $.inArray(userEmailEl, actualParticipantsName); + if (key > -1) { + actualParticipantsName.splice(key, 1); + if (actualParticipantsName.length != 0) { + value = actualParticipantsName.join('; '); + $('#newParticipantsUser').val(value); + } else { + $('#newParticipantsUser').val(''); + } } } diff --git a/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php b/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php index 44a45e15e0..f05978ec8a 100644 --- a/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php +++ b/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php @@ -59,7 +59,7 @@ class PhraseanetExtension extends \Twig_Extension { return [ // change this version when you change JS file to force the navigation to reload js file - 'jsFileVersion' => 19 + 'jsFileVersion' => 20 ]; }