reassigned_logs_text="There #{assigned_logs_count} assigned to you. The stock owner and managing agent on #{logs_count==1?'this log':'these logs'} has been changed from #{current_organisation.name} to #{new_organisation.name}."
when"reassign_stock_owner"
reassigned_logs_text="There #{assigned_logs_count} assigned to you. The stock owner on #{logs_count==1?'this log':'these logs'} has been changed from #{current_organisation.name} to #{new_organisation.name}."
when"reassign_managing_agent"
reassigned_logs_text="There #{assigned_logs_count} assigned to you. The managing agent on #{logs_count==1?'this log':'these logs'} has been changed from #{current_organisation.name} to #{new_organisation.name}."
when"unassign"
reassigned_logs_text="There #{assigned_logs_count} assigned to you. #{logs_count==1?'This':'These'} have now been unassigned."
<% if current_user.id == @bulk_upload.moved_user_id %>
You moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.
<% else %>
Some logs in this upload are assigned to <%= @bulk_upload.moved_user_name %>, who has moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.
<%= f.govuk_check_box :show_on_unauthenticated_pages, 1, 0, multiple: false, label: { text: "Show this notification on unauthenticated pages, for example the start page" } %>
<%= f.govuk_check_box :show_additional_page, 1, 0, multiple: false, label: { text: "Include a link to a separate page with additional information" } do %>
<%= f.govuk_text_field :link_text, label: { text: "Link text" }, hint: { text: "Use descriptive language and relevant terms. The link text should make sense out of context." } %>
<%= f.govuk_text_area :page_content, label: { text: "Page content" }, hint: { text: "Use markdown to format the page content. The page title will be the notification title by default. Use a heading level one if you want to override it." } %>
<% end %>
<% end %>
<span class="govuk-caption-m govuk-!-margin-bottom-6"><%= govuk_link_to "Find out more about using Markdown at Markdown Guide", "https://www.markdownguide.org/basic-syntax/", new_tab: true %></span>
@ -30,14 +30,15 @@ RSpec.describe "Start Page Features" do
end
context"when the unauthenticated user clicks a notification link"do
let!(:notification){create(:notification,title:"Notification title",link_text:"link",page_content:"Some html content",show_on_unauthenticated_pages:true)}
expected_text="You’re moving #{user.name} from #{user.organisation.name} to #{current_user.organisation.name}. The stock owner and managing agent on their logs will change to #{current_user.organisation.name}."
expected_text="You’re moving #{user.name} from #{user.organisation.name} to #{current_user.organisation.name}. The stock owner on their logs will change to #{current_user.organisation.name}."
expected_text="You’re moving #{user.name} from #{user.organisation.name} to #{current_user.organisation.name}. The managing agent on their logs will change to #{current_user.organisation.name}."
reassigned_logs_text:"There are 2 logs assigned to you. The stock owner and managing agent on these logs has been changed from #{user.organisation.name} to #{new_organisation.name}.",
reassigned_logs_text:"There are 2 logs assigned to you. The stock owner on these logs has been changed from #{user.organisation.name} to #{new_organisation.name}.",
reassigned_logs_text:"There are 2 logs assigned to you. The managing agent on these logs has been changed from #{user.organisation.name} to #{new_organisation.name}.",
expect(response.body).toinclude("This error report is out of date.")
expect(response.body).toinclude("Some logs in this upload are assigned to #{user.name}, who has moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
end
end
context"and bulk upload has been cancelled by the current moved user"do
expect(response.body).toinclude("This error report is out of date.")
expect(response.body).toinclude("You moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
end
end
end
end
@ -107,5 +129,28 @@ RSpec.describe BulkUploadLettingsResultsController, type: :request do
expect(response).tobe_not_found
end
end
context"and bulk upload has been cancelled by not the current moved user"do
expect(response.body).toinclude("This error report is out of date.")
expect(response.body).toinclude("Some logs in this upload are assigned to #{other_user.name}, who has moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
end
end
context"and bulk upload has been cancelled by the current moved user"do
expect(response.body).toinclude("This error report is out of date.")
expect(response.body).toinclude("You moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
expect(response.body).toinclude("This error report is out of date.")
expect(response.body).toinclude("Some logs in this upload are assigned to #{user.name}, who has moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
end
end
context"and bulk upload has been cancelled by the current moved user"do
expect(response.body).toinclude("This error report is out of date.")
expect(response.body).toinclude("You moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
expect(response.body).toinclude("This error report is out of date.")
expect(response.body).toinclude("Some logs in this upload are assigned to #{other_user.name}, who has moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
end
end
context"and bulk upload has been cancelled by the current moved user"do
expect(response.body).toinclude("This error report is out of date.")
expect(response.body).toinclude("You moved to a different organisation since this file was uploaded. Reupload the file to get an accurate error report.")
expect(page).tohave_content("New org must be a stock owner of #{other_user.organisation_name}, #{new_organisation_2.name}, and #{new_organisation_3.name} to make this change.")
end
end
end
context"and log reassignment choice is to change managing agent"do
expect(page).tohave_content("New org must be a managing agent of #{other_user.organisation_name}, #{new_organisation_2.name}, and #{new_organisation_3.name} to make this change.")
end
end
end
end
@ -2194,6 +2423,151 @@ RSpec.describe UsersController, type: :request do
expect(page).tohave_content("Are you sure you want to move this user?")
expect(page).tohave_content("You’re moving #{other_user.name} from #{other_user.organisation_name} to #{new_organisation.name}. The stock owner and managing agent on their logs will change to #{new_organisation.name}.")