about summary refs log tree commit diff
path: root/app/views/accounts
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-04-08 13:40:22 +0200
committerEugen Rochko <eugen@zeonfederated.com>2018-04-08 13:40:22 +0200
commit1364e9e4ae1fb12a1c970795f1d0afd651c7cfe2 (patch)
tree0c835286de94b4a1dc8a5ba973c80922d226a9ee /app/views/accounts
parent1ed1014546bcfef0d2441702673deab586f6bca0 (diff)
Fix follow/unfollow buttons on public profile (fixes #7036) (#7040)
* Fix follow/unfollow buttons on public profile

- Present non-logged users with web+mastodon:// URLs for remote accounts
- Present logged-in users with appropriate links (authorize_follows and
  remote_unfollows) for remote accounts

* Do not cache rendered cards if user is logged in
Diffstat (limited to 'app/views/accounts')
-rw-r--r--app/views/accounts/_follow_button.html.haml6
-rw-r--r--app/views/accounts/_follow_grid.html.haml2
2 files changed, 4 insertions, 4 deletions
diff --git a/app/views/accounts/_follow_button.html.haml b/app/views/accounts/_follow_button.html.haml
index e476e0aff..96ae23234 100644
--- a/app/views/accounts/_follow_button.html.haml
+++ b/app/views/accounts/_follow_button.html.haml
@@ -8,16 +8,16 @@
   - if user_signed_in? && current_account.id != account.id && !requested
     .controls
       - if following
-        = link_to account_unfollow_path(account), data: { method: :post }, class: 'icon-button' do
+        = link_to (account.local? ? account_unfollow_path(account) : remote_unfollow_path(acct: account.acct)), data: { method: :post }, class: 'icon-button' do
           = fa_icon 'user-times'
           = t('accounts.unfollow')
       - else
-        = link_to account_follow_path(account), data: { method: :post }, class: 'icon-button' do
+        = link_to (account.local? ? account_follow_path(account) : authorize_follow_path(acct: account.acct)), data: { method: :post }, class: 'icon-button' do
           = fa_icon 'user-plus'
           = t('accounts.follow')
   - elsif !user_signed_in?
     .controls
       .remote-follow
-        = link_to account_remote_follow_path(account), class: 'icon-button' do
+        = link_to (account.local? ? account_remote_follow_path(account) : "web+mastodon://follow?uri=#{account.uri}"), class: 'icon-button' do
           = fa_icon 'user-plus'
           = t('accounts.remote_follow')
diff --git a/app/views/accounts/_follow_grid.html.haml b/app/views/accounts/_follow_grid.html.haml
index 10fbfa546..a6d0ee817 100644
--- a/app/views/accounts/_follow_grid.html.haml
+++ b/app/views/accounts/_follow_grid.html.haml
@@ -2,6 +2,6 @@
   - if accounts.empty?
     = render partial: 'accounts/nothing_here'
   - else
-    = render partial: 'accounts/grid_card', collection: accounts, as: :account, cached: true
+    = render partial: 'accounts/grid_card', collection: accounts, as: :account, cached: !user_signed_in?
 
 = paginate follows