Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
decode user display name in dashboard greeting
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
Julien Veyssier committed Mar 22, 2021
commit 178f28fb781dd0f8cb82bca3702772c38eb635f2
7 changes: 6 additions & 1 deletion apps/dashboard/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default {

// Figure out which greeting to show
const shouldShowName = this.displayName && this.uid !== this.displayName
return { text: shouldShowName ? good[partOfDay].withName : good[partOfDay].generic }
return { text: shouldShowName ? this.htmlDecode(good[partOfDay].withName) : good[partOfDay].generic }
},
isActive() {
return (panel) => this.layout.indexOf(panel.id) > -1
Expand Down Expand Up @@ -396,6 +396,11 @@ export default {
document.body.classList.remove('dashboard--scrolled')
}
},
htmlDecode(s) {
return s.replace(/&#(\d+);/g, (match, code) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we have a lib for it?
I would prefer not to have random pieces of code here and there?

https://www.npmjs.com/package/html-entities

"escape-html": "^1.0.3",

html-entities seems a bit big, but we have to see what real size is being added to the webpack bundle?

return String.fromCharCode(code)
})
},
},
}
</script>
Expand Down