about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/instance_helper.rb12
-rw-r--r--app/helpers/statuses_helper.rb20
2 files changed, 32 insertions, 0 deletions
diff --git a/app/helpers/instance_helper.rb b/app/helpers/instance_helper.rb
index dd0b25f3e..daacb535b 100644
--- a/app/helpers/instance_helper.rb
+++ b/app/helpers/instance_helper.rb
@@ -8,4 +8,16 @@ module InstanceHelper
   def site_hostname
     @site_hostname ||= Addressable::URI.parse("//#{Rails.configuration.x.local_domain}").display_uri.host
   end
+
+  def description_for_sign_up
+    prefix = begin
+      if @invite.present?
+        I18n.t('auth.description.prefix_invited_by_user', name: @invite.user.account.username)
+      else
+        I18n.t('auth.description.prefix_sign_up')
+      end
+    end
+
+    safe_join([prefix, I18n.t('auth.description.suffix')], ' ')
+  end
 end
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