Hide follow/unfollow button from public page if follow already requested

th-downstream
Eugen Rochko 8 years ago
parent 238233440f
commit a3680345b7

@ -91,6 +91,10 @@ class Account < ApplicationRecord
blocking.include?(other_account) blocking.include?(other_account)
end end
def requested?(other_account)
follow_requests.where(target_account: other_account).exists?
end
def local? def local?
domain.nil? domain.nil?
end end

@ -1,5 +1,5 @@
.card{ style: "background-image: url(#{@account.header.url( :original)})" } .card{ style: "background-image: url(#{@account.header.url( :original)})" }
- if user_signed_in? && current_account.id != @account.id - if user_signed_in? && current_account.id != @account.id && !current_account.requested?(@account)
.controls .controls
- if current_account.following?(@account) - if current_account.following?(@account)
= link_to t('accounts.unfollow'), unfollow_account_path(@account), data: { method: :post }, class: 'button' = link_to t('accounts.unfollow'), unfollow_account_path(@account), data: { method: :post }, class: 'button'

Loading…
Cancel
Save