Sha256: 04e83bcd3a400b6c9b2497d4403e21982a09fb14555d411b20f03f4099306efb

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

<%#
  Displays buttons to follow/revoke following on a given actor.
  Requires variables:
    - user (usually user)
    - actor (target actor)
%>
<p>
  <% if Federails::Client::FollowingPolicy.new(user, Federails::Following).create? %>
    <% follow = user.actor.follows? actor %>
    <% if actor.entity == user %>
      <button type="button" role="button" disabled="disabled">That's you</button>
    <% elsif follow %>
      Already following (<%= follow.status %>)
      <%= button_to 'Cancel', federails.client_following_path(follow), method: :delete %>
    <% else %>
      <%= button_to "Follow #{actor.username}", federails.follow_client_followings_path, params: { account: actor.at_address }, method: :post %>
    <% end %>

    <% followed = actor.follows? user.actor %>
    <% if followed %>
      <% if followed.pending? %>
        <%= actor.username %> wants to follow you.
        <%= button_to 'Accept request', federails.accept_client_following_path(followed), method: :put %>
      <% else %>
        <%= actor.username %> follows you.
        <%= button_to 'Revoke', federails.client_following_path(followed), method: :delete %>
      <% end %>
    <% end %>
  <% else %>
    <%= user.class.name %> is not configured to follow/be followed, or has no associated actor.
  <% end %>
</p>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
federails-0.3.0 app/views/federails/client/followings/_follow_actions.html.erb