Skip to content

Commit aa301bf

Browse files
committed
refactoring
1 parent 0be20ef commit aa301bf

File tree

3 files changed

+6
-19
lines changed

3 files changed

+6
-19
lines changed

services/static-webserver/client/source/class/osparc/data/model/User.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ qx.Class.define("osparc.data.model.User", {
3535
label += " " + qx.lang.String.firstUp(userData["last_name"]);
3636
}
3737
}
38-
const thumbnail = this.self().emailToThumbnail(userData["login"]);
38+
const thumbnail = osparc.utils.Avatar.emailToThumbnail(userData["login"]);
3939
this.set({
4040
userId: userData["id"],
4141
groupId: userData["gid"],
@@ -113,21 +113,4 @@ qx.Class.define("osparc.data.model.User", {
113113
event: "changeThumbnail",
114114
},
115115
},
116-
117-
statics: {
118-
namesToLabel: function(firstName, lastName) {
119-
let label = "";
120-
if (firstName) {
121-
label = osparc.utils.Utils.firstsUp(firstName);
122-
if (lastName) {
123-
label += " " + osparc.utils.Utils.firstsUp(lastName);
124-
}
125-
}
126-
return label;
127-
},
128-
129-
emailToThumbnail: function(email) {
130-
return osparc.utils.Avatar.getUrl(email, 32)
131-
},
132-
}
133116
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ qx.Class.define("osparc.store.Groups", {
9696
groupMe.set({
9797
label: myAuthData.getUsername(),
9898
description: `${myAuthData.getFirstName()} ${myAuthData.getLastName()} - ${myAuthData.getEmail()}`,
99-
thumbnail: osparc.data.model.User.emailToThumbnail(myAuthData.getEmail()),
99+
thumbnail: osparc.utils.Avatar.emailToThumbnail(myAuthData.getEmail()),
100100
})
101101
return orgs;
102102
});

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ qx.Class.define("osparc.utils.Avatar", {
3434
type: "static",
3535

3636
statics: {
37+
emailToThumbnail: function(email) {
38+
return this.getUrl(email, 32)
39+
},
40+
3741
getUrl: function(email = "", size = 100, defIcon = "identicon", rating = "g") {
3842
// MD5 (Message-Digest Algorithm) by WebToolkit
3943
let MD5 = function(s) {

0 commit comments

Comments
 (0)