diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 1860f279f..121523d42 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -20,6 +20,7 @@ <% end %> +<% is_me = @user.same_as?(current_user) %>
<% if @user.discord.present? %>
@@ -72,7 +73,7 @@
<% end %>
<% end %>
<% if current_user&.at_least_moderator? %>
- Moderator Tools <% if @user.community_user.mod_warnings&.size.positive? %> (<%= pluralize(@user.community_user.mod_warnings.count, 'message') %>) <% end %>
+ Moderator Tools <% if @user.community_user.mod_warnings&.size.positive? %> (<%= pluralize(@user.community_user.mod_warnings.count, 'message') %>) <% end %>
<%= @user.reputation %>
-
Number of top-level posts
+ Top-level posts
<%= @user.metric '1' %>
-
Number of answers
+
+
+ <%= link_to search_path(search: "user:#{@user.id} post_type:2"),
+ 'aria-label': is_me ? 'View your answers' : "View answers from #{rtl_safe_username(@user)}" do %>
+ Answers
+ <% end %>
+
<%= @user.metric '2' %>
-
Sum of received votes (up minus down)
+
+ <%= link_to is_me ? my_vote_summary_path : vote_summary_path,
+ 'aria-label':
+ is_me ? 'View your received votes' : "View received votes for #{rtl_safe_username(@user)}" do %>
+ Received votes
+ <% end %>
+
(up minus down)
+ <%= @user.metric 's' %>
-
- <% if current_user&.id == @user.id || current_user&.at_least_moderator? %>
- Number of edits made
+ Edits made
<%= @user.metric 'E' %>
+ <% if is_me || current_user&.at_least_moderator? %>
+ User since <%= @user.community_user.created_at %>
<% end %>
-
+
<% unless @abilities.empty? %>
Joined <%= @user.community_user.created_at %> Earned Abilities
@@ -181,14 +196,10 @@
<% end %>
<% end %>
Posts
-
Count
+
+ <%= link_to user_posts_path,
+ 'aria-label': is_me ? 'View your posts' : "View posts for #{rtl_safe_username(@user)}" do %>
+ Total
+ <% end %>
+
<%= @user.posts.undeleted.count %>
-
Questions
+
+ <%= link_to search_path(search: "user:#{@user.id} post_type:1"),
+ 'aria-label': is_me ? 'View your questions' : "View questions from #{rtl_safe_username(@user)}" do %>
+ Questions
+ <% end %>
+
<%= posts_for(posts_by_post_type, Question) %>
-
Answers
+
+ <%= link_to search_path(search: "user:#{@user.id} post_type:2"),
+ 'aria-label': is_me ? 'View your answers' : "View answers from #{rtl_safe_username(@user)}" do %>
+ Answers
+ <% end %>
+
<%= posts_for(posts_by_post_type, Answer) %>
-
Articles
+
+ <%= link_to search_path(search: "user:#{@user.id} post_type:5"),
+ 'aria-label': is_me ? 'View your articles' : "View articles from #{rtl_safe_username(@user)}" do %>
+ Articles
+ <% end %>
+
<%= posts_for(posts_by_post_type, Article) %>
@@ -238,48 +269,48 @@
Votes cast
-
- <% if @user.id == current_user&.id || current_user&.admin? %>
- Count
+ Total
<%= @user.votes.count %>
-
-
-
- <%= votes_by_type[1] || 0 %>
-
-
-
-
- <%= votes_by_type[-1] || 0 %>
-
-
- on Question
-
- <%= votes_for(votes_by_post_type, Question) %>
-
-
-
- on Answer
-
- <%= votes_for(votes_by_post_type, Answer) %>
-
-
-
+ <% if is_me || current_user&.admin? %>
+ on Article
-
- <%= votes_for(votes_by_post_type, Article) %>
-
-
+
+
+
+ <%= votes_by_type[1] || 0 %>
+
+
+
+
+ <%= votes_by_type[-1] || 0 %>
+
+
+ on Questions
+
+ <%= votes_for(votes_by_post_type, Question) %>
+
+
+
+ on Answers
+
+ <%= votes_for(votes_by_post_type, Answer) %>
+
+
+
<% end %>
on Articles
+
+ <%= votes_for(votes_by_post_type, Article) %>
+
+
@@ -288,9 +319,9 @@
Flags raised
- Count
+ Total
- <% if current_user&.id == @user.id || at_least_moderator? %>
+ <% if is_me || at_least_moderator? %>
<%= link_to @user.flags.count, flag_history_path(@user.id), class: 'is-muted',
'aria-label': "View flag history for #{@user.flags.count} flags" %>
<% else %>