From 6614d42c6e3aedd51b0e9b2a2bb5d6f0a19fcad0 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Mon, 25 Mar 2019 03:06:19 -0500 Subject: hidden accounts + stats hiding --- app/helpers/stream_entries_helper.rb | 43 ++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb index 6e646ab84..07901889d 100644 --- a/app/helpers/stream_entries_helper.rb +++ b/app/helpers/stream_entries_helper.rb @@ -64,24 +64,33 @@ module StreamEntriesHelper Setting.hide_followers_count || account.user&.setting_hide_followers_count end + def hide_stats?(account) + Setting.hide_stats || account.user&.setting_hide_stats + end + def account_description(account) - prepend_stats = [ - [ - number_to_human(account.statuses_count, strip_insignificant_zeros: true), - I18n.t('accounts.posts', count: account.statuses_count), - ].join(' '), - - [ - number_to_human(account.following_count, strip_insignificant_zeros: true), - I18n.t('accounts.following', count: account.following_count), - ].join(' '), - ] - - unless hide_followers_count?(account) - prepend_stats << [ - number_to_human(account.followers_count, strip_insignificant_zeros: true), - I18n.t('accounts.followers', count: account.followers_count), - ].join(' ') + + if hide_stats?(account) + prepend_stats = [] + else + prepend_stats = [ + [ + number_to_human(account.statuses_count, strip_insignificant_zeros: true), + I18n.t('accounts.posts', count: account.statuses_count), + ].join(' '), + + [ + number_to_human(account.following_count, strip_insignificant_zeros: true), + I18n.t('accounts.following', count: account.following_count), + ].join(' '), + ] + + unless hide_followers_count?(account) + prepend_stats << [ + number_to_human(account.followers_count, strip_insignificant_zeros: true), + I18n.t('accounts.followers', count: account.followers_count), + ].join(' ') + end end [prepend_stats.join(', '), account.note].join(' ยท ') -- cgit