Don't try to display ugoira thumbnail/webm before they exist

This commit is contained in:
Toks
2014-12-02 15:59:43 -05:00
parent 38f51306a8
commit 601a016a98
2 changed files with 2 additions and 2 deletions

View File

@@ -154,7 +154,7 @@ class Post < ActiveRecord::Base
end
def has_ugoira_webm?
created_at < 1.minute.ago || File.exists?(preview_file_path)
created_at < 1.minute.ago || (File.exists?(preview_file_path) && File.size(preview_file_path) > 0)
end
end

View File

@@ -1,4 +1,4 @@
<% if CurrentUser.user.default_image_size == "large" && params[:original].blank? %>
<% if CurrentUser.user.default_image_size == "large" && params[:original].blank? && post.has_ugoira_webm? %>
<%= render "posts/partials/show/ugoira_webm", :post => post %>
<% else %>
<%= render "posts/partials/show/ugoira_original", :post => post %>