diff options
author | James Lopez <james@jameslopez.es> | 2016-06-14 17:31:03 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-06-14 17:31:03 +0300 |
commit | 9ecebaaea16d206ed20a2f4fc0021a2145c873f5 (patch) | |
tree | 346f9df3661e5cd0e31116fa19270c8e0f3fc032 /app/services/projects/import_export | |
parent | fe370b1c396cb3c290fcdb1d716a79ffe5c29169 (diff) |
adding notifications stuff and more refactoring for exporting projects
Diffstat (limited to 'app/services/projects/import_export')
-rw-r--r-- | app/services/projects/import_export/export_service.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/services/projects/import_export/export_service.rb b/app/services/projects/import_export/export_service.rb index 25524c1c060..d6752377ce5 100644 --- a/app/services/projects/import_export/export_service.rb +++ b/app/services/projects/import_export/export_service.rb @@ -12,8 +12,9 @@ module Projects def save_all if [version_saver, project_tree_saver, uploads_saver, repo_saver, wiki_repo_saver].all?(&:save) Gitlab::ImportExport::Saver.save(shared: @shared) + notify_success else - cleanup_and_notify_worker + cleanup_and_notify end end @@ -37,10 +38,20 @@ module Projects Gitlab::ImportExport::WikiRepoSaver.new(project: project, shared: @shared) end - def cleanup_and_notify_worker + def cleanup_and_notify FileUtils.rm_rf(@shared.export_path) + + notify_error raise Gitlab::ImportExport::Error.new(@shared.errors.join(', ')) end + + def notify_success + notification_service.project_exported(@project, @current_user) + end + + def notify_error + notification_service.project_not_exported(@project, @current_user, @shared.errors.join(', ')) + end end end end |