From 9e14647df89405773159296381623a38052c723c Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 1 Jul 2020 13:51:50 +0200 Subject: [PATCH] Fix lock icon not being shown when locking account in profile settings (#14190) --- app/javascript/packs/public.js | 10 ++++++---- app/javascript/styles/mastodon/accounts.scss | 4 ++++ app/views/application/_card.html.haml | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index 557823c96d..08cc662e60 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -207,10 +207,12 @@ function main() { 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'; + if (lock) { + if (target.checked) { + delete lock.dataset.hidden; + } else { + lock.dataset.hidden = 'true'; + } } }); diff --git a/app/javascript/styles/mastodon/accounts.scss b/app/javascript/styles/mastodon/accounts.scss index 5dc067f0e8..2c78e81be2 100644 --- a/app/javascript/styles/mastodon/accounts.scss +++ b/app/javascript/styles/mastodon/accounts.scss @@ -76,6 +76,10 @@ margin-left: 15px; text-align: left; + i[data-hidden] { + display: none; + } + strong { font-size: 15px; color: $primary-text-color; diff --git a/app/views/application/_card.html.haml b/app/views/application/_card.html.haml index e7ecfecd9a..909d9ff818 100644 --- a/app/views/application/_card.html.haml +++ b/app/views/application/_card.html.haml @@ -13,4 +13,4 @@ %strong.emojify.p-name= display_name(account, custom_emojify: true) %span = acct(account) - = fa_icon('lock') if account.locked? + = fa_icon('lock', { :data => ({hidden: true} unless account.locked?)})