From: Thibaut Girka Date: Thu, 4 Apr 2019 12:53:52 +0000 (+0200) Subject: Merge branch 'master' into glitch-soc/merge-upstream X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=1682ac571763f473da54074b0608cd9ccb4b9ae5;p=mastodon.git Merge branch 'master' into glitch-soc/merge-upstream Conflicts: - app/controllers/following_accounts_controller.rb Conflicts were due to glitch-soc's theming system. - app/javascript/packs/public.js Some code has been change upstream, but it has been moved to app/javascript/core/settings.js in glitch-soc. Applied the changes there. --- 1682ac571763f473da54074b0608cd9ccb4b9ae5 diff --cc Gemfile.lock index 620651983,22bb2adc2..a4b76c796 --- a/Gemfile.lock +++ b/Gemfile.lock @@@ -254,11 -254,9 +254,11 @@@ GE hashdiff (0.3.7) hashie (3.6.0) heapy (0.1.4) - highline (2.0.0) + highline (2.0.1) hiredis (0.6.3) hkdf (0.3.0) + html2text (0.2.1) + nokogiri (~> 1.6) htmlentities (4.3.4) http (3.3.0) addressable (~> 2.3) diff --cc app/controllers/following_accounts_controller.rb index 098b2a20c,1bfd901cf..181f85221 --- a/app/controllers/following_accounts_controller.rb +++ b/app/controllers/following_accounts_controller.rb @@@ -6,7 -8,7 +8,8 @@@ class FollowingAccountsController < App def index respond_to do |format| format.html do + use_pack 'public' + mark_cacheable! unless user_signed_in? next if @account.user_hides_network? diff --cc app/javascript/core/settings.js index af97fb25f,000000000..e0cb944e0 mode 100644,000000..100644 --- a/app/javascript/core/settings.js +++ b/app/javascript/core/settings.js @@@ -1,66 -1,0 +1,74 @@@ +// 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) { + if (target.value) { + name.innerHTML = emojify(escapeTextContentForBrowser(target.value)); + } else { + name.textContent = document.querySelector('#default_account_display_name').textContent; + } + } +}); + +delegate(document, '#account_avatar', 'change', ({ target }) => { + const avatar = document.querySelector('.card .avatar img'); + const [file] = target.files || []; + const url = file ? URL.createObjectURL(file) : avatar.dataset.originalSrc; + + avatar.src = url; +}); + +delegate(document, '#account_header', 'change', ({ target }) => { + const header = document.querySelector('.card .card__img img'); + const [file] = target.files || []; + const url = file ? URL.createObjectURL(file) : header.dataset.originalSrc; + + 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'; + } +}); + +delegate(document, '.input-copy input', 'click', ({ target }) => { ++ target.focus(); + target.select(); ++ target.setSelectionRange(0, target.value.length); +}); + +delegate(document, '.input-copy button', 'click', ({ target }) => { + const input = target.parentNode.querySelector('.input-copy__wrapper input'); + ++ const oldReadOnly = input.readonly; ++ ++ input.readonly = false; + input.focus(); + input.select(); ++ input.setSelectionRange(0, input.value.length); + + try { + if (document.execCommand('copy')) { + input.blur(); + target.parentNode.classList.add('copied'); + + setTimeout(() => { + target.parentNode.classList.remove('copied'); + }, 700); + } + } catch (err) { + console.error(err); + } ++ ++ input.readonly = oldReadOnly; +});