mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
FIX: Outgoing emails were not disabled after restoring backup
This commit is contained in:
parent
5952a6c0ad
commit
dc961fecb9
|
@ -114,7 +114,6 @@ class Admin::BackupsController < Admin::AdminController
|
|||
client_id: params.fetch(:client_id),
|
||||
publish_to_message_bus: true,
|
||||
}
|
||||
SiteSetting.set_and_log(:disable_emails, 'yes', current_user)
|
||||
BackupRestore.restore!(current_user.id, opts)
|
||||
rescue BackupRestore::OperationRunningError
|
||||
render_error("backup.operation_already_running")
|
||||
|
|
|
@ -401,6 +401,10 @@ module BackupRestore
|
|||
def reload_site_settings
|
||||
log "Reloading site settings..."
|
||||
SiteSetting.refresh!
|
||||
|
||||
log "Disabling outgoing emails for non-stuff users..."
|
||||
user = User.find_by_email(@user_info[:email]) || Discourse.system_user
|
||||
SiteSetting.set_and_log(:disable_emails, 'non-staff', user)
|
||||
end
|
||||
|
||||
def clear_emoji_cache
|
||||
|
|
|
@ -162,12 +162,10 @@ RSpec.describe Admin::BackupsController do
|
|||
|
||||
describe '#restore' do
|
||||
it "starts a restore" do
|
||||
expect(SiteSetting.disable_emails).to eq("no")
|
||||
BackupRestore.expects(:restore!).with(admin.id, filename: backup_filename, publish_to_message_bus: true, client_id: "foo")
|
||||
|
||||
post "/admin/backups/#{backup_filename}/restore.json", params: { client_id: "foo" }
|
||||
|
||||
expect(SiteSetting.disable_emails).to eq("yes")
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user