about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-08-30 13:38:41 +0200
committerThibaut Girka <thib@sitedethib.com>2019-08-30 13:38:41 +0200
commit9044a2b051da18e9f70fd4fae55c2bd232891d1f (patch)
tree0bf32b0fa0e854f75e50c1dee05ec41f6b301bf4 /app/helpers
parent2848c08953a8555e06791170dbf1090575e05d8a (diff)
parent49f57b55346f8e62d21a3c8bc63301038ecb796f (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/views/directories/index.html.haml
  Upstream has redesigned the profile directory, and we
  had a glitch-soc-specific change to hide follower counts.
  Ported that change to the new design.
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/statuses_helper.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/helpers/statuses_helper.rb b/app/helpers/statuses_helper.rb
index 2996631a3..880a4037f 100644
--- a/app/helpers/statuses_helper.rb
+++ b/app/helpers/statuses_helper.rb
@@ -34,6 +34,26 @@ module StatusesHelper
     end
   end
 
+  def minimal_account_action_button(account)
+    if user_signed_in?
+      return if account.id == current_user.account_id
+
+      if current_account.following?(account) || current_account.requested?(account)
+        link_to account_unfollow_path(account), class: 'icon-button active', data: { method: :post }, title: t('accounts.unfollow') do
+          fa_icon('user-times fw')
+        end
+      elsif !(account.memorial? || account.moved?)
+        link_to account_follow_path(account), class: "icon-button#{account.blocking?(current_account) ? ' disabled' : ''}", data: { method: :post }, title: t('accounts.follow') do
+          fa_icon('user-plus fw')
+        end
+      end
+    elsif !(account.memorial? || account.moved?)
+      link_to account_remote_follow_path(account), class: 'icon-button modal-button', target: '_new', title: t('accounts.follow') do
+        fa_icon('user-plus fw')
+      end
+    end
+  end
+
   def svg_logo
     content_tag(:svg, tag(:use, 'xlink:href' => '#mastodon-svg-logo'), 'viewBox' => '0 0 216.4144 232.00976')
   end