When restoring a backup, disable emails.
This prevents accidental sending of emails after a restore before the admin has had a chance to review everything.
This commit is contained in:
parent
3232ce8265
commit
ccf9b70671
|
@ -77,6 +77,7 @@ class Admin::BackupsController < Admin::AdminController
|
||||||
client_id: params.fetch(:client_id),
|
client_id: params.fetch(:client_id),
|
||||||
publish_to_message_bus: true,
|
publish_to_message_bus: true,
|
||||||
}
|
}
|
||||||
|
SiteSetting.set_and_log(:disable_emails, true, current_user)
|
||||||
BackupRestore.restore!(current_user.id, opts)
|
BackupRestore.restore!(current_user.id, opts)
|
||||||
rescue BackupRestore::OperationRunningError
|
rescue BackupRestore::OperationRunningError
|
||||||
render json: failed_json.merge(message: I18n.t("backup.operation_already_running"))
|
render json: failed_json.merge(message: I18n.t("backup.operation_already_running"))
|
||||||
|
|
|
@ -151,10 +151,12 @@ describe Admin::BackupsController do
|
||||||
describe ".restore" do
|
describe ".restore" do
|
||||||
|
|
||||||
it "starts a restore" do
|
it "starts a restore" do
|
||||||
|
expect(SiteSetting.disable_emails).to eq(false)
|
||||||
BackupRestore.expects(:restore!).with(@admin.id, filename: backup_filename, publish_to_message_bus: true, client_id: "foo")
|
BackupRestore.expects(:restore!).with(@admin.id, filename: backup_filename, publish_to_message_bus: true, client_id: "foo")
|
||||||
|
|
||||||
xhr :post, :restore, id: backup_filename, client_id: "foo"
|
xhr :post, :restore, id: backup_filename, client_id: "foo"
|
||||||
|
|
||||||
|
expect(SiteSetting.disable_emails).to eq(true)
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue