about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2020-06-26 13:02:14 +0200
committerThibaut Girka <thib@sitedethib.com>2020-06-26 13:02:14 +0200
commita01674fb2b4eb210b300b380899d388b0807999a (patch)
treed497e4b75d85ad5e8dd29416775730d29e13f79d /app/helpers
parent8f4aff9b6fe638b26b9d0bf0fe4151c2cc214d6d (diff)
parent08cf81f8c1b445eba9972214869c376fe6097efb (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb12
-rw-r--r--app/helpers/statuses_helper.rb4
2 files changed, 15 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 2f11ccb6f..9ca11d573 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -77,6 +77,18 @@ module ApplicationHelper
     content_tag(:i, nil, attributes.merge(class: class_names.join(' ')))
   end
 
+  def visibility_icon(status)
+    if status.public_visibility?
+      fa_icon('globe', title: I18n.t('statuses.visibilities.public'))
+    elsif status.unlisted_visibility?
+      fa_icon('unlock', title: I18n.t('statuses.visibilities.unlisted'))
+    elsif status.private_visibility? || status.limited_visibility?
+      fa_icon('lock', title: I18n.t('statuses.visibilities.private'))
+    elsif status.direct_visibility?
+      fa_icon('envelope', title: I18n.t('statuses.visibilities.direct'))
+    end
+  end
+
   def custom_emoji_tag(custom_emoji, animate = true)
     if animate
       image_tag(custom_emoji.image.url, class: 'emojione', alt: ":#{custom_emoji.shortcode}:")
diff --git a/app/helpers/statuses_helper.rb b/app/helpers/statuses_helper.rb
index 866a9902c..a51597cf3 100644
--- a/app/helpers/statuses_helper.rb
+++ b/app/helpers/statuses_helper.rb
@@ -15,11 +15,13 @@ module StatusesHelper
   end
 
   def media_summary(status)
-    attachments = { image: 0, video: 0 }
+    attachments = { image: 0, video: 0, audio: 0 }
 
     status.media_attachments.each do |media|
       if media.video?
         attachments[:video] += 1
+      elsif media.audio?
+        attachments[:audio] += 1
       else
         attachments[:image] += 1
       end