about summary refs log tree commit diff
path: root/app/helpers/statuses_helper.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-08-30 07:41:16 +0200
committerGitHub <noreply@github.com>2019-08-30 07:41:16 +0200
commit987190417228bb56041ea824772341f07f4263d6 (patch)
treea5619e3af1fee7d8d841015de5f530a04373b363 /app/helpers/statuses_helper.rb
parent7235f538c6b6f6ddcbc9c35af16e96f266485712 (diff)
Change layout of public profile directory to be the same as in web UI (#11705)
Diffstat (limited to 'app/helpers/statuses_helper.rb')
-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 e067380f6..8380b3c42 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