From 51bc953383e6ce4c47d1aab204e97259bce0a077 Mon Sep 17 00:00:00 2001 From: evazion Date: Sat, 25 Sep 2021 06:29:51 -0500 Subject: [PATCH] post preview component: remove workaround for blank width/height. Remove workaround for old posts that had a null width or height. These posts were fixed a while ago. --- app/components/post_preview_component.rb | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/components/post_preview_component.rb b/app/components/post_preview_component.rb index 9a867cdfa..80ea2205e 100644 --- a/app/components/post_preview_component.rb +++ b/app/components/post_preview_component.rb @@ -40,17 +40,12 @@ class PostPreviewComponent < ApplicationComponent end def preview_dimensions - # XXX work around ancient bad posts with null or zero dimensions. - if post.image_width.to_i > 0 && post.image_height.to_i > 0 - downscale_ratio = Danbooru.config.small_image_width.to_f / [post.image_width, post.image_height].max + downscale_ratio = Danbooru.config.small_image_width.to_f / [post.image_width, post.image_height].max - { - width: [(downscale_ratio * post.image_width).floor, post.image_width].min, - height: [(downscale_ratio * post.image_height).floor, post.image_height].min, - } - else - { width: 0, height: 0 } - end + { + width: [(downscale_ratio * post.image_width).floor, post.image_width].min, + height: [(downscale_ratio * post.image_height).floor, post.image_height].min, + } end def tooltip