A platform for community discussion. Free, open, simple.
UX: Stop falling back to topic image on embeds (#18720)
Jan Cernik25fbbf4020c8
diff --git a/lib/topic_view.rb b/lib/topic_view.rbindex 1c2ed0e7b05..b242d035031 100644--- a/lib/topic_view.rb+++ b/lib/topic_view.rb@@ -301,8 +301,8 @@ class TopicViewenddef 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_urlenddef filter_posts(opts = {})diff --git a/spec/lib/topic_view_spec.rb b/spec/lib/topic_view_spec.rbindex 927518bd00d..7282eca5352 100644--- a/spec/lib/topic_view_spec.rb+++ b/spec/lib/topic_view_spec.rb@@ -895,9 +895,9 @@ RSpec.describe TopicView dopost1.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" doexpect(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)endend