Skip to content

Commit

Permalink
Show reporting user on issues screen
Browse files Browse the repository at this point in the history
  • Loading branch information
nertc committed Jul 18, 2024
1 parent 76a7e98 commit a8f29ca
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
11 changes: 11 additions & 0 deletions app/assets/stylesheets/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,17 @@ header .search_forms,
}
}

/* Rules for the issues page */

body.issues.issues-index {
table td.reporter_users {
max-width: 50px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}

/* Rules for search sidebar */

#sidebar .search_results_entry {
Expand Down
5 changes: 5 additions & 0 deletions app/views/issues/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<th><%= t ".reports" %></th>
<th><%= t ".reported_item" %></th>
<th><%= t ".reported_user" %></th>
<th class="reporter_users"><%= t ".reporter_users" %></th>
<th><%= t ".last_updated" %></th>
</tr>
</thead>
Expand All @@ -60,6 +61,10 @@
<td class="text-nowrap"><%= link_to t(".reports_count", :count => issue.reports_count), issue %></td>
<td><%= link_to reportable_title(issue.reportable), reportable_url(issue.reportable) %></td>
<td><%= link_to issue.reported_user.display_name, issue.reported_user if issue.reported_user %></td>
<% unique_reporters = issue.reports.preload(:user).map(&:user).uniq %>
<td class="reporter_users" title="<%= safe_join(unique_reporters.map(&:display_name), ", ") %>">
<%= safe_join(unique_reporters.map { |u| link_to u.display_name, u }, ", ") %>
</td>
<td>
<% if issue.user_updated %>
<%= t ".last_updated_time_ago_user_html", :user => link_to(issue.user_updated.display_name, issue.user_updated),
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1462,6 +1462,7 @@ en:
select_type: Select Type
select_last_updated_by: Select Last Updated By
reported_user: Reported User
reporter_users: Reporter Users
not_updated: Not Updated
search: Search
search_guidance: "Search Issues:"
Expand Down
6 changes: 4 additions & 2 deletions test/system/issues_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ def test_view_no_issues

def test_view_issues
sign_in_as(create(:moderator_user))
issues = create_list(:issue, 3, :assigned_role => "moderator")
issue = create(:issue, :assigned_role => "moderator")
issue.reports << create(:report, :user => create(:user, :display_name => "Test Name"))

visit issues_path
assert_content issues.first.reported_user.display_name
assert_content issue.reported_user.display_name
assert_content issue.reports.first.user.display_name
end

def test_view_issue_with_report
Expand Down

0 comments on commit a8f29ca

Please sign in to comment.