From: Tom Hughes Date: Sun, 5 May 2024 17:54:57 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/4753' X-Git-Tag: live~578 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/51d778097f031631a38236e7ab9a37f75a4580dc?ds=sidebyside;hp=--cc Merge remote-tracking branch 'upstream/pull/4753' --- 51d778097f031631a38236e7ab9a37f75a4580dc diff --cc test/controllers/messages_controller_test.rb index 4a48ebbbe,fd4a5ed10..69b0107a8 --- a/test/controllers/messages_controller_test.rb +++ b/test/controllers/messages_controller_test.rb @@@ -261,12 -261,8 +261,8 @@@ class MessagesControllerTest < ActionDi assert_select "textarea#message_body", :count => 1 assert_select "input[type='submit'][value='Send']", :count => 1 end - assert Message.find(unread_message.id).message_read + assert Message.find(message.id).message_read - # Asking to reply to a message with no ID should fail - get message_reply_path - assert_response :success - # Asking to reply to a message with a bogus ID should fail get message_reply_path(:message_id => 99999) assert_response :not_found @@@ -311,12 -307,8 +307,8 @@@ 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 + assert Message.find(message.id).message_read - # Asking to read a message with no ID should fail - get message_path - assert_response :success - # Asking to read a message with a bogus ID should fail get message_path(:id => 99999) assert_response :not_found @@@ -398,29 -390,25 +390,25 @@@ session_for(recipient_user) # Check that the marking a message read works - post message_mark_path(:message_id => unread_message, :mark => "read") + post message_mark_path(:message_id => message, :mark => "read") assert_redirected_to inbox_messages_path - assert Message.find(unread_message.id).message_read + assert Message.find(message.id).message_read # Check that the marking a message unread works - post message_mark_path(:message_id => unread_message, :mark => "unread") + post message_mark_path(:message_id => message, :mark => "unread") assert_redirected_to inbox_messages_path - assert_not Message.find(unread_message.id).message_read + assert_not Message.find(message.id).message_read - # Check that the marking a message read via XHR works - post message_mark_path(:message_id => unread_message, :mark => "read") - assert_response :see_other - assert Message.find(unread_message.id).message_read + # Check that the marking a message read works and redirects to inbox from the message page + post message_mark_path(:message_id => message, :mark => "read"), :headers => { :referer => message_path(message) } + assert_redirected_to inbox_messages_path + assert Message.find(message.id).message_read - # Check that the marking a message unread via XHR works - post message_mark_path(:message_id => unread_message, :mark => "unread") - assert_response :see_other - assert_not Message.find(unread_message.id).message_read + # Check that the marking a message unread works and redirects to inbox from the message page + post message_mark_path(:message_id => message, :mark => "unread"), :headers => { :referer => message_path(message) } + assert_redirected_to inbox_messages_path + assert_not Message.find(message.id).message_read - # Asking to mark a message with no ID should fail - post message_mark_path - assert_redirected_to inbox_messages_path - # Asking to mark a message with a bogus ID should fail post message_mark_path(:message_id => 99999) assert_response :not_found