#40342 closed enhancement (fixed)
Update name in toolbar when changing user display name
Reported by: | swissspidy | Owned by: | adamsilverstein |
---|---|---|---|
Milestone: | 4.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Users | Keywords: | good-first-bug has-patch needs-testing |
Focuses: | ui, administration | Cc: |
Description
When changing the site name in Settings -> General, the name displayed in the toolbar changes automatically using JavaScript. When changing your name in your user profile, the display name choice updates as well (#5691).
Now, I think we should also update the toolbar when changing the display name. So, when I change my display name from "John" to "John Doe", the toolbar should change from "Howdy, John" to "Howdy, John Doe". Currently, this only happens after saving.
Attachments (4)
Change History (18)
#2
@
8 years ago
40342.patch The patch applies cleanly and fixes that issue.
#3
@
8 years ago
It makes more sense to put this into user-profile.js
in my opinion. Also, although I like using plain old JavaScript, I think we can use the JQuery functions instead of innerHTML
.
#4
@
8 years ago
Agree with @swissspidy, new patch moves the logic to user-profile.js
and uses jQuery since it's already there
#5
@
8 years ago
Yeah that's much more like what I had anticipated.
The only drawback to 40342.diff is that it also changes the name when you're editing the profile of someone who's got the same name as you, because it's just a simple search & replace.
#6
@
8 years ago
40342.2.patch Applies cleanly.
#8
@
8 years ago
- Owner set to adamsilverstein
- Status changed from new to assigned
@maguiar & @menakas Thanks for your patch here!
I'm a little concerned by the use of .html()
here because its content gets evaluated presenting a potential XSS vector. testing this I wasn’t able to exploit, however it would be better to replace only the inner name part with .text()
which isn't evaluated, do you think that is possible? we can add an additional span wrapper in the html if you need a way to target the inner name part.
#9
@
8 years ago
Added 40342.2.diff which adds a span class to the howdy message, accounting for translations. Replaced .html method with .text and removed unnecessary code from the JS that is handled by the new span.
Added javascript to change Greeting name when display name dropdown is changed.