[Replacements] Fix showing non-safe thumbs on e926

This commit is contained in:
Earlopain 2022-07-11 22:23:12 +02:00
parent 1c98fde1c8
commit bdfea45e0e
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
2 changed files with 8 additions and 7 deletions

View File

@ -1,10 +1,13 @@
module PostReplacementHelper
def replacement_thumbnail(replacement)
return tag.a(image_tag(replacement.replacement_thumb_url), href: replacement.replacement_file_url) if replacement.file_visible_to?(CurrentUser.user)
if replacement.post.deleteblocked?
image_tag(Danbooru.config.deleted_preview_url)
else
image_tag(replacement.replacement_thumb_url)
elsif replacement.post.visible?
if replacement.original_file_visible_to?(CurrentUser)
tag.a(image_tag(replacement.replacement_thumb_url), href: replacement.replacement_file_url)
else
image_tag(replacement.replacement_thumb_url)
end
end
end
end

View File

@ -308,9 +308,8 @@ class PostReplacement < ApplicationRecord
end
end
def file_visible_to?(user)
return true if user.is_janitor?
false
def original_file_visible_to?(user)
user.is_janitor?
end
include ApiMethods
@ -319,5 +318,4 @@ class PostReplacement < ApplicationRecord
include ProcessingMethods
include PromotionMethods
include PostMethods
end