about summary refs log tree commit diff
path: root/app/javascript/core/settings.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-12-09 16:38:09 +0100
committerGitHub <noreply@github.com>2018-12-09 16:38:09 +0100
commitc6b7b984891413cb1db673df2cbea12f8e6f0f05 (patch)
tree46e3982da219f7a5ac34c3aecaf32f0990578d1d /app/javascript/core/settings.js
parente3682c9c1750e5e7e5d2f817e29f6760a18400ca (diff)
parent4f59d1efd786c08cc63e0c14dceada80c37ab8da (diff)
Merge pull request #849 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/core/settings.js')
-rw-r--r--app/javascript/core/settings.js8
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;
+    }
   }
 });