about summary refs log tree commit diff
path: root/app/helpers/stream_entries_helper.rb
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-03-25 03:06:19 -0500
committermultiple creatures <dev@multiple-creature.party>2019-05-21 03:16:21 -0500
commit6614d42c6e3aedd51b0e9b2a2bb5d6f0a19fcad0 (patch)
tree35c345b0d67cd385fd606060848ee15a0f00620f /app/helpers/stream_entries_helper.rb
parent90d2280dfec9c2fa3a257b89ea3dfb557168f2d3 (diff)
hidden accounts + stats hiding
Diffstat (limited to 'app/helpers/stream_entries_helper.rb')
-rw-r--r--app/helpers/stream_entries_helper.rb43
1 files changed, 26 insertions, 17 deletions
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(' · ')