]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/4600'
authorTom Hughes <tom@compton.nu>
Wed, 20 Mar 2024 17:22:00 +0000 (17:22 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 20 Mar 2024 17:22:00 +0000 (17:22 +0000)
23 files changed:
app/helpers/browse_tags_helper.rb
app/views/issues/_comments.html.erb
app/views/issues/_reports.html.erb
app/views/issues/index.html.erb
app/views/issues/show.html.erb
app/views/messages/_message_summary.html.erb
app/views/messages/_messages_table.html.erb
app/views/messages/_sent_message_summary.html.erb
app/views/messages/new.html.erb
app/views/messages/show.html.erb
app/views/traces/_description.html.erb
app/views/traces/georss.rss.builder
app/views/user_blocks/_block.html.erb
app/views/user_blocks/blocks_by.html.erb
app/views/user_blocks/blocks_on.html.erb
app/views/user_blocks/edit.html.erb
app/views/user_blocks/new.html.erb
app/views/user_blocks/revoke.html.erb
app/views/user_blocks/revoke_all.html.erb
app/views/user_blocks/show.html.erb
test/controllers/messages_controller_test.rb
test/controllers/traces_controller_test.rb
test/controllers/user_blocks_controller_test.rb

index bbe4c63b14722793db32e963bb0d5449686695de..6d3bf5e91245cb247b9ea71dc5786d5a699286d8 100644 (file)
@@ -1,7 +1,7 @@
 module BrowseTagsHelper
   # https://wiki.openstreetmap.org/wiki/Key:wikipedia#Secondary_Wikipedia_links
   # https://wiki.openstreetmap.org/wiki/Key:wikidata#Secondary_Wikidata_links
-  SECONDARY_WIKI_PREFIXES = "architect|artist|brand|buried|flag|genus|name:etymology|network|operator|species|subject".freeze
+  SECONDARY_WIKI_PREFIXES = "architect|artist|brand|buried|flag|genus|manufacturer|model|name:etymology|network|operator|species|subject".freeze
 
   def format_key(key)
     if url = wiki_link("key", key)
index 7776d9ee398a89077a3899b1bbe9a79d83ece820..9200b4cec6246b8feebcc7dbaab1eee77fe19a43 100644 (file)
@@ -2,11 +2,11 @@
   <% comments.each do |comment| %>
     <div class="row">
       <div class="col-auto">
-        <%= link_to user_thumbnail(comment.user), user_path(comment.user) %>
+        <%= link_to user_thumbnail(comment.user), comment.user %>
       </div>
       <div class="col">
         <p class="text-muted">
-          <%= t ".comment_from_html", :user_link => link_to(comment.user.display_name, user_path(comment.user)),
+          <%= t ".comment_from_html", :user_link => link_to(comment.user.display_name, comment.user),
                                       :comment_created_at => tag.time(l(comment.created_at.to_datetime, :format => :friendly),
                                                                       :datetime => comment.created_at.xmlschema) %>
         </p>
index 9ef28f1c29007c06664aed58894350b90fcc0081..2d1b78800688bcb17d024b1d603c83fed890dd36 100644 (file)
@@ -1,12 +1,12 @@
 <% reports.each do |report| %>
   <div class="row">
     <div class="col-auto">
-      <%= link_to user_thumbnail(report.user), user_path(report.user) %>
+      <%= link_to user_thumbnail(report.user), report.user %>
     </div>
     <div class="col">
       <p class="text-muted">
         <%= t ".reported_by_html", :category => report.category,
-                                   :user => link_to(report.user.display_name, user_path(report.user)),
+                                   :user => link_to(report.user.display_name, report.user),
                                    :updated_at => tag.time(l(report.updated_at.to_datetime, :format => :friendly),
                                                            :datetime => report.updated_at.xmlschema) %>
       </p>
index 12ddf2b32a162f6e77c909eb4458dbd9a771571f..523f90846a1a35a4e459dddce6a445c72fca0ad9 100644 (file)
           <td><%= t ".states.#{issue.status}" %></td>
           <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, user_path(issue.reported_user) if issue.reported_user %></td>
+          <td><%= link_to issue.reported_user.display_name, issue.reported_user if issue.reported_user %></td>
           <td>
             <% if issue.user_updated %>
-              <%= t ".last_updated_time_ago_user_html", :user => link_to(issue.user_updated.display_name, user_path(issue.user_updated)),
+              <%= t ".last_updated_time_ago_user_html", :user => link_to(issue.user_updated.display_name, issue.user_updated),
                                                         :time_ago => friendly_date_ago(issue.updated_at) %>
             <% else %>
               <%= friendly_date_ago(issue.updated_at) %>
index e2099f8e6878cab075faf7657940676d408bfb42..8b5f7f42d222d8f6903e199cbce64b2ddeeb7ddb 100644 (file)
@@ -21,7 +21,7 @@
       | <%= t ".last_updated_at_html",
               :datetime => tag.time(l(@issue.updated_at.to_datetime, :format => :friendly),
                                     :datetime => @issue.updated_at.xmlschema),
-              :displayname => link_to(@issue.user_updated.display_name, user_path(@issue.user_updated)) %>
+              :displayname => link_to(@issue.user_updated.display_name, @issue.user_updated) %>
     <% end %>
   </small>
 </p>
index 4a552e83e05479a7d6df58d9cd0f23311c3742ef..cb85a62ba6edfc01d6474811cd88999ccaca9c08 100644 (file)
@@ -1,13 +1,13 @@
-<tr id="inbox-<%= message_summary.id %>" class="inbox-row<%= "-unread" unless message_summary.message_read? %>">
-  <td><%= link_to message_summary.sender.display_name, user_path(message_summary.sender) %></td>
-  <td><%= link_to message_summary.title, message_path(message_summary) %></td>
-  <td class="text-nowrap"><%= l message_summary.sent_on, :format => :friendly %></td>
+<tr id="inbox-<%= message.id %>" class="inbox-row<%= "-unread" unless message.message_read? %>">
+  <td><%= link_to message.sender.display_name, message.sender %></td>
+  <td><%= link_to message.title, message %></td>
+  <td class="text-nowrap"><%= l message.sent_on, :format => :friendly %></td>
   <td class="text-nowrap d-flex justify-content-end gap-1">
-    <%= button_to t(".unread_button"), message_mark_path(message_summary, :mark => "unread"), :remote => true, :class => "btn btn-sm btn-primary", :form => { :class => "inbox-mark-unread", :hidden => !message_summary.message_read? } %>
-    <%= button_to t(".read_button"), message_mark_path(message_summary, :mark => "read"), :remote => true, :class => "btn btn-sm btn-primary", :form => { :class => "inbox-mark-read", :hidden => message_summary.message_read? } %>
-    <%= button_to t(".destroy_button"), message_path(message_summary, :referer => request.fullpath), :method => :delete, :remote => true, :class => "btn btn-sm btn-danger", :form_class => "inbox-destroy" %>
-    <% if message_summary.muted? %>
-      <%= button_to t(".unmute_button"), message_unmute_path(message_summary), :method => :patch, :class => "btn btn-sm btn-secondary" %>
+    <%= button_to t(".unread_button"), message_mark_path(message, :mark => "unread"), :remote => true, :class => "btn btn-sm btn-primary", :form => { :class => "inbox-mark-unread", :hidden => !message.message_read? } %>
+    <%= button_to t(".read_button"), message_mark_path(message, :mark => "read"), :remote => true, :class => "btn btn-sm btn-primary", :form => { :class => "inbox-mark-read", :hidden => message.message_read? } %>
+    <%= button_to t(".destroy_button"), message_path(message, :referer => request.fullpath), :method => :delete, :remote => true, :class => "btn btn-sm btn-danger", :form_class => "inbox-destroy" %>
+    <% if message.muted? %>
+      <%= button_to t(".unmute_button"), message_unmute_path(message), :method => :patch, :class => "btn btn-sm btn-secondary" %>
     <% end %>
   </td>
 </tr>
index 2e33962328f6eb83a3119b5024341919c66c4f8f..ce222dfab9b2ef84ebc67d62a946d475db1a3859 100644 (file)
@@ -8,6 +8,6 @@
     </tr>
   </thead>
   <tbody>
-    <%= render :partial => inner_partial, :collection => messages %>
+    <%= render :partial => inner_partial, :collection => messages, :as => "message" %>
   </tbody>
 </table>
index 24caba5ab0a495d1b74d6255b5983602cb9ed3e8..a9f011f5e431629847f930a3f42fa4bbb2da2d58 100644 (file)
@@ -1,8 +1,8 @@
 <tr class="inbox-row">
-  <td><%= link_to sent_message_summary.recipient.display_name, user_path(sent_message_summary.recipient) %></td>
-  <td><%= link_to sent_message_summary.title, message_path(sent_message_summary) %></td>
-  <td class="text-nowrap"><%= l sent_message_summary.sent_on, :format => :friendly %></td>
+  <td><%= link_to message.recipient.display_name, message.recipient %></td>
+  <td><%= link_to message.title, message %></td>
+  <td class="text-nowrap"><%= l message.sent_on, :format => :friendly %></td>
   <td class="text-nowrap d-flex justify-content-end gap-1">
-    <%= button_to t(".destroy_button"), message_path(sent_message_summary, :referer => request.fullpath), :method => :delete, :remote => true, :class => "btn btn-sm btn-danger", :form_class => "inbox-destroy" %>
+    <%= button_to t(".destroy_button"), message_path(message, :referer => request.fullpath), :method => :delete, :remote => true, :class => "btn btn-sm btn-danger", :form_class => "inbox-destroy" %>
   </td>
 </tr>
index 7c91722ff1b37045457ea689f3875d90d128956f..2838a5dab1c93ca9ba866e9451f049e0e7ca5eab 100644 (file)
@@ -1,5 +1,5 @@
 <% content_for :heading do %>
-  <h1><%= t(".send_message_to_html", :name => link_to(@message.recipient.display_name, user_path(@message.recipient))) %></h1>
+  <h1><%= t(".send_message_to_html", :name => link_to(@message.recipient.display_name, @message.recipient)) %></h1>
 <% end %>
 
 <%= bootstrap_form_for @message do |f| %>
index f0742280f76e410cc5ebcdc8ab9c9830d7b5e32b..29bf02cd8d137ca4901bfc611e6d8665b8500010 100644 (file)
@@ -5,10 +5,10 @@
 <div class='mb-3 border-bottom border-grey py-1 d-flex gap-1 flex-wrap'>
   <% if current_user == @message.recipient %>
     <%= user_thumbnail_tiny @message.sender %>
-    <%= link_to @message.sender.display_name, user_path(@message.sender) %>
+    <%= link_to @message.sender.display_name, @message.sender %>
   <% else %>
     <%= user_thumbnail_tiny @message.recipient %>
-    <%= link_to @message.recipient.display_name, user_path(@message.recipient) %>
+    <%= link_to @message.recipient.display_name, @message.recipient %>
   <% end %>
   <span class="ms-auto">
     <%= l @message.sent_on, :format => :friendly %>
index 5fea819da26db58997e5756b6fc6030971e89bec..538e7f1ec39222745b9a9aabe5a74f93c95447c8 100644 (file)
@@ -1,6 +1,6 @@
-<%= image_tag trace_icon_path(description.user, description.id) %>
-<% if description.size -%>
-<%= t ".description_with_count", :count => description.size, :user => description.user.display_name %>
+<%= image_tag trace_icon_url(trace.user, trace) %>
+<% if trace.size -%>
+<%= t ".description_with_count", :count => trace.size, :user => trace.user.display_name %>
 <% else -%>
-<%= t ".description_without_count", :user => description.user.display_name %>
+<%= t ".description_without_count", :user => trace.user.display_name %>
 <% end -%>
index 924ffb9357257631c1213ea138691c9e7a57b7be..ad5bd45b2248d663bb94a514d4dc82dd1bf1b2b1 100644 (file)
@@ -25,7 +25,7 @@ xml.rss("version" => "2.0",
         xml.guid show_trace_url(trace.user, trace)
 
         xml.description do
-          xml.cdata! render(:partial => "description", :object => trace, :formats => [:html])
+          xml.cdata! render(:partial => "description", :object => trace, :as => "trace", :formats => [:html])
         end
 
         xml.dc :creator, trace.user.display_name
index f39efb571ecc477b044fe5e7f829f99ca793b2e7..50fe74e4cdf4616776bdea979c5008097cd15842 100644 (file)
@@ -1,9 +1,9 @@
 <tr>
   <% if show_user_name %>
-  <td><%= link_to block.user.display_name, user_path(block.user) %></td>
+  <td><%= link_to block.user.display_name, block.user %></td>
   <% end %>
   <% if show_creator_name %>
-  <td><%= link_to block.creator.display_name, user_path(block.creator) %></td>
+  <td><%= link_to block.creator.display_name, block.creator %></td>
   <% end %>
   <td><%= h truncate(block.reason) %></td>
   <td><%= h block_status(block) %></td>
@@ -11,7 +11,7 @@
     <% if block.revoker_id.nil? %>
       <%= t(".not_revoked") %>
     <% else %>
-      <%= link_to block.revoker.display_name, user_path(block.revoker) %>
+      <%= link_to block.revoker.display_name, block.revoker %>
     <% end %>
   </td>
   <td><%= link_to t(".show"), block %></td>
index d5283925bf9e61a1b788103875a78d07b2326936..87ff7f5b23a73a5c294aa587b907180783ea84a0 100644 (file)
@@ -1,6 +1,6 @@
 <% @title = t(".title", :name => @user.display_name) %>
 <% content_for :heading do %>
-  <h1><%= t(".heading_html", :name => link_to(@user.display_name, user_path(@user))) %></h1>
+  <h1><%= t(".heading_html", :name => link_to(@user.display_name, @user)) %></h1>
 <% end %>
 
 <% unless @user_blocks.empty? %>
index 7d1f83ce357e533edee42e529b6c27d8c172d0b6..ed03342dc73deed0014fc4516dd0df4baf28721f 100644 (file)
@@ -1,6 +1,6 @@
 <% @title = t(".title", :name => @user.display_name) %>
 <% content_for :heading do %>
-  <h1><%= t(".heading_html", :name => link_to(@user.display_name, user_path(@user))) %></h1>
+  <h1><%= t(".heading_html", :name => link_to(@user.display_name, @user)) %></h1>
 <% end %>
 
 <% unless @user_blocks.empty? %>
index db7c5e057f360d5c80ceab91cdbfee6e4fe86589..a5b165e9ad790e5c8b918b471a775ebf4091d0cf 100644 (file)
@@ -1,8 +1,6 @@
 <% @title = t ".title", :name => @user_block.user.display_name %>
 <% content_for :heading do %>
-  <h1><%= t(".heading_html",
-            :name => link_to(@user_block.user.display_name,
-                             user_path(@user_block.user))) %></h1>
+  <h1><%= t(".heading_html", :name => link_to(@user_block.user.display_name, @user_block.user)) %></h1>
   <nav class='secondary-actions'>
     <ul class='clearfix'>
       <li><%= link_to t(".show"), @user_block %></li>
index c390134ba3db8482127f0c0a34a085a147e39aeb..3de6aa539ec86d48964524437641f1ca86b5f07f 100644 (file)
@@ -1,8 +1,6 @@
 <% @title = t ".title", :name => @user.display_name %>
 <% content_for :heading do %>
-  <h1><%= t(".heading_html",
-            :name => link_to(@user.display_name,
-                             user_path(@user))) %></h1>
+  <h1><%= t(".heading_html", :name => link_to(@user.display_name, @user)) %></h1>
 <% end %>
 <%= bootstrap_form_for(@user_block) do |f| %>
   <%= hidden_field_tag "display_name", @user.display_name, :autocomplete => "off" %>
index eb1cc4cbebb4e9414043f828b753f03577ba25f8..6bf87c4c3cce00a12c11df92e4650e4416431a11 100644 (file)
@@ -4,10 +4,8 @@
 
 <% content_for :heading do %>
   <h1><%= t(".heading_html",
-            :block_on => link_to(@user_block.user.display_name,
-                                 user_path(@user_block.user)),
-            :block_by => link_to(@user_block.creator.display_name,
-                                 user_path(@user_block.creator))) %></h1>
+            :block_on => link_to(@user_block.user.display_name, @user_block.user),
+            :block_by => link_to(@user_block.creator.display_name, @user_block.creator)) %></h1>
 <% end %>
 
 <% if @user_block.ends_at > Time.now %>
index 7fef69b57fabddf64f3bf19f92529a7f0bf93532..75a425d706ce96444c5eb220f858aefd11316cc8 100644 (file)
@@ -1,10 +1,7 @@
-<% @title = t ".title",
-              :block_on => @user.display_name %>
+<% @title = t ".title", :block_on => @user.display_name %>
 
 <% content_for :heading do %>
-  <h1><%= t ".heading_html",
-            :block_on => link_to(@user.display_name,
-                                 user_path(@user)) %></h1>
+  <h1><%= t ".heading_html", :block_on => link_to(@user.display_name, @user) %></h1>
 <% end %>
 
 <% unless @user.blocks.active.empty? %>
index 03bcd30364d414e0d28e74d5626646e56c542823..94ea53b6446f983b38eab921c0d2af37a7727d18 100644 (file)
@@ -4,10 +4,8 @@
 
 <% content_for :heading do %>
   <h1><%= t(".heading_html",
-            :block_on => link_to(@user_block.user.display_name,
-                                 user_path(@user_block.user)),
-            :block_by => link_to(@user_block.creator.display_name,
-                                 user_path(@user_block.creator))) %></h1>
+            :block_on => link_to(@user_block.user.display_name, @user_block.user),
+            :block_by => link_to(@user_block.creator.display_name, @user_block.creator)) %></h1>
   <nav class='secondary-actions'>
     <ul class='clearfix'>
       <% if @user_block.ends_at > Time.now.getutc %>
@@ -26,7 +24,7 @@
 <dl class="row">
   <% if @user_block.revoker %>
     <dt class="col-sm-3"><%= t ".revoker" %></dt>
-    <dd class="col-sm-9"><%= link_to @user_block.revoker.display_name, user_path(@user_block.revoker) %></dd>
+    <dd class="col-sm-9"><%= link_to @user_block.revoker.display_name, @user_block.revoker %></dd>
   <% end %>
 
   <dt class="col-sm-3"><%= t ".created" %></dt>
index c50eaf562b0551309b8a0e7e357180a990c17ec3..df7146ad645686f6575c91561e3199cf5c7982f6 100644 (file)
@@ -64,6 +64,7 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
     assert_response :success
     assert_template "new"
     assert_select "title", "Send message | OpenStreetMap"
+    assert_select "a[href='#{user_path recipient_user}']", :text => recipient_user.display_name
     assert_select "form[action='/messages']", :count => 1 do
       assert_select "input[type='hidden'][name='display_name'][value='#{recipient_user.display_name}']"
       assert_select "input#message_title", :count => 1
@@ -299,6 +300,7 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
     get message_path(:id => unread_message)
     assert_response :success
     assert_template "show"
+    assert_select "a[href='#{user_path recipient_user}']", :text => recipient_user.display_name
     assert_not Message.find(unread_message.id).message_read
 
     # Login as the message recipient
@@ -308,6 +310,7 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
     get message_path(:id => unread_message)
     assert_response :success
     assert_template "show"
+    assert_select "a[href='#{user_path user}']", :text => user.display_name
     assert Message.find(unread_message.id).message_read
 
     # Asking to read a message with no ID should fail
@@ -338,7 +341,10 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
     assert_template "inbox"
     assert_select ".content-inner > table", :count => 1 do
       assert_select "tr", :count => 2
-      assert_select "tr#inbox-#{read_message.id}.inbox-row", :count => 1
+      assert_select "tr#inbox-#{read_message.id}.inbox-row", :count => 1 do
+        assert_select "a[href='#{user_path read_message.sender}']", :text => read_message.sender.display_name
+        assert_select "a[href='#{message_path read_message}']", :text => read_message.title
+      end
     end
   end
 
@@ -346,7 +352,7 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
   # test the outbox action
   def test_outbox
     user = create(:user)
-    create(:message, :sender => user)
+    message = create(:message, :sender => user)
 
     # Check that the outbox page requires us to login
     get outbox_messages_path
@@ -361,7 +367,10 @@ class MessagesControllerTest < ActionDispatch::IntegrationTest
     assert_template "outbox"
     assert_select ".content-inner > table", :count => 1 do
       assert_select "tr", :count => 2
-      assert_select "tr.inbox-row", :count => 1
+      assert_select "tr.inbox-row", :count => 1 do
+        assert_select "a[href='#{user_path message.recipient}']", :text => message.recipient.display_name
+        assert_select "a[href='#{message_path message}']", :text => message.title
+      end
     end
   end
 
index 2a6dc12dc3acb07c997eaa50993b62a95ffe29d1..9a818786df9ff26f203a2172d0a085f359724264 100644 (file)
@@ -810,7 +810,11 @@ class TracesControllerTest < ActionDispatch::IntegrationTest
             assert_select item, "title", trace.name
             assert_select item, "link", "http://www.example.com/user/#{ERB::Util.u(trace.user.display_name)}/traces/#{trace.id}"
             assert_select item, "guid", "http://www.example.com/user/#{ERB::Util.u(trace.user.display_name)}/traces/#{trace.id}"
-            assert_select item, "description"
+            assert_select item, "description" do
+              assert_dom_encoded do
+                assert_select "img[src='#{trace_icon_url trace.user, trace}']"
+              end
+            end
             # assert_select item, "dc:creator", trace.user.display_name
             assert_select item, "pubDate", trace.timestamp.rfc822
           end
index fc3cbda92503b61b295009cb51368a4b0b86a4a1..8891e5b36dcb3eae5055d3ccd1bf60b160cc8d6d 100644 (file)
@@ -67,14 +67,23 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
   ##
   # test the index action
   def test_index
+    revoked_block = create(:user_block, :revoked)
+
+    get user_blocks_path
+    assert_response :success
+    assert_select "table#block_list tbody tr", :count => 1 do
+      assert_select "a[href='#{user_path revoked_block.user}']", :text => revoked_block.user.display_name
+      assert_select "a[href='#{user_path revoked_block.creator}']", :text => revoked_block.creator.display_name
+      assert_select "a[href='#{user_path revoked_block.revoker}']", :text => revoked_block.revoker.display_name
+    end
+
     active_block = create(:user_block)
     expired_block = create(:user_block, :expired)
-    revoked_block = create(:user_block, :revoked)
 
     get user_blocks_path
     assert_response :success
-    assert_select "table#block_list", :count => 1 do
-      assert_select "tr", 4
+    assert_select "table#block_list tbody", :count => 1 do
+      assert_select "tr", 3
       assert_select "a[href='#{user_block_path(active_block)}']", 1
       assert_select "a[href='#{user_block_path(expired_block)}']", 1
       assert_select "a[href='#{user_block_path(revoked_block)}']", 1
@@ -115,14 +124,21 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
     # Viewing an expired block should work
     get user_block_path(:id => expired_block)
     assert_response :success
+    assert_select "h1 a[href='#{user_path expired_block.user}']", :text => expired_block.user.display_name
+    assert_select "h1 a[href='#{user_path expired_block.creator}']", :text => expired_block.creator.display_name
 
     # Viewing a revoked block should work
     get user_block_path(:id => revoked_block)
     assert_response :success
+    assert_select "h1 a[href='#{user_path revoked_block.user}']", :text => revoked_block.user.display_name
+    assert_select "h1 a[href='#{user_path revoked_block.creator}']", :text => revoked_block.creator.display_name
+    assert_select "a[href='#{user_path revoked_block.revoker}']", :text => revoked_block.revoker.display_name
 
     # Viewing an active block should work, but shouldn't mark it as seen
     get user_block_path(:id => active_block)
     assert_response :success
+    assert_select "h1 a[href='#{user_path active_block.user}']", :text => active_block.user.display_name
+    assert_select "h1 a[href='#{user_path active_block.creator}']", :text => active_block.creator.display_name
     assert UserBlock.find(active_block.id).needs_view
 
     # Login as the blocked user
@@ -156,6 +172,7 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
     # Check that the block creation page loads for moderators
     get new_user_block_path(target_user)
     assert_response :success
+    assert_select "h1 a[href='#{user_path target_user}']", :text => target_user.display_name
     assert_select "form#new_user_block", :count => 1 do
       assert_select "textarea#user_block_reason", :count => 1
       assert_select "select#user_block_period", :count => 1
@@ -193,6 +210,7 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
     # Check that the block edit page loads for moderators
     get edit_user_block_path(:id => active_block)
     assert_response :success
+    assert_select "h1 a[href='#{user_path active_block.user}']", :text => active_block.user.display_name
     assert_select "form#edit_user_block_#{active_block.id}", :count => 1 do
       assert_select "textarea#user_block_reason", :count => 1
       assert_select "select#user_block_period", :count => 1
@@ -364,6 +382,7 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
     get revoke_user_block_path(:id => active_block)
     assert_response :success
     assert_template "revoke"
+    assert_select "h1 a[href='#{user_path active_block.user}']", :text => active_block.user.display_name
     assert_select "form", :count => 1 do
       assert_select "input#confirm[type='checkbox']", :count => 1
       assert_select "input[type='submit'][value='Revoke!']", :count => 1
@@ -416,6 +435,7 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
     # Check that the revoke all blocks page loads for moderators
     get revoke_all_user_blocks_path(blocked_user)
     assert_response :success
+    assert_select "h1 a[href='#{user_path blocked_user}']", :text => blocked_user.display_name
   end
 
   ##
@@ -490,8 +510,9 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
     # Check the list of blocks for a user that is currently blocked
     get user_blocks_on_path(blocked_user)
     assert_response :success
-    assert_select "table#block_list", :count => 1 do
-      assert_select "tr", 3
+    assert_select "h1 a[href='#{user_path blocked_user}']", :text => blocked_user.display_name
+    assert_select "table#block_list tbody", :count => 1 do
+      assert_select "tr", 2
       assert_select "a[href='#{user_block_path(active_block)}']", 1
       assert_select "a[href='#{user_block_path(revoked_block)}']", 1
     end
@@ -499,8 +520,9 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
     # Check the list of blocks for a user that has previously been blocked
     get user_blocks_on_path(unblocked_user)
     assert_response :success
-    assert_select "table#block_list", :count => 1 do
-      assert_select "tr", 2
+    assert_select "h1 a[href='#{user_path unblocked_user}']", :text => unblocked_user.display_name
+    assert_select "table#block_list tbody", :count => 1 do
+      assert_select "tr", 1
       assert_select "a[href='#{user_block_path(expired_block)}']", 1
     end
   end
@@ -543,16 +565,18 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
     # Check the list of blocks given by one moderator
     get user_blocks_by_path(moderator_user)
     assert_response :success
-    assert_select "table#block_list", :count => 1 do
-      assert_select "tr", 2
+    assert_select "h1 a[href='#{user_path moderator_user}']", :text => moderator_user.display_name
+    assert_select "table#block_list tbody", :count => 1 do
+      assert_select "tr", 1
       assert_select "a[href='#{user_block_path(active_block)}']", 1
     end
 
     # Check the list of blocks given by a different moderator
     get user_blocks_by_path(second_moderator_user)
     assert_response :success
-    assert_select "table#block_list", :count => 1 do
-      assert_select "tr", 3
+    assert_select "h1 a[href='#{user_path second_moderator_user}']", :text => second_moderator_user.display_name
+    assert_select "table#block_list tbody", :count => 1 do
+      assert_select "tr", 2
       assert_select "a[href='#{user_block_path(expired_block)}']", 1
       assert_select "a[href='#{user_block_path(revoked_block)}']", 1
     end