mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FIX: Remove post/topic image_url on post edits
- resets image_url when image is removed from first post on edit - excludes onebox icons from being featured as topic/post images
This commit is contained in:
@ -774,6 +774,21 @@ describe CookedPostProcessor do
|
||||
post.topic.reload
|
||||
expect(post.topic.image_url).to be_present
|
||||
end
|
||||
|
||||
it "removes image if post is edited and no longer has an image" do
|
||||
FastImage.stubs(:size)
|
||||
|
||||
cpp.post_process
|
||||
post.topic.reload
|
||||
expect(post.topic.image_url).to be_present
|
||||
expect(post.image_url).to be_present
|
||||
|
||||
post.update!(raw: "This post no longer has an image.")
|
||||
CookedPostProcessor.new(post).post_process
|
||||
post.topic.reload
|
||||
expect(post.topic.image_url).not_to be_present
|
||||
expect(post.image_url).not_to be_present
|
||||
end
|
||||
end
|
||||
|
||||
context "post image" do
|
||||
|
Reference in New Issue
Block a user