Skip to content

Commit 5e2c146

Browse files
authored
🐛 bugfix: Copy thumbnail only if exists (ITISFoundation#2548)
* copy thumbnail only if exists * only ask for checkpoints if can read
1 parent 4645475 commit 5e2c146

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

services/web/client/source/class/osparc/data/Permissions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ qx.Class.define("osparc.data.Permissions", {
165165
"user.role.update",
166166
"user.clusters.create",
167167
"study.service.update",
168+
"study.snapshot.read",
168169
"study.snapshot.create",
169170
"study.nodestree.uuid.read",
170171
"study.filestree.uuid.read",

services/web/client/source/class/osparc/data/model/Study.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ qx.Class.define("osparc.data.model.Study", {
232232

233233
getSnapshots: function(studyId) {
234234
return new Promise((resolve, reject) => {
235+
if (!osparc.data.Permissions.getInstance().canDo("study.snapshot.read")) {
236+
reject();
237+
return;
238+
}
235239
const params = {
236240
url: {
237241
"studyId": studyId
@@ -254,9 +258,8 @@ qx.Class.define("osparc.data.model.Study", {
254258
.then(snapshots => {
255259
resolve(Boolean(snapshots.length));
256260
})
257-
.catch(err => {
258-
console.error(err);
259-
reject(err);
261+
.catch(() => {
262+
resolve(false);
260263
});
261264
});
262265
}

services/web/client/source/class/osparc/utils/Study.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ qx.Class.define("osparc.utils.Study", {
4141
const newUuid = osparc.utils.Utils.uuidv4();
4242
const minStudyData = osparc.data.model.Study.createMyNewStudyObject();
4343
minStudyData["name"] = service["name"];
44-
minStudyData["thumbnail"] = service["thumbnail"];
44+
if (service["thumbnail"]) {
45+
minStudyData["thumbnail"] = service["thumbnail"];
46+
}
4547
minStudyData["workbench"][newUuid] = {
4648
"key": service["key"],
4749
"version": service["version"],

0 commit comments

Comments
 (0)