mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 21:25:24 +08:00
Merge branch 'master' into search_posts_with_images
This commit is contained in:
@ -9,7 +9,7 @@ class CookedPostProcessor
|
||||
|
||||
attr_reader :cooking_options
|
||||
|
||||
def initialize(post, opts={})
|
||||
def initialize(post, opts = {})
|
||||
@dirty = false
|
||||
@opts = opts
|
||||
@post = post
|
||||
@ -63,7 +63,7 @@ class CookedPostProcessor
|
||||
|
||||
upload_ids |= oneboxed_image_uploads.pluck(:id)
|
||||
|
||||
values = upload_ids.map{ |u| "(#{@post.id},#{u})" }.join(",")
|
||||
values = upload_ids.map { |u| "(#{@post.id},#{u})" }.join(",")
|
||||
PostUpload.transaction do
|
||||
PostUpload.delete_all(post_id: @post.id)
|
||||
if upload_ids.length > 0
|
||||
@ -138,11 +138,11 @@ class CookedPostProcessor
|
||||
original_width, original_height = original_image_size.map(&:to_f)
|
||||
|
||||
if w > 0
|
||||
ratio = w/original_width
|
||||
[w.floor, (original_height*ratio).floor]
|
||||
ratio = w / original_width
|
||||
[w.floor, (original_height * ratio).floor]
|
||||
else
|
||||
ratio = h/original_height
|
||||
[(original_width*ratio).floor, h.floor]
|
||||
ratio = h / original_height
|
||||
[(original_width * ratio).floor, h.floor]
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -234,7 +234,7 @@ class CookedPostProcessor
|
||||
false
|
||||
end
|
||||
|
||||
def add_lightbox!(img, original_width, original_height, upload=nil)
|
||||
def add_lightbox!(img, original_width, original_height, upload = nil)
|
||||
# first, create a div to hold our lightbox
|
||||
lightbox = Nokogiri::XML::Node.new("div", @doc)
|
||||
lightbox["class"] = "lightbox-wrapper"
|
||||
@ -279,7 +279,7 @@ class CookedPostProcessor
|
||||
return I18n.t("upload.pasted_image_filename")
|
||||
end
|
||||
|
||||
def create_span_node(klass, content=nil)
|
||||
def create_span_node(klass, content = nil)
|
||||
span = Nokogiri::XML::Node.new("span", @doc)
|
||||
span.content = content if content
|
||||
span["class"] = klass
|
||||
@ -377,7 +377,7 @@ class CookedPostProcessor
|
||||
# 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 })
|
||||
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
|
||||
notify_about_low_disk_space
|
||||
|
Reference in New Issue
Block a user