about summary refs log tree commit diff
path: root/app/javascript/core/settings.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-07-31 22:21:15 +0200
committerThibaut Girka <thib@sitedethib.com>2018-08-01 00:18:13 +0200
commitc1c514ca703f3e11adfe41734345b5277e886c50 (patch)
treed8e088898292ca6da0f979b9244781b2ce116c7e /app/javascript/core/settings.js
parent88b593a63ff3d607d6f98553654c46bc7cfc0b7b (diff)
parent13ac8ca66ab01c92e4ebcc7221efb3d474c9fd0b (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Manually-resolved conflicts:
	.circleci/config.yml
	app/controllers/accounts_controller.rb
	app/controllers/auth/passwords_controller.rb
	app/controllers/statuses_controller.rb
	app/javascript/packs/public.js
	app/models/media_attachment.rb
	app/views/stream_entries/_content_spoiler.html.haml
	app/views/stream_entries/_media.html.haml
	config/locales/en.yml
	config/locales/ja.yml
	config/locales/pl.yml
	lib/mastodon/version.rb

Some content from app/javascript/packs/public.js has been split to
app/javascript/core/settings.js.

Translation strings for glitch-soc's keyword mutes were dropped.

Everything else was mostly “take both”.
Diffstat (limited to 'app/javascript/core/settings.js')
-rw-r--r--app/javascript/core/settings.js27
1 files changed, 21 insertions, 6 deletions
diff --git a/app/javascript/core/settings.js b/app/javascript/core/settings.js
index 1add0314d..175a1758f 100644
--- a/app/javascript/core/settings.js
+++ b/app/javascript/core/settings.js
@@ -3,24 +3,29 @@
 const { length } = require('stringz');
 const { delegate } = require('rails-ujs');
 
-delegate(document, '.account_display_name', 'input', ({ target }) => {
+delegate(document, '#account_display_name', 'input', ({ target }) => {
   const nameCounter = document.querySelector('.name-counter');
+  const name        = document.querySelector('.card .display-name strong');
 
   if (nameCounter) {
     nameCounter.textContent = 30 - length(target.value);
   }
+
+  if (name) {
+    name.innerHTML = emojify(target.value);
+  }
 });
 
-delegate(document, '.account_note', 'input', ({ target }) => {
+delegate(document, '#account_note', 'input', ({ target }) => {
   const noteCounter = document.querySelector('.note-counter');
 
   if (noteCounter) {
-    noteCounter.textContent = 500 - length(target.value);
+    noteCounter.textContent = 160 - length(target.value);
   }
 });
 
 delegate(document, '#account_avatar', 'change', ({ target }) => {
-  const avatar = document.querySelector('.card.compact .avatar img');
+  const avatar = document.querySelector('.card .avatar img');
   const [file] = target.files || [];
   const url = file ? URL.createObjectURL(file) : avatar.dataset.originalSrc;
 
@@ -28,9 +33,19 @@ delegate(document, '#account_avatar', 'change', ({ target }) => {
 });
 
 delegate(document, '#account_header', 'change', ({ target }) => {
-  const header = document.querySelector('.card.compact');
+  const header = document.querySelector('.card .card__img img');
   const [file] = target.files || [];
   const url = file ? URL.createObjectURL(file) : header.dataset.originalSrc;
 
-  header.style.backgroundImage = `url(${url})`;
+  header.src = url;
+});
+
+delegate(document, '#account_locked', 'change', ({ target }) => {
+  const lock = document.querySelector('.card .display-name i');
+
+  if (target.checked) {
+    lock.style.display = 'inline';
+  } else {
+    lock.style.display = 'none';
+  }
 });