mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 19:52:11 +08:00
FIX: log a staff action + send a private message when disabling the 'download_remote_images_to_local' site setting
This commit is contained in:
parent
dc789502f9
commit
5681338b08
@ -36,6 +36,7 @@ en:
|
||||
is_reserved: "is reserved"
|
||||
|
||||
purge_reason: "Automatically deleted due to being old and unverified"
|
||||
disable_remote_images_download_reason: "Remote images download was disabled because there wasn't enough disk space available."
|
||||
|
||||
errors:
|
||||
messages:
|
||||
|
@ -245,7 +245,12 @@ class CookedPostProcessor
|
||||
def disable_if_low_on_disk_space
|
||||
if available_disk_space < SiteSetting.download_remote_images_threshold
|
||||
SiteSetting.download_remote_images_to_local = false
|
||||
SystemMessage.create(Discourse.site_contact_user, :download_remote_images_disabled)
|
||||
# log the site setting change
|
||||
reason = I18n.t("disable_remote_images_download_reason")
|
||||
staff_action_logger = StaffActionLogger.new(Discourse.system_user)
|
||||
staff_action_logger.log_site_setting_change("download_remote_images_to_local", true, false, { details: reason })
|
||||
# also send a private message to the site contact user
|
||||
SystemMessage.create_from_system_user(Discourse.site_contact_user, :download_remote_images_disabled)
|
||||
return true
|
||||
end
|
||||
false
|
||||
|
@ -346,7 +346,8 @@ describe CookedPostProcessor do
|
||||
before { SiteSetting.expects(:download_remote_images_threshold).returns(75) }
|
||||
|
||||
it "disables download_remote_images_threshold and send a notification to the admin" do
|
||||
SystemMessage.expects(:create).with(Discourse.site_contact_user, :download_remote_images_disabled).once
|
||||
StaffActionLogger.any_instance.expects(:log_site_setting_change).once
|
||||
SystemMessage.expects(:create_from_system_user).with(Discourse.site_contact_user, :download_remote_images_disabled).once
|
||||
cpp.disable_if_low_on_disk_space.should == true
|
||||
SiteSetting.download_remote_images_to_local.should == false
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user