diff --git a/Gemfile b/Gemfile index a11708d6a..70679f76c 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,6 @@ gem "pg", "0.12.2" gem "memcache-client", :require => "memcache" gem "delayed_job" gem "delayed_job_active_record" -gem "super_exception_notifier" gem "simple_form" gem "mechanize", :git => 'git://github.com/caribio/mechanize.git' gem "nokogiri" @@ -34,9 +33,9 @@ gem 'term-ansicolor', :require => "term/ansicolor" gem 'diff-lcs', :require => "diff/lcs/array" gem 'bcrypt-ruby', :require => "bcrypt" gem 'aws-s3', :require => "aws/s3" +gem 'awesome_print' group :development do gem 'ruby-prof' gem 'pry' - gem 'awesome_print' end diff --git a/Gemfile.lock b/Gemfile.lock index 28a1edd70..b407c40f9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -162,9 +162,6 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - super_exception_notifier (3.0.13) - actionmailer - rake term-ansicolor (1.0.7) therubyracer (0.11.3) libv8 (~> 3.11.8.12) @@ -217,7 +214,6 @@ DEPENDENCIES shoulda simple_form simplecov - super_exception_notifier term-ansicolor therubyracer uglifier (>= 1.0.3) diff --git a/app/models/upload.rb b/app/models/upload.rb index ce9b7d2fb..9fe0c2e55 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -178,6 +178,8 @@ class Upload < ActiveRecord::Base end def add_dimension_tags! + return if !Danbooru.config.enable_dimension_autotagging + if image_width >= 10_000 || image_height >= 10_000 self.tag_string = "#{tag_string} incredibly_absurdres".strip elsif image_width >= 3200 || image_height >= 2400 diff --git a/config/danbooru_default_config.rb b/config/danbooru_default_config.rb index 51b8304ba..8adcaadc1 100644 --- a/config/danbooru_default_config.rb +++ b/config/danbooru_default_config.rb @@ -297,5 +297,9 @@ module Danbooru # {:smtp_server_name => "smtp server", :user_name => "user name", :ses_smtp_user_name => "smtp user name", :ses_smtp_password => "smtp password"} nil end + + def enable_dimension_autotagging + true + end end end diff --git a/test/unit/tag_alias_correction_test.rb b/test/unit/tag_alias_correction_test.rb index 32705e631..c78a9db3b 100644 --- a/test/unit/tag_alias_correction_test.rb +++ b/test/unit/tag_alias_correction_test.rb @@ -27,7 +27,7 @@ class TagAliasCorrectionTest < ActiveSupport::TestCase should "have the correct statistics hash" do assert_equal("zzz", @correction.statistics_hash["antecedent_cache"]) - assert_nil(@correction.statistics_hash["consequent_cache"]) + assert_equal("bbb", @correction.statistics_hash["consequent_cache"]) assert_equal(-3, @correction.statistics_hash["antecedent_count"]) assert_equal(1, @correction.statistics_hash["consequent_count"]) end diff --git a/test/unit/upload_test.rb b/test/unit/upload_test.rb index 7b43ec9ae..d5e3079c9 100644 --- a/test/unit/upload_test.rb +++ b/test/unit/upload_test.rb @@ -23,7 +23,7 @@ class UploadTest < ActiveSupport::TestCase FileUtils.rm_f(Dir.glob("#{Rails.root}/tmp/test.*")) end - context "that has insanely absurd res dimensions" do + context "that has incredibly absurd res dimensions" do setup do @upload = FactoryGirl.build(:jpg_upload, :tag_string => "") @upload.image_width = 10_000 @@ -31,8 +31,8 @@ class UploadTest < ActiveSupport::TestCase @upload.add_dimension_tags! end - should "have the insanely_absurdres tag" do - assert_match(/insanely_absurdres/, @upload.tag_string) + should "have the incredibly_absurdres tag" do + assert_match(/incredibly_absurdres/, @upload.tag_string) end end @@ -189,7 +189,7 @@ class UploadTest < ActiveSupport::TestCase end post = Post.last - assert_equal("foo hoge", post.tag_string) + assert_equal("foo hoge lowres", post.tag_string) assert_equal("s", post.rating) assert_equal(@upload.uploader_id, post.uploader_id) assert_equal("127.0.0.1", post.uploader_ip_addr) @@ -216,7 +216,7 @@ class UploadTest < ActiveSupport::TestCase assert_nothing_raised {@upload.process!} end post = Post.last - assert_equal("foo hoge", post.tag_string) + assert_equal("foo hoge lowres", post.tag_string) assert_equal("s", post.rating) assert_equal(@upload.uploader_id, post.uploader_id) assert_equal("127.0.0.1", post.uploader_ip_addr)