<% if user_signed_in? && current_user != @user %>
  <div class="collection with-header hoverable">
    <div class="collection-header blue lighten-1 white-text">
      <div style="padding: 5px 10px">
        Social Actions
      </div>
    </div>

    <%= render partial: 'users/profile/follow_button', locals: { user: @user } %>

    <div>
      <%= link_to Thredded::UrlsHelper.send_private_message_path(current_user: current_user, to: @user), class: 'collection-item blue-text' do %>
        Send a message
        <span class="secondary-content">
          <i class="material-icons blue-text">forum</i>
        </span>
      <% end %>
    </div>

    <% if user_signed_in? %>
      <% if @user.blocked_by?(current_user) %>
        <%= form_for(current_user.user_blockings.find_by(blocked_user_id: @user.id), method: :delete) do |f| %>
          <%= f.hidden_field :blocked_user_id, value: @user.id %>
          <%= link_to '#', onclick: "$('.edit_user_blocking').first().submit()", class: 'collection-item blue-text' do %>
            Unblock this user
            <span class="secondary-content">
              <i class="material-icons red-text text-lighten-2">cancel</i>
            </span>
          <% end %>
        <% end %>
      <% else %>
        <%= form_for UserBlocking.new, method: :post do |f| %>
          <%= f.hidden_field :blocked_user_id, value: @user.id %>
          <%= link_to '#', onclick: "$('#new_user_blocking').submit()", class: 'collection-item blue-text' do %>
            Block this user
            <span class="secondary-content">
              <i class="material-icons red-text text-lighten-2">close</i>
            </span>
          <% end %>
        <% end %>
      <% end %>
    <% end %>
  </div>
<% end %>
