diff --git a/app/mailers/emails/imports.rb b/app/mailers/emails/imports.rb index bb6262bfa3ee0c533d27e2dbee3630c621e9f704..2fc777eec4ce23ec15ecbc616bb66ed5c879fcf6 100644 --- a/app/mailers/emails/imports.rb +++ b/app/mailers/emails/imports.rb @@ -15,13 +15,10 @@ def github_gists_import_errors_email(user_id, errors) def bulk_import_complete(user_id, bulk_import_id) user = User.find(user_id) @bulk_import = BulkImport.find(bulk_import_id) - @bulk_import_entity = @bulk_import.parent_group_entity @hostname = @bulk_import.configuration.url - @source_group = @bulk_import_entity.source_full_path title = safe_format( - s_('BulkImport|Import of %{source_group} from %{hostname}'), - hostname: @hostname, - source_group: @source_group + s_('BulkImport|Import from %{hostname} completed'), + hostname: @hostname ) email_with_layout( diff --git a/app/views/notify/bulk_import_complete.html.haml b/app/views/notify/bulk_import_complete.html.haml index 93543c3edd51f6e04dd97c3c3801bdccbca183a0..68db64c235b1b67bdf7483744680af0c3ce2978a 100644 --- a/app/views/notify/bulk_import_complete.html.haml +++ b/app/views/notify/bulk_import_complete.html.haml @@ -3,20 +3,16 @@ - button_style = 'border: 1px solid #694cc0; border-radius: 4px; font-size: 14px; padding: 8px 16px; background-color: #7b58cf; color: #fff; cursor: pointer;' - strong_tag_pair = tag_pair(tag.strong, :strong_open, :strong_close) -- strong_color_tag_pair = tag_pair(tag.strong(style: 'color: #7b58cf'), :strong_color_open, :strong_color_close) - -- destination_group = @bulk_import_entity.full_path_with_fallback +- start_date = l(@bulk_import.created_at.to_date, format: :long) %h1{ style: header_style } = s_('BulkImport|Import completed') %p{ style: text_style } - = safe_format(s_('BulkImport|The import of %{strong_open}%{source_group}%{strong_close} from %{strong_open}%{hostname}%{strong_close} to %{strong_color_open}%{destination_group}%{strong_color_close} is complete. You can view the results of the import.'), + = safe_format(s_('BulkImport|The import you started on %{start_date} from %{strong_open}%{hostname}%{strong_close} has completed. You can now review your import results.'), strong_tag_pair, - strong_color_tag_pair, - source_group: @source_group, hostname: @hostname, - destination_group: destination_group) + start_date: start_date) %p{ style: text_style } = link_to history_import_bulk_import_url(@bulk_import.id), target: '_blank', rel: 'noopener noreferrer' do diff --git a/app/views/notify/bulk_import_complete.text.erb b/app/views/notify/bulk_import_complete.text.erb index a23ad2dd88bff3d26d9a6d8af4645d8dc4908dfe..aed0b79b6f78ca11f94d4776bebdeb45a73c95a8 100644 --- a/app/views/notify/bulk_import_complete.text.erb +++ b/app/views/notify/bulk_import_complete.text.erb @@ -1,7 +1,5 @@ -<% destination_group = @bulk_import_entity.full_path_with_fallback %> - <%= s_('BulkImport|Import completed') %> -<%= safe_format(s_('BulkImport|The import of %{strong_open}%{source_group}%{strong_close} from %{strong_open}%{hostname}%{strong_close} to %{strong_color_open}%{destination_group}%{strong_color_close} is complete. You can view the results of the import.'), strong_open: '', strong_close: '', strong_color_open: '', strong_color_close: '', source_group: @source_group, hostname: @hostname, destination_group: destination_group) %> +<%= safe_format(s_('BulkImport|The import you started on %{start_date} from %{strong_open}%{hostname}%{strong_close} has completed. You can now review your import results.'), strong_open: '', strong_close: '', hostname: @hostname, start_date: l(@bulk_import.created_at.to_date, format: :long)) %> <%= s_('BulkImport|View import results') %>: <%= history_import_bulk_import_url(@bulk_import.id) %> diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 0aecf29d8b9d291660bba28c00adbd18a9db590c..e362b06a034a4df095f21ab7e90bc39e4a7b6a97 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -9756,13 +9756,13 @@ msgstr "" msgid "BulkImport|Import failed: Destination cannot be a subgroup of the source group. Change the destination and try again." msgstr "" -msgid "BulkImport|Import groups by direct transfer" +msgid "BulkImport|Import from %{hostname} completed" msgstr "" -msgid "BulkImport|Import is finished. Pick another name for re-import" +msgid "BulkImport|Import groups by direct transfer" msgstr "" -msgid "BulkImport|Import of %{source_group} from %{hostname}" +msgid "BulkImport|Import is finished. Pick another name for re-import" msgstr "" msgid "BulkImport|Import with projects" @@ -9867,7 +9867,7 @@ msgstr "" msgid "BulkImport|Template / File-based import / Direct transfer" msgstr "" -msgid "BulkImport|The import of %{strong_open}%{source_group}%{strong_close} from %{strong_open}%{hostname}%{strong_close} to %{strong_color_open}%{destination_group}%{strong_color_close} is complete. You can view the results of the import." +msgid "BulkImport|The import you started on %{start_date} from %{strong_open}%{hostname}%{strong_close} has completed. You can now review your import results." msgstr "" msgid "BulkImport|This %{importable} was imported from another instance." diff --git a/spec/mailers/emails/imports_spec.rb b/spec/mailers/emails/imports_spec.rb index 770cbbc21bca85ada3cb879617dc9976b43ee75d..4469b3339acd499dfaee5fd828f27951bb425d2b 100644 --- a/spec/mailers/emails/imports_spec.rb +++ b/spec/mailers/emails/imports_spec.rb @@ -30,22 +30,20 @@ describe '#bulk_import_complete' do let(:bulk_import) { build_stubbed(:bulk_import, :finished, :with_configuration) } - let(:bulk_import_entity) { build_stubbed(:bulk_import_entity, :group_entity) } subject { Notify.bulk_import_complete('user_id', 'bulk_import_id') } before do allow(User).to receive(:find).and_return(user) allow(BulkImport).to receive(:find).and_return(bulk_import) - allow(bulk_import).to receive(:parent_group_entity).and_return(bulk_import_entity) end it 'sends complete email' do - is_expected.to have_subject("Import of #{bulk_import_entity.source_full_path} from " \ - "#{bulk_import.configuration.url}") + is_expected.to have_subject("Import from #{bulk_import.configuration.url} completed") is_expected.to have_content('Import completed') - is_expected.to have_content("The import of #{bulk_import_entity.source_full_path} from " \ - "#{bulk_import.configuration.url} to #{bulk_import_entity.full_path_with_fallback} is complete.") + is_expected.to have_content("The import you started on " \ + "#{I18n.l(bulk_import.created_at.to_date, format: :long)} " \ + "from #{bulk_import.configuration.url} has completed. You can now review your import results.") is_expected.to have_body_text(history_import_bulk_import_url(bulk_import.id)) end end diff --git a/spec/mailers/previews_spec.rb b/spec/mailers/previews_spec.rb index b1eef1205e279fbffb10b85f851c80af2bfdc25d..1957d13f5eb744e1e9644a34b2da2b76a9570834 100644 --- a/spec/mailers/previews_spec.rb +++ b/spec/mailers/previews_spec.rb @@ -16,7 +16,6 @@ let_it_be(:review) { create(:review, project: project, merge_request: merge_request, author: user) } let_it_be(:key) { create(:key, user: user) } let_it_be(:bulk_import) { create(:bulk_import, :finished, :with_configuration) } - let_it_be(:bulk_import_entity) { create(:bulk_import_entity, :group_entity, bulk_import: bulk_import) } Gitlab.ee do let_it_be(:epic) { create(:epic, group: group) }