about summary refs log tree commit diff
path: root/app/javascript/core
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-12-09 13:28:09 +0100
committerThibaut Girka <thib@sitedethib.com>2018-12-09 16:08:04 +0100
commite7f1bfdc2d528f137299ba0c3ab2a30f2f91f53c (patch)
tree2693ffce4d340a9b77a7ca52c856aaae7af8c913 /app/javascript/core
parente3682c9c1750e5e7e5d2f817e29f6760a18400ca (diff)
parent81bda7d67c984c9bfcb5bca94e50cec6405b492e (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/javascript/packs/public.js
- app/models/user.rb
- config/settings.yml
- db/schema.rb

Moved public.js changes to settings.js.
Diffstat (limited to 'app/javascript/core')
-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;
+    }
   }
 });