Skip to content

Commit 5b1f839

Browse files
committed
__updateCurrentStudyAccessRights
1 parent 9d0f24e commit 5b1f839

File tree

1 file changed

+13
-0
lines changed
  • services/static-webserver/client/source/class/osparc/store

1 file changed

+13
-0
lines changed

services/static-webserver/client/source/class/osparc/store/Study.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,16 @@ qx.Class.define("osparc.store.Study", {
380380
});
381381
},
382382

383+
__updateCurrentStudyAccessRights: function(updatedStudyData) {
384+
const currentStudy = osparc.store.Store.getInstance().getCurrentStudy();
385+
if (currentStudy && currentStudy.getUuid() === updatedStudyData["uuid"]) {
386+
currentStudy.set({
387+
accessRights: updatedStudyData["accessRights"],
388+
lastChangeDate: new Date(updatedStudyData["lastChangeDate"]),
389+
});
390+
}
391+
},
392+
383393
addCollaborators: function(studyData, newCollaborators) {
384394
const promises = [];
385395
Object.keys(newCollaborators).forEach(gid => {
@@ -398,6 +408,7 @@ qx.Class.define("osparc.store.Study", {
398408
studyData["accessRights"][gid] = newCollaborators[gid];
399409
});
400410
studyData["lastChangeDate"] = new Date().toISOString();
411+
this.__updateCurrentStudyAccessRights(studyData);
401412
})
402413
.catch(err => {
403414
osparc.FlashMessenger.logError(err);
@@ -416,6 +427,7 @@ qx.Class.define("osparc.store.Study", {
416427
.then(() => {
417428
delete studyData["accessRights"][gid];
418429
studyData["lastChangeDate"] = new Date().toISOString();
430+
this.__updateCurrentStudyAccessRights(studyData);
419431
})
420432
.catch(err => {
421433
osparc.FlashMessenger.logError(err);
@@ -435,6 +447,7 @@ qx.Class.define("osparc.store.Study", {
435447
.then(() => {
436448
studyData["accessRights"][gid] = newPermissions;
437449
studyData["lastChangeDate"] = new Date().toISOString();
450+
this.__updateCurrentStudyAccessRights(studyData);
438451
})
439452
.catch(err => {
440453
osparc.FlashMessenger.logError(err);

0 commit comments

Comments
 (0)