File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
services/static-webserver/client/source/class/osparc/desktop Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -83,17 +83,15 @@ qx.Class.define("osparc.desktop.MainPageHandler", {
8383 const studyAlias = osparc . product . Utils . getStudyAlias ( { firstUpperCase : true } ) ;
8484 // check if it's locked
8585 let locked = false ;
86- let lockedBy = false ;
87- if ( "state" in studyData && "shareState" in studyData [ "state" ] ) {
88- locked = studyData [ "state" ] [ "shareState" ] [ "locked" ] ;
89- lockedBy = studyData [ "state" ] [ "shareState" ] [ "currentUserGroupids" ] ;
86+ let lockedBy = [ ] ;
87+ if ( "state" in studyData ) {
88+ const state = studyData [ "state" ] ;
89+ locked = osparc . study . Utils . state . isProjectLocked ( state ) ;
90+ const currentUserGroupIds = osparc . study . Utils . state . getCurrentGroupIds ( state ) ;
91+ lockedBy = currentUserGroupIds . filter ( gid => gid !== osparc . store . Groups . getInstance ( ) . getMyGroupId ( ) ) ;
9092 }
91- if ( locked && lockedBy [ "user_id" ] !== osparc . auth . Data . getInstance ( ) . getUserId ( ) ) {
92- const msg = `${ studyAlias } ${ qx . locale . Manager . tr ( "is already open by" ) } ${ // it will be replaced "userName"
93- "first_name" in lockedBy && lockedBy [ "first_name" ] != null ?
94- lockedBy [ "first_name" ] :
95- qx . locale . Manager . tr ( "another user." )
96- } `;
93+ if ( locked && lockedBy . length ) {
94+ const msg = `${ studyAlias } ${ qx . locale . Manager . tr ( "is already open by another user." ) } ` ;
9795 throw new Error ( msg ) ;
9896 }
9997
You can’t perform that action at this time.
0 commit comments