Files
danbooru/app/views/users/_statistics.html.erb
evazion 6b1d73ddae user name changes: fix permission inconsistencies.
* Let moderators see name changes for deleted users on the user name
  change requests index and show pages. Before they could see name changes
  for deleted users on user profiles, but not on the user name changes index.

* Let members see previous names on profile pages. Before they could see
  previous names on the user name changes index, but not on profile pages
  (ref: #4382).
2020-04-03 23:44:02 -05:00

240 lines
7.0 KiB
Plaintext

<div>
<h2>Statistics</h2>
<table width="100%" class="user-statistics">
<tbody>
<tr>
<th>User ID</th>
<td><%= user.id %></td>
</tr>
<tr>
<th>Join Date</th>
<td><%= presenter.join_date %></td>
</tr>
<% if policy(IpAddress).show? %>
<tr>
<th>Last IP</th>
<td>
<% if user.last_ip_addr.present? %>
<%= link_to user.last_ip_addr, ip_addresses_path(search: { ip_addr: user.last_ip_addr }) %>
(<%= link_to "info", ip_address_path(user.last_ip_addr) %>,
<%= link_to "users", ip_addresses_path(search: { ip_addr: user.last_ip_addr, group_by: "user" }) %>,
<%= link_to "IPs", ip_addresses_path(search: { user_id: user.id, group_by: "ip_addr" }) %>)
<% else %>
<em>unknown</em>
(<%= link_to "IPs", ip_addresses_path(search: { user_id: user.id, group_by: "ip_addr" }) %>)
<% end %>
</td>
</tr>
<% end %>
<tr>
<th>Inviter</th>
<% if user.inviter %>
<td><%= link_to_user user.inviter %> <%= link_to "»", users_path(search: { inviter: { name: user.inviter.name }}) %></td>
<% else %>
<td>None</td>
<% end %>
</tr>
<tr>
<th>Level</th>
<td>
<%= user.level_string %>
<% if CurrentUser.user == user && !CurrentUser.is_gold? %>
(<%= link_to "upgrade", new_user_upgrade_path %>)
<% end %>
</td>
</tr>
<tr>
<th>Permissions</th>
<td><%= presenter.permissions %></td>
</tr>
<% if user.is_banned? && user.recent_ban %>
<tr>
<th>Ban reason</th>
<td>
<span class="prose">
<%= format_text presenter.ban_reason, inline: true %>
</span>
</td>
</tr>
<% end %>
<tr>
<th>Upload Limit</th>
<td>
<%= render "users/upload_limit", user: user %>
</td>
</tr>
<tr>
<th>Uploads</th>
<td>
<%= presenter.upload_count(self) %>
<% if presenter.has_uploads? %>
(<%= link_to "tag changes report", post_versions_path(search: { updater_id: user.id, version: 1 }, type: "current") %>)
<% end %>
<% if CurrentUser.is_moderator? %>
[<%= link_to "sample", posts_path(:tags => "user:#{user.name} order:random limit:300") %>]
<% end %>
</td>
</tr>
<tr>
<th>Deleted Uploads</th>
<td>
<%= presenter.deleted_upload_count(self) %>
<% if CurrentUser.is_moderator? %>
[<%= link_to "sample", posts_path(:tags => "user:#{user.name} order:random limit:300 status:deleted") %>]
<% end %>
</td>
</tr>
<tr>
<th>Favorites</th>
<td>
<%= presenter.favorite_count(self) %>
<% if CurrentUser.is_moderator? %>
[<%= link_to "sample", posts_path(:tags => "fav:#{user.name} order:random limit:300") %>]
<% end %>
</td>
</tr>
<% if CurrentUser.user == user || CurrentUser.user.is_admin? %>
<tr>
<th>Votes</th>
<td>
<%= link_to user.post_votes.count, post_votes_path(search: { user_name: user.name }) %> posts,
<%= link_to user.comment_votes.count, comment_votes_path(search: { user_name: user.name }) %> comments,
<%= link_to user.forum_post_votes.count, forum_post_votes_path(search: { creator_name: user.name }) %> forum posts
</td>
</tr>
<% end %>
<tr>
<th>Favorite Groups</th>
<td><%= presenter.favorite_group_count(self) %></td>
</tr>
<tr>
<th>Post Changes</th>
<td>
<%= presenter.post_version_count(self) %>
<% if CurrentUser.id == user.id %>
(<%= link_to "refresh", new_maintenance_user_count_fixes_path %>)
<% end %>
</td>
</tr>
<tr>
<th>Note Changes</th>
<td>
<%= presenter.note_version_count(self) %> in <%= presenter.noted_posts_count(self) %> posts
(<%= link_to "note changes report", note_versions_path(search: { updater_id: user.id, version: 1 }, type: "current") %>)
</td>
</tr>
<tr>
<th>Wiki Page Changes</th>
<td><%= presenter.wiki_page_version_count(self) %></td>
</tr>
<tr>
<th>Artist Changes</th>
<td><%= presenter.artist_version_count(self) %></td>
</tr>
<tr>
<th>Commentary Changes</th>
<td><%= presenter.artist_commentary_version_count(self) %></td>
</tr>
<% if PoolVersion.enabled? %>
<tr>
<th>Pool Changes</th>
<td><%= presenter.pool_version_count(self) %></td>
</tr>
<% end %>
<tr>
<th>Forum Posts</th>
<td><%= presenter.forum_post_count(self) %></td>
</tr>
<tr>
<th>Approvals</th>
<td><%= presenter.approval_count(self) %></td>
</tr>
<tr>
<th>Comments</th>
<td><%= presenter.comment_count(self) %> in <%= presenter.commented_posts_count(self) %> posts</td>
</tr>
<% if CurrentUser.user.id == user.id || CurrentUser.is_moderator? %>
<tr>
<th>Appeals</th>
<td><%= presenter.appeal_count(self) %></td>
</tr>
<tr>
<th>Flags</th>
<td><%= presenter.flag_count(self) %></td>
</tr>
<% end %>
<tr>
<th>Feedback</th>
<td><%= presenter.feedbacks(self) %></td>
</tr>
<% if policy(UserNameChangeRequest.new(user: user)).show? %>
<% user.user_name_change_requests.visible(CurrentUser.user).tap do |changes| %>
<% if changes.present? %>
<tr>
<th>Previous Names</th>
<td>
<%= changes.map do |change| %>
<% link_to change.original_name, change %>
<% end.join(", ").html_safe %>
</td>
</tr>
<% end %>
<% end %>
<% end %>
<% if CurrentUser.id == user.id %>
<% if SavedSearch.labels_for(CurrentUser.user.id).present? %>
<tr>
<th>Saved Searches</th>
<td>
<% SavedSearch.labels_for(CurrentUser.user.id).each do |label| %>
<%= link_to label, posts_path(tags: "search:#{label}") %>
<% end %>
</td>
</tr>
<% end %>
<tr>
<th>API Key</th>
<td>
<%= link_to (CurrentUser.api_key ? "View" : "Generate"), user_api_key_path(CurrentUser.user) %>
(<%= link_to_wiki "help", "help:api" %>)
</td>
</tr>
<tr>
<th>API Limits</th>
<td>
<%= CurrentUser.user.remaining_api_limit %>
/ <%= CurrentUser.user.api_burst_limit %> <span class="fineprint">(may not be up to date)</span>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>