Skip to content

Commit 4954a6e

Browse files
committed
userDataToDescription
1 parent 0be79f9 commit 4954a6e

File tree

2 files changed

+15
-8
lines changed
  • services/static-webserver/client/source/class/osparc

2 files changed

+15
-8
lines changed

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,7 @@ qx.Class.define("osparc.data.model.User", {
4444
} else if (userData["lastName"]) {
4545
lastName = userData["lastName"];
4646
}
47-
let description = [firstName, lastName].join(" ").trim(); // the null values will be replaced by empty strings
48-
if (email) {
49-
if (description) {
50-
description += " - "
51-
}
52-
description += email;
53-
}
47+
const description = osparc.data.model.User.userDataToDescription(firstName, lastName, email);
5448

5549
this.set({
5650
userId,
@@ -142,6 +136,18 @@ qx.Class.define("osparc.data.model.User", {
142136
},
143137
},
144138

139+
statics: {
140+
userDataToDescription: function(firstName, lastName, email) {
141+
let description = [(firstName || ""), (lastName || "")].join(" ").trim(); // the null values will be replaced by empty strings
142+
if (email) {
143+
if (description) {
144+
description += " - "
145+
}
146+
description += email;
147+
}
148+
}
149+
},
150+
145151
members: {
146152
createThumbnail: function(size) {
147153
return osparc.utils.Avatar.emailToThumbnail(this.getEmail(), this.getUsername(), size);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ qx.Class.define("osparc.store.Groups", {
9999
this.setOrganizations(orgs);
100100
this.setGroupMe(groupMe);
101101
const myAuthData = osparc.auth.Data.getInstance();
102+
const description = osparc.data.model.User.userDataToDescription(myAuthData.getFirstName(), myAuthData.getLastName(), myAuthData.getEmail());
102103
groupMe.set({
103104
label: myAuthData.getUsername(),
104-
description: `${myAuthData.getFirstName()} ${myAuthData.getLastName()} - ${myAuthData.getEmail()}`,
105+
description: description,
105106
thumbnail: osparc.utils.Avatar.emailToThumbnail(myAuthData.getEmail(), myAuthData.getUsername()),
106107
})
107108
return orgs;

0 commit comments

Comments
 (0)