Skip to content

Commit 989b518

Browse files
authored
fix: set public profile name after login (#7892)
* adding frontend ans server version on admin page * set public profile name after login * set public profile name after login * setting afterModel hook with timeOut * reduce timeout time
1 parent 07426cc commit 989b518

File tree

5 files changed

+57
-15
lines changed

5 files changed

+57
-15
lines changed

app/components/modals/confirm-modal.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ export default ModalBase.extend({
77
},
88

99
actions: {
10+
savePublicName() {
11+
this.authManager.currentUser.save();
12+
this.confirm.pendingPromise?.resolve();
13+
this.set('isOpen', false);
14+
},
15+
1016
deny() {
1117
if (this.confirm.pendingPromise.reject) {
1218
this.confirm.pendingPromise.reject();

app/helpers/confirm.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ export default Helper.extend({
1515
.then(() => {
1616
params[1](...arguments);
1717
});
18+
} else if (params[1] === 'publicName') {
19+
confirm.prompt(params[0], { 'publicName': true })
20+
.then(() => {
21+
params[1](...arguments);
22+
});
1823
} else if (params.length >= 6) {
1924
confirm.prompt('Are You Sure?', { 'denyText': params[2], 'approveText': params[3], 'denyColor': params[4], 'approveColor': params[5], 'extra': params[0] })
2025
.then(() => {

app/routes/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export default class IndexRoute extends Route {
171171
}
172172
];
173173

174+
174175
return hash({
175176
filteredEvents: this.store.query('event', {
176177
upcoming : true,
@@ -196,6 +197,20 @@ export default class IndexRoute extends Route {
196197
'page[size]' : 6
197198
})
198199
});
200+
201+
}
202+
203+
async afterModel() {
204+
const prevRoute = this.session.currentRouteName;
205+
setTimeout(() => {
206+
if (this.session.isAuthenticated && this.session.currentRouteName === 'index' && prevRoute === 'login' && !this.authManager.currentUser.publicName) {
207+
try {
208+
this.confirm.prompt(this.l10n.t('You have not set a Public Profile Name yet. A public name is displayed on user profiles and video sessions instead of a fantasy name. You can change it later on your account page. Please set your public name now.'), { 'publicName': true });
209+
} catch {
210+
console.warn('User public profile name not set.');
211+
}
212+
}
213+
}, 2000);
199214
}
200215

201216
setupController(controller, model) {

app/templates/components/forms/user-profile-form.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<UiPopup
4949
@tagName="i"
5050
@class="info circle icon"
51-
@content={{'Public profile name, if set, is displayed to other users on profiles and video sessions instead of real name.'}} />
51+
@content={{'Public profile name, if set, is displayed to other users on profiles and video sessions instead of a fantasy name.'}} />
5252
</label>
5353
<Input
5454
@type="text"

app/templates/components/modals/confirm-modal.hbs

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,35 @@
66
{{sanitize this.confirm.options.extra}}
77
</div>
88
{{/if}}
9-
<div class="actions">
10-
{{#if this.confirm.options.infoModal}}
11-
<button type="button" class="ui blue button" {{action 'deny'}}>
12-
{{t 'Ok'}}
9+
{{#if this.confirm.options.publicName}}
10+
<div class="content">
11+
<div class="field ui fluid input">
12+
<Input type="text" @id="public_name" placeholder={{t "Public Profile Name"}} @value={{this.authManager.currentUser.publicName}}/>
13+
</div>
14+
</div>
15+
<div class="actions">
16+
<button type="button" class="ui green button" {{action 'savePublicName'}}>
17+
{{t 'Save'}}
1318
</button>
14-
{{else}}
15-
{{#unless this.confirm.options.hideDeny}}
16-
<button type="button" class="ui {{if this.confirm.options.denyText this.confirm.options.denyColor 'black'}} button" {{action 'deny'}}>
17-
{{if this.confirm.options.denyText this.confirm.options.denyText (t 'No')}}
18-
</button>
19-
{{/unless}}
20-
<button type="button" class="ui {{if this.confirm.options.denyText this.confirm.options.approveColor 'green'}} button" {{action 'confirm'}}>
21-
{{if this.confirm.options.approveText this.confirm.options.approveText (t 'Yes')}}
19+
<button type="button" class="ui black button" {{action 'deny'}}>
20+
{{t 'Cancel'}}
2221
</button>
23-
{{/if}}
24-
</div>
22+
</div>
23+
{{else}}
24+
<div class="actions">
25+
{{#if this.confirm.options.infoModal}}
26+
<button type="button" class="ui blue button" {{action 'deny'}}>
27+
{{t 'Ok'}}
28+
</button>
29+
{{else}}
30+
{{#unless this.confirm.options.hideDeny}}
31+
<button type="button" class="ui {{if this.confirm.options.denyText this.confirm.options.denyColor 'black'}} button" {{action 'deny'}}>
32+
{{if this.confirm.options.denyText this.confirm.options.denyText (t 'No')}}
33+
</button>
34+
{{/unless}}
35+
<button type="button" class="ui {{if this.confirm.options.denyText this.confirm.options.approveColor 'green'}} button" {{action 'confirm'}}>
36+
{{if this.confirm.options.approveText this.confirm.options.approveText (t 'Yes')}}
37+
</button>
38+
{{/if}}
39+
</div>
40+
{{/if}}

0 commit comments

Comments
 (0)