Skip to content

Commit 3431e8d

Browse files
committed
hideUsername field and message
1 parent ae47f89 commit 3431e8d

File tree

1 file changed

+29
-0
lines changed
  • services/static-webserver/client/source/class/osparc/desktop/account

1 file changed

+29
-0
lines changed

services/static-webserver/client/source/class/osparc/desktop/account/ProfilePage.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
7575
if (privacyData) {
7676
this.__userPrivacyData = privacyData;
7777
this.__userPrivacyModel.set({
78+
"hideUsername": "hideUsername" in privacyData ? privacyData["hideUsername"] : false,
7879
"hideFullname": "hideFullname" in privacyData ? privacyData["hideFullname"] : true,
7980
"hideEmail": "hideEmail" in privacyData ? privacyData["hideEmail"] : true,
8081
});
@@ -224,6 +225,9 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
224225
const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("For Privacy reasons, you might want to hide your First and Last Names and/or the Email to other users"));
225226
box.add(label);
226227

228+
const hideUsername = new qx.ui.form.CheckBox().set({
229+
value: false
230+
});
227231
const hideFullname = new qx.ui.form.CheckBox().set({
228232
value: true
229233
});
@@ -232,18 +236,21 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
232236
});
233237

234238
const form = new qx.ui.form.Form();
239+
form.add(hideUsername, "Hide Username", null, "hideUsername");
235240
form.add(hideFullname, "Hide Full Name", null, "hideFullname");
236241
form.add(hideEmail, "Hide Email", null, "hideEmail");
237242
box.add(new qx.ui.form.renderer.Single(form));
238243

239244
// binding to a model
240245
const raw = {
246+
"hideUsername": false,
241247
"hideFullname": true,
242248
"hideEmail": true,
243249
};
244250

245251
const model = this.__userPrivacyModel = qx.data.marshal.Json.createModel(raw);
246252
const controller = new qx.data.controller.Object(model);
253+
controller.addTarget(hideUsername, "value", "hideUsername", true);
247254
controller.addTarget(hideFullname, "value", "hideFullname", true);
248255
controller.addTarget(hideEmail, "value", "hideEmail", true);
249256

@@ -261,6 +268,9 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
261268
const patchData = {
262269
"privacy": {}
263270
};
271+
if (this.__userPrivacyData["hideUsername"] !== model.getHideUsername()) {
272+
patchData["privacy"]["hideUsername"] = model.getHideUsername();
273+
}
264274
if (this.__userPrivacyData["hideFullname"] !== model.getHideFullname()) {
265275
patchData["privacy"]["hideFullname"] = model.getHideFullname();
266276
}
@@ -296,6 +306,25 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
296306
osparc.FlashMessenger.logError(err, this.tr("Unsuccessful privacy update"));
297307
});
298308
}
309+
310+
const optOutMessage = new qx.ui.basic.Atom().set({
311+
label: "If all searchable fields are showHidden, you will not be ",
312+
icon: "@FontAwesome5Solid/copy/10",
313+
iconPosition: "right",
314+
gap: 8,
315+
cursor: "pointer",
316+
alignX: "center",
317+
allowGrowX: false,
318+
visibility: "excluded",
319+
});
320+
box.add(optOutMessage);
321+
if (
322+
this.__userPrivacyModel.getHideUsername() &&
323+
this.__userPrivacyModel.getHideFullname() &&
324+
this.__userPrivacyModel.getHideEmail()
325+
) {
326+
optOutMessage.show();
327+
}
299328
});
300329

301330
return box;

0 commit comments

Comments
 (0)