From 587f74456b2fc486466527ac264e282499a2c889 Mon Sep 17 00:00:00 2001 From: Odei Maiz <33152403+odeimaiz@users.noreply.github.com> Date: Wed, 14 Aug 2024 08:39:59 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20[Frontend]=20Fix:=20exclude=20th?= =?UTF-8?q?e=20share=20with=20product-everyone=20group=20for=20studies=20(?= =?UTF-8?q?#6183)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/source/class/osparc/share/AddCollaborators.js | 6 +----- .../client/source/class/osparc/share/Collaborators.js | 5 ++++- .../client/source/class/osparc/share/PublishTemplate.js | 1 - .../client/source/class/osparc/store/Store.js | 7 ++++++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/share/AddCollaborators.js b/services/static-webserver/client/source/class/osparc/share/AddCollaborators.js index c4a8074e556..dea8508408f 100644 --- a/services/static-webserver/client/source/class/osparc/share/AddCollaborators.js +++ b/services/static-webserver/client/source/class/osparc/share/AddCollaborators.js @@ -31,7 +31,7 @@ qx.Class.define("osparc.share.AddCollaborators", { construct: function(serializedDataCopy) { this.base(arguments); - this.setSerializedDataCopy(serializedDataCopy); + this.__serializedDataCopy = serializedDataCopy; this._setLayout(new qx.ui.layout.VBox(5)); @@ -72,10 +72,6 @@ qx.Class.define("osparc.share.AddCollaborators", { return control || this.base(arguments, id); }, - setSerializedDataCopy: function(serializedDataCopy) { - this.__serializedDataCopy = serializedDataCopy; - }, - __buildLayout: function() { this.getChildControl("intro-text"); diff --git a/services/static-webserver/client/source/class/osparc/share/Collaborators.js b/services/static-webserver/client/source/class/osparc/share/Collaborators.js index 47b84ef84cd..57d3b53bc59 100644 --- a/services/static-webserver/client/source/class/osparc/share/Collaborators.js +++ b/services/static-webserver/client/source/class/osparc/share/Collaborators.js @@ -233,7 +233,10 @@ qx.Class.define("osparc.share.Collaborators", { }, __createAddCollaboratorSection: function() { - const addCollaborators = new osparc.share.AddCollaborators(this._serializedDataCopy); + const serializedDataCopy = osparc.utils.Utils.deepCloneObject(this._serializedDataCopy); + // pass resourceType, so that, it it's a template testers can share it with product everyone + serializedDataCopy["resourceType"] = this._resourceType; + const addCollaborators = new osparc.share.AddCollaborators(serializedDataCopy); addCollaborators.addListener("addCollaborators", e => this._addEditors(e.getData()), this); return addCollaborators; }, diff --git a/services/static-webserver/client/source/class/osparc/share/PublishTemplate.js b/services/static-webserver/client/source/class/osparc/share/PublishTemplate.js index 00cc5ac4832..6572c24a900 100644 --- a/services/static-webserver/client/source/class/osparc/share/PublishTemplate.js +++ b/services/static-webserver/client/source/class/osparc/share/PublishTemplate.js @@ -54,7 +54,6 @@ qx.Class.define("osparc.share.PublishTemplate", { font: "text-14" }); this._add(addCollaborators); - addCollaborators.setSerializedDataCopy(this.__potentialTemplateData); this._add(this.__selectedCollabs); diff --git a/services/static-webserver/client/source/class/osparc/store/Store.js b/services/static-webserver/client/source/class/osparc/store/Store.js index 4760436b0de..3e211ccfa7c 100644 --- a/services/static-webserver/client/source/class/osparc/store/Store.js +++ b/services/static-webserver/client/source/class/osparc/store/Store.js @@ -559,9 +559,15 @@ qx.Class.define("osparc.store.Store", { .then(values => { const orgs = values[0]; // array const members = values[1]; // object + const productEveryone = values[2]; // entry const potentialCollaborators = {}; orgs.forEach(org => { if (org["accessRights"]["read"]) { + // maybe because of migration script, some users have access to the product everyone group + // rely on the includeProductEveryone argument to exclude it if necessary + if (org["gid"] === productEveryone["gid"] && !includeProductEveryone) { + return; + } org["collabType"] = 1; potentialCollaborators[org["gid"]] = org; } @@ -580,7 +586,6 @@ qx.Class.define("osparc.store.Store", { "collabType": 2 }; } - const productEveryone = values[2]; // entry if (includeProductEveryone && productEveryone) { productEveryone["collabType"] = 0; potentialCollaborators[productEveryone["gid"]] = productEveryone;