Skip to content

Commit 5e6ebca

Browse files
committed
__removeMeFromCollaborators
1 parent f57884e commit 5e6ebca

File tree

1 file changed

+7
-8
lines changed
  • services/static-webserver/client/source/class/osparc/dashboard

1 file changed

+7
-8
lines changed

services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,18 +1971,17 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
19711971
.finally(() => this.resetSelection());
19721972
},
19731973

1974-
__deleteCollaborator: function(studyData) {
1974+
__removeMeFromCollaborators: function(studyData) {
19751975
const myGid = osparc.auth.Data.getInstance().getGroupId();
19761976
const collabGids = Object.keys(studyData["accessRights"]);
19771977
const amICollaborator = collabGids.indexOf(myGid) > -1;
1978-
19791978
if (collabGids.length > 1 && amICollaborator) {
19801979
const arCopy = osparc.utils.Utils.deepCloneObject(studyData["accessRights"]);
19811980
// remove collaborator
19821981
delete arCopy[myGid];
1983-
// OM here
1984-
operationPromise = osparc.info.StudyUtils.patchStudyData(studyData, "accessRights", arCopy);
1982+
return osparc.info.StudyUtils.patchStudyData(studyData, "accessRights", arCopy);
19851983
}
1984+
return null;
19861985
},
19871986

19881987
__trashStudies: function(studiesData) {
@@ -1996,10 +1995,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
19961995

19971996
let operationPromise = null;
19981997
if (collabGids.length > 1 && amICollaborator) {
1999-
const arCopy = osparc.utils.Utils.deepCloneObject(studyData["accessRights"]);
2000-
// remove collaborator
2001-
delete arCopy[myGid];
2002-
operationPromise = osparc.info.StudyUtils.patchStudyData(studyData, "accessRights", arCopy);
1998+
operationPromise = this.__removeMeFromCollaborators(studyData);
1999+
if (operationPromise === null) {
2000+
return;
2001+
}
20032002
} else {
20042003
// delete study
20052004
operationPromise = osparc.store.Store.getInstance().deleteStudy(studyData.uuid);

0 commit comments

Comments
 (0)