Skip to content

Commit d8ae77e

Browse files
committed
proposeSharing
1 parent 3cb15b7 commit d8ae77e

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

services/static-webserver/client/source/class/osparc/editor/AnnotationNoteCreator.js

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,28 +88,33 @@ qx.Class.define("osparc.editor.AnnotationNoteCreator", {
8888
control.addListener("execute", () => {
8989
const currentStudy = osparc.store.Store.getInstance().getCurrentStudy().serialize();
9090
currentStudy["resourceType"] = "study";
91-
const collaboratorsManager = new osparc.share.NewCollaboratorsManager(currentStudy, false, false);
92-
collaboratorsManager.setCaption("Recipient");
93-
collaboratorsManager.getActionButton().setLabel(this.tr("Add"));
94-
collaboratorsManager.addListener("addCollaborators", e => {
91+
const recipientsManager = new osparc.share.NewCollaboratorsManager(currentStudy, false, false);
92+
recipientsManager.setCaption("Recipient");
93+
recipientsManager.getActionButton().setLabel(this.tr("Add"));
94+
recipientsManager.addListener("addCollaborators", e => {
9595
const {
9696
selectedGids,
9797
} = e.getData();
9898

99-
const currentAccessRights = this.__study.getAccessRights();
100-
const proposeSharing = [];
101-
selectedGids.forEach(selectedGid => {
102-
if (!(parseInt(selectedGid) in currentAccessRights)) {
103-
proposeSharing.push(parseInt(selectedGid));
104-
}
105-
});
106-
if (proposeSharing.length) {
107-
console.log("share?", proposeSharing);
108-
}
109-
11099
if (selectedGids) {
111-
collaboratorsManager.close();
112-
this.__setRecipientGid(parseInt(selectedGids[0]));
100+
const recipientGid = parseInt(selectedGids[0]);
101+
this.__setRecipientGid(recipientGid);
102+
recipientsManager.close();
103+
104+
const currentAccessRights = this.__study.getAccessRights();
105+
const proposeSharing = [];
106+
if (!(parseInt(recipientGid) in currentAccessRights)) {
107+
proposeSharing.push(recipientGid);
108+
}
109+
if (proposeSharing.length) {
110+
console.log("share?", proposeSharing);
111+
const collaboratorsManager = new osparc.share.NewCollaboratorsManager(currentStudy, false);
112+
collaboratorsManager.addListener("addCollaborators", ev => {
113+
const data = ev.getData();
114+
console.log("share asd", data);
115+
collaboratorsManager.close();
116+
});
117+
}
113118
}
114119
}, this);
115120
}, this);

0 commit comments

Comments
 (0)