UX: Stop falling back to topic image on embeds (#18720)

If linked post (not OP) has no image, it won't fall back to the topic
image anymore.
This commit is contained in:
Jan Cernik 2022-10-24 14:54:02 -03:00 committed by GitHub
parent c421dc0b28
commit 25fbbf4020
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -301,8 +301,8 @@ class TopicView
end
def image_url
url = desired_post&.image_url if @post_number > 1
url || @topic.image_url
return @topic.image_url if @post_number == 1
desired_post&.image_url
end
def filter_posts(opts = {})

View File

@ -895,9 +895,9 @@ RSpec.describe TopicView do
post1.update_column(:image_upload_id, op_upload.id)
end
it "uses the topic image as a fallback when posts have no image" do
it "uses the topic image for op and posts image when they have one" do
expect(topic_view_for_post(1).image_url).to end_with(op_upload.url)
expect(topic_view_for_post(2).image_url).to end_with(op_upload.url)
expect(topic_view_for_post(2).image_url).to eq(nil)
expect(topic_view_for_post(3).image_url).to end_with(post3_upload.url)
end
end