Skip to content

Commit

Permalink
feat(public account share): fixup! fixup! fixup! fixup! fixup! fixup!…
Browse files Browse the repository at this point in the history
… add public account share
  • Loading branch information
VladislavSokov committed Sep 6, 2023
1 parent 2660fab commit d77189f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/controllers/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ def create
Set.new(AccountShare.accepted.for_public.pluck(:account_id))
end

helper_method memoize def public_share?(account)
public_shared_accounts.include?(account.id)
memoize def private_shared_accounts
Set.new(AccountShare.accepted.for(current_user).pluck(:account_id))
end

helper_method memoize def account
Account.visible_for(current_user).find(ps.fetch(:id))
end

helper_method def public_share?(account)
return false if current_user.account.id == account.parent.id ||
private_shared_accounts.include?(account.id)

public_shared_accounts.include?(account.id)
end
end

0 comments on commit d77189f

Please sign in to comment.