FIX: log backups download/destroy staff action

FIX: clean up junk left by the specs
RENAME: 'backup_operation' to 'backup_create' to match other backup log types
This commit is contained in:
Régis Hanol
2017-01-16 19:53:31 +01:00
parent 116e74325a
commit fbf9172db8
6 changed files with 56 additions and 21 deletions

View File

@ -32,7 +32,7 @@ class Admin::BackupsController < Admin::AdminController
rescue BackupRestore::OperationRunningError
render json: failed_json.merge(message: I18n.t("backup.operation_already_running"))
else
StaffActionLogger.new(current_user).log_backup_operation
StaffActionLogger.new(current_user).log_backup_create
render json: success_json
end
@ -46,9 +46,9 @@ class Admin::BackupsController < Admin::AdminController
# download
def show
filename = params.fetch(:id)
if backup = Backup[filename]
headers['Content-Length'] = File.size(backup.path)
if backup = Backup[params.fetch(:id)]
StaffActionLogger.new(current_user).log_backup_download(backup)
headers['Content-Length'] = File.size(backup.path).to_s
send_file backup.path
else
render nothing: true, status: 404
@ -56,8 +56,8 @@ class Admin::BackupsController < Admin::AdminController
end
def destroy
backup = Backup[params.fetch(:id)]
if backup
if backup = Backup[params.fetch(:id)]
StaffActionLogger.new(current_user).log_backup_destroy(backup)
backup.remove
render nothing: true
else