Skip to content

Commit 5378874

Browse files
committed
refactor
1 parent 8f66b2e commit 5378874

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

services/static-webserver/client/source/class/osparc/info/CommentUI.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,8 @@ qx.Class.define("osparc.info.CommentUI", {
113113

114114
__buildLayout: function() {
115115
const thumbnail = this.getChildControl("thumbnail");
116-
thumbnail.setSource(osparc.utils.Avatar.emailToThumbnail("", "", 32));
117116

118117
const userName = this.getChildControl("user-name");
119-
userName.setValue("Unknown");
120118

121119
const date = new Date(this.__comment["modified"]);
122120
const date2 = osparc.utils.Utils.formatDateAndTime(date);
@@ -131,7 +129,14 @@ qx.Class.define("osparc.info.CommentUI", {
131129
if (user) {
132130
thumbnail.setSource(user.getThumbnail());
133131
userName.setValue(user.getLabel());
132+
} else {
133+
thumbnail.setSource(osparc.utils.Avatar.emailToThumbnail());
134+
userName.setValue("Unknown user");
134135
}
136+
})
137+
.catch(() => {
138+
thumbnail.setSource(osparc.utils.Avatar.emailToThumbnail());
139+
userName.setValue("Unknown user");
135140
});
136141

137142
this.getChildControl("spacer");

services/static-webserver/client/source/class/osparc/utils/Avatar.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@ qx.Class.define("osparc.utils.Avatar", {
3434
type: "static",
3535

3636
statics: {
37-
emailToThumbnail: function(email, username) {
38-
return this.__getUrl(email, username, 32);
39-
},
40-
41-
__getUrl: function(email, username, size = 100) {
42-
email = email || "";
37+
emailToThumbnail: function(email = "", username = "??", size = 32) {
4338
// MD5 (Message-Digest Algorithm) by WebToolkit
4439
const MD5 = function(s) {
4540
function L(k, d) {

0 commit comments

Comments
 (0)