<%= render partial: 'users/flag_warning' if @showing_user == @user && @show_flag_warning %> <% content_for :subnav do %> <% if @user && @showing_user.is_active? && @showing_user != @user %> Send a Message <% end %> <% end %>
<% if @showing_user.is_active? %>
<%= avatar_img(@showing_user, 100) %>
<% end %> > <% if @showing_user.is_banned? %> Banned user <% elsif !@showing_user.is_active? %> Inactive user <% else %> Active <%= @showing_user.is_admin? ? "administrator" : (@showing_user.is_moderator? ? "moderator" : "user") %> <% if !@showing_user.can_invite? %> with invites <% if !@showing_user.can_submit_stories? %> and story submissions <% end %> disabled <% end %> <% end %>
<%= time_ago_in_words_label(@showing_user.created_at) %> <% if @showing_user.invited_by_user %> by <%= link_to 'invitation', users_tree_path(anchor: @showing_user.username) %> from <%= link_to @showing_user.invited_by_user.try(:username), @showing_user.invited_by_user %> <% end %>
<% if @showing_user.is_banned? %> <%= time_ago_in_words_label(@showing_user.banned_at) %> <% if @showing_user.banned_by_user %> by <%= link_to @showing_user.banned_by_user.try(:username), @showing_user.banned_by_user %>: <%= @showing_user.banned_reason %> <% end %>
<% end %> <% if @showing_user.deleted_at? %> <%= time_ago_in_words_label(@showing_user.deleted_at) %>
<% end %> <% if !@showing_user.is_admin? %> <%= @showing_user.karma %>, averaging <%= number_with_precision(@showing_user.average_karma, :precision => 2) %> per story/comment
<% end %> <%= stories_submitted_content(@showing_user) %>
<%= comments_posted_content(@showing_user) %>
<% if @showing_user.hats.any? %>
<% @showing_user.hats.each do |hat| %> <%= hat.to_html_label %> <% if hat.doffed_at? %> doffed <%= time_ago_in_words_label(hat.doffed_at) %> <% end %>
<% end %>
<% end %> <% if @showing_user.homepage.present? %> <%= h(@showing_user.homepage) %> <% if @showing_user.homepage.start_with?('gemini://') %> (proxy) <% elsif @showing_user.homepage.start_with?('gopher://') %> (proxy) <% end %>
<% end %> <% if @showing_user.github_username.present? %> https://github.com/<%= h(@showing_user.github_username) %>
<% end %> <% if @showing_user.twitter_username.present? %> @<%= h(@showing_user.twitter_username) %>
<% end %> <% if Keybase.enabled? && @showing_user.keybase_signatures? %> <%= render :partial => "keybase_proofs/proofs", locals: { user: @showing_user, for_self: false } %>
<% end %> <% if @showing_user.is_active? %>
<% if @showing_user.about.present? %> <%= raw @showing_user.linkified_about %> <% else %> A mystery... <% end %>
<% end %> <% if @user && @user.is_moderator? && !@showing_user.is_moderator? %>

Moderator Information

<% if (stats = FlaggedCommenters.new('1m').check_list_for(@showing_user)) %> #<%= stats[:rank] %> at <%= '%.2f' % stats[:sigma] %> σ <% else %> No <% end %>
<% if @showing_user.is_heavy_self_promoter? %> Yes <% else %> No <% end %>
<%= render partial: 'mod_notes/table', locals: { mod_notes: ModNote.for(@showing_user).limit(10), } %> <%= form_with model: @mod_note, method: :post do |f| %> <%= errors_for @mod_note %> <%= f.hidden_field :username %>
<%= f.label :note, "New Note:", :class => "required" %> <%= f.text_area :note, :style => "width: 500px;", :rows => 5 %>

<%= f.submit "ModNote" %>
<% end %> <%= render partial: 'moderations/table', locals: { moderations: Moderation.for(@showing_user).order('id desc').limit(10), } %> <% if @user.is_admin? %>

Admin Information

<%= @showing_user.email %>
<% @showing_user.votes_for_others.limit(15).each do |v| %> <% if v.comment_id %> <% elsif v.story_id && !v.comment_id %> <% end %>

<% end %>
<%= v.vote == 1 ? '+' : v.reason %><%= v.comment.user.try(:username) %> <%= v.story.title %> comment:
<%= v.comment.comment.split[0..10].join(' ') %>
<%= v.story.user.try(:username) %> <%= v.story.title %>
<% if @showing_user.is_banned? || @showing_user.banned_from_inviting? %> <%= form_with url: user_unban_path, method: :post do |f| %>

<% if @showing_user.is_banned? %>

<%= f.label :reason, "Reason:", :class => "required" %> <%= f.text_field :reason, :size => 40 %>
<%= f.submit "Unban" %> <% end %> <% if @showing_user.banned_from_inviting? %> <%= f.submit "Enable Invites", formaction: user_enable_invite_path %> <% end %>

<% end %> <% end %> <% if !@showing_user.is_banned? || !@showing_user.banned_from_inviting? %>

Banning or disabling invites for a user will send an e-mail to the user with the reason below, with your e-mail address as the Reply-To so the user can respond.

<%= form_with url: user_ban_path, method: :post do |f| %>
<%= f.label :reason, "Reason:", :class => "required" %> <%= f.text_field :reason, :size => 40 %>

<% if !@showing_user.is_banned? %> <%= f.submit "Ban", class: 'deletion' %> <% end %> <% if !@showing_user.banned_from_inviting? %> <%= f.submit "Disable Invites", formaction: user_disable_invite_path %> <% end %>

<% end %> <% end %> <% end %> <% end %>