diff --git a/app/logical/anonymous_user.rb b/app/logical/anonymous_user.rb index 2362fa8c9..184889197 100644 --- a/app/logical/anonymous_user.rb +++ b/app/logical/anonymous_user.rb @@ -257,7 +257,7 @@ class AnonymousUser false end - def cropped_thumbnails? + def disable_cropped_thumbnails? false end diff --git a/app/models/post.rb b/app/models/post.rb index f9e1258f4..ac0ec6a90 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -57,7 +57,7 @@ class Post < ApplicationRecord end attr_accessible :source, :rating, :tag_string, :old_tag_string, :old_parent_id, :old_source, :old_rating, :parent_id, :has_embedded_notes, :as => [:member, :builder, :gold, :platinum, :moderator, :admin, :default] - attr_accessible :is_rating_locked, :is_note_locked, :as => [:builder, :moderator, :admin] + attr_accessible :is_rating_locked, :is_note_locked, :has_cropped, :as => [:builder, :moderator, :admin] attr_accessible :is_status_locked, :as => [:admin] attr_accessor :old_tag_string, :old_parent_id, :old_source, :old_rating, :has_constraints, :disable_versioning, :view_count @@ -171,7 +171,11 @@ class Post < ApplicationRecord return "/images/download-preview.png" end - "/data/preview/#{file_path_prefix}#{md5}.jpg" + if has_cropped? && !CurrentUser.disable_cropped_thumbnails? + "https://s3.amazonaws.com/#{Danbooru.config.aws_s3_bucket_name}/cropped/small/#{md5}.jpg" + else + "/data/preview/#{file_path_prefix}#{md5}.jpg" + end end def complete_preview_file_url @@ -1767,6 +1771,7 @@ class Post < ApplicationRecord BOOLEAN_ATTRIBUTES = %w( has_embedded_notes + has_cropped ) has_bit_flags BOOLEAN_ATTRIBUTES diff --git a/app/models/user.rb b/app/models/user.rb index 9b443d0e6..00b1d44f4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -45,7 +45,7 @@ class User < ApplicationRecord is_super_voter disable_tagged_filenames enable_recent_searches - cropped_thumbnails + disable_cropped_thumbnails ) include Danbooru::HasBitFlags diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb index 450fe16c7..fbe33a8ff 100644 --- a/app/presenters/post_presenter.rb +++ b/app/presenters/post_presenter.rb @@ -32,7 +32,7 @@ class PostPresenter < Presenter tag_param = nil end html << %{} - html << %{#{h(post.tag_string)}} + html << %{#{h(post.tag_string)}} html << %{} if options[:pool] diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index fc8fe38dd..282560602 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -74,6 +74,8 @@ <%= f.input :disable_tagged_filenames, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %> + <%= f.input :disable_cropped_thumbnails, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %> + <%= f.input :enable_recent_searches, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %> <%= f.input :favorite_tags, :label => "Frequent tags", :hint => "A list of tags that you use often. They will appear when using the list of Related Tags.", :input_html => { :rows => 5, :data => { :autocomplete => "tag-query" } } %>