diff options
Diffstat (limited to 'app/javascript/core')
-rw-r--r-- | app/javascript/core/settings.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/javascript/core/settings.js b/app/javascript/core/settings.js index 23a303747..af97fb25f 100644 --- a/app/javascript/core/settings.js +++ b/app/javascript/core/settings.js @@ -1,13 +1,17 @@ // This file will be loaded on settings pages, regardless of theme. +import escapeTextContentForBrowser from 'escape-html'; const { delegate } = require('rails-ujs'); import emojify from '../mastodon/features/emoji/emoji'; delegate(document, '#account_display_name', 'input', ({ target }) => { const name = document.querySelector('.card .display-name strong'); - if (name) { - name.innerHTML = emojify(target.value); + if (target.value) { + name.innerHTML = emojify(escapeTextContentForBrowser(target.value)); + } else { + name.textContent = document.querySelector('#default_account_display_name').textContent; + } } }); |