diff --git a/app/components/post_preview_component.rb b/app/components/post_preview_component.rb index bbd1df72c..de5eb5eea 100644 --- a/app/components/post_preview_component.rb +++ b/app/components/post_preview_component.rb @@ -56,9 +56,7 @@ class PostPreviewComponent < ApplicationComponent def variant case size - when "150" - media_asset.variant("preview") - when "180" + when "150", "180" media_asset.variant("180x180") when "225", "225w" media_asset.variant("360x360") diff --git a/app/components/post_preview_component/post_preview_component.html.erb b/app/components/post_preview_component/post_preview_component.html.erb index f3395b155..6561ad76f 100644 --- a/app/components/post_preview_component/post_preview_component.html.erb +++ b/app/components/post_preview_component/post_preview_component.html.erb @@ -17,9 +17,7 @@ <% unless save_data %> <% case size %> - <% when "150" %> - <%# no-op %> - <% when "180" %> + <% when "150", "180" %> <%= tag.source type: "image/jpeg", srcset: "#{media_asset.variant("180x180").file_url} 1x, #{media_asset.variant("360x360").file_url} 2x" %> <% else # 225 to 360 %> <%= tag.source type: "image/webp", srcset: "#{media_asset.variant("360x360").file_url} 1x, #{media_asset.variant("720x720").file_url} 2x" %> diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index e03440c3b..b2b7b290c 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -93,7 +93,7 @@ class CommentsController < ApplicationController @comments = Comment.paginated_search(params) if request.format.atom? - @comments = @comments.includes(:creator, :post) + @comments = @comments.includes(:creator, post: [:media_asset]) @comments = @comments.select { |comment| comment.post.visible? } elsif request.format.html? @comments = @comments.includes(:creator, :updater, post: [:uploader, :media_asset]) diff --git a/app/helpers/seo_helper.rb b/app/helpers/seo_helper.rb index e04b2163f..39e58a2c5 100644 --- a/app/helpers/seo_helper.rb +++ b/app/helpers/seo_helper.rb @@ -20,7 +20,7 @@ module SeoHelper name: page_title, description: meta_description, uploadDate: post.created_at.iso8601, - thumbnailUrl: post.preview_file_url, + thumbnailUrl: post.media_asset.variant("360x360").file_url, contentUrl: post.file_url, }) end diff --git a/app/logical/discord_slash_command/post_embed.rb b/app/logical/discord_slash_command/post_embed.rb index 270a15328..302057d86 100644 --- a/app/logical/discord_slash_command/post_embed.rb +++ b/app/logical/discord_slash_command/post_embed.rb @@ -26,9 +26,9 @@ class DiscordSlashCommand if is_censored? nil elsif post.file_ext.match?(/jpe?g|png|gif/) - post.file_url + post.media_asset.variant("original").file_url else - post.preview_file_url + post.media_asset.variant("360x360").file_url end end diff --git a/app/views/comments/index.atom.builder b/app/views/comments/index.atom.builder index d89a15700..f0a6b392b 100644 --- a/app/views/comments/index.atom.builder +++ b/app/views/comments/index.atom.builder @@ -11,7 +11,7 @@ atom_feed(root_url: comments_url(host: Danbooru.config.hostname)) do |feed| feed.entry(comment, published: comment.created_at, updated: comment.updated_at) do |entry| entry.title("@#{comment.creator.name} on post ##{comment.post_id} (#{comment.post.presenter.humanized_essential_tag_string})") entry.content(<<-EOS.strip_heredoc, type: "html") - + #{format_text(comment.body)} EOS diff --git a/app/views/posts/index.atom.erb b/app/views/posts/index.atom.erb index 37c410a23..a5e9b2389 100644 --- a/app/views/posts/index.atom.erb +++ b/app/views/posts/index.atom.erb @@ -23,7 +23,7 @@
<%= link_to post_url(post) do %> - <%= image_tag post.preview_file_url %> + <%= image_tag post.media_asset.variant("360x360").file_url %> <% end %>

<%= post.tag_string %>

diff --git a/app/views/posts/index.sitemap.erb b/app/views/posts/index.sitemap.erb index 260be89b1..c1adc7ebf 100644 --- a/app/views/posts/index.sitemap.erb +++ b/app/views/posts/index.sitemap.erb @@ -12,12 +12,12 @@ <% if post.visible? %> <% if post.is_image? %> - <%= post.file_url %> + <%= post.media_asset.variant("original").file_url %> <% elsif post.is_video? %> - <%= post.preview_file_url %> - <%= post.file_url %> + <%= post.media_asset.variant("360x360").file_url %> + <%= post.media_asset.variant("original").file_url %> <%= post.created_at.iso8601 %> <%= "Post ##{post.id}" %> <%= post.tag_string %>