From 131c0109d43940406e8e3ade375edb8629164309 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 6 Dec 2017 09:01:13 -0600 Subject: [PATCH] Address #3415: `og:image` meta tags can point to video files. --- app/models/post.rb | 8 ++++++++ app/views/posts/show.html.erb | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index 2f6bc6653..d8f26e865 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -196,6 +196,14 @@ class Post < ApplicationRecord "http://#{Danbooru.config.hostname}#{preview_file_url}" end + def open_graph_image_url + if is_image? && has_large? + "http://#{Danbooru.config.hostname}#{large_file_url}" + else + complete_preview_file_url + end + end + def file_url_for(user) if CurrentUser.mobile_mode? large_file_url diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index 7fa0b6706..97bf19e60 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -174,7 +174,7 @@ <% if @post.visible? %> - + <% end %> <% if Danbooru.config.enable_post_search_counts %> @@ -189,7 +189,7 @@ <% if @post.visible? %> - + <% end %> <% end %>