Revert "Revert "Merge branch 'master' of https://github.com/discourse/discourse""

This reverts commit 20780a1eeed56b321daf18ee6bbfe681a51d1bf4.

* SECURITY: re-adds accidentally reverted commit:
  03d26cd6: ensure embed_url contains valid http(s) uri
* when the merge commit e62a85cf was reverted, git chose the 2660c2e2 parent to land on
  instead of the 03d26cd6 parent (which contains security fixes)
This commit is contained in:
Michael Brown
2020-05-23 00:56:13 -04:00
parent 20780a1eee
commit d9a02d1336
236 changed files with 1031 additions and 715 deletions

View File

@ -159,14 +159,6 @@ class Post < ActiveRecord::Base
includes(:post_details).find_by(post_details: { key: key, value: value })
end
def self.excerpt_size=(sz)
@excerpt_size = sz
end
def self.excerpt_size
@excerpt_size || 220
end
def whisper?
post_type == Post.types[:whisper]
end
@ -482,7 +474,7 @@ class Post < ActiveRecord::Base
end
def excerpt_for_topic
Post.excerpt(cooked, Post.excerpt_size, strip_links: true, strip_images: true, post: self)
Post.excerpt(cooked, SiteSetting.topic_excerpt_maxlength, strip_links: true, strip_images: true, post: self)
end
def is_first_post?
@ -658,6 +650,10 @@ class Post < ActiveRecord::Base
baked_version: BAKED_VERSION
)
if is_first_post?
topic.update_excerpt(excerpt_for_topic)
end
if invalidate_broken_images
custom_fields.delete(BROKEN_IMAGES)
save_custom_fields