diff --git a/app/models/dmail.rb b/app/models/dmail.rb index 3a5f78c89..a789384d9 100644 --- a/app/models/dmail.rb +++ b/app/models/dmail.rb @@ -155,7 +155,7 @@ class Dmail < ApplicationRecord end def validate_sender_is_not_limited - return if from.is_gold? + return if from.blank? || from.is_gold? if from.dmails.where("created_at > ?", 1.hour.ago).group(:to).reorder(nil).count.size >= 10 errors[:base] << "You can't send dmails to more than 10 users per hour" diff --git a/test/functional/uploads_controller_test.rb b/test/functional/uploads_controller_test.rb index 498b18c54..c6e2cd07f 100644 --- a/test/functional/uploads_controller_test.rb +++ b/test/functional/uploads_controller_test.rb @@ -362,7 +362,7 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest should_upload_successfully("https://twitter.com/noizave/status/875768175136317440") should_upload_successfully("https://pbs.twimg.com/media/DCdZ_FhUIAAYKFN?format=jpg&name=medium") - should_upload_successfully("https://pbs.twimg.com/profile_banners/1225702850002468864/1588597370/1500x500") + should_upload_successfully("https://pbs.twimg.com/profile_banners/1130156172399353857/1597419344/1500x500") # XXX should_upload_successfully("https://video.twimg.com/tweet_video/EWHWVrmVcAAp4Vw.mp4") should_upload_successfully("https://www.weibo.com/5501756072/J2UNKfbqV") @@ -372,8 +372,8 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest should_upload_successfully("https://art.ngfiles.com/comments/57000/iu_57615_7115981.jpg") should_upload_successfully("https://www.newgrounds.com/art/view/puddbytes/costanza-at-bat") - should_upload_successfully("https://www.fanbox.cc/@tsukiori/posts/1080657") - should_upload_successfully("https://downloads.fanbox.cc/images/post/1080657/SaakPC251KafLL6jIo1WPPmr.png") + should_upload_successfully("https://kmyama.fanbox.cc/posts/104708") + should_upload_successfully("https://downloads.fanbox.cc/images/post/104708/wsF73EC5Fq0CIK84W0LGYk2p.jpeg") end end end diff --git a/test/unit/downloads/pixiv_test.rb b/test/unit/downloads/pixiv_test.rb index 02d923c02..7b2ea08b7 100644 --- a/test/unit/downloads/pixiv_test.rb +++ b/test/unit/downloads/pixiv_test.rb @@ -116,7 +116,7 @@ module Downloads should "download new novel images" do @file_url = "https://i.pximg.net/novel-cover-original/img/2017/07/27/23/14/17/8465454_80685d10e6df4d7d53ad347ddc18a36b.jpg" @ref = 'https://www.pixiv.net/novel/show.php?id=8465454&mode=cover' - @file_size = 532_129 + @file_size = 532_037 assert_not_rewritten(@file_url, @ref) assert_downloaded(@file_size, @file_url, @ref) diff --git a/test/unit/sources/newgrounds_test.rb b/test/unit/sources/newgrounds_test.rb index f4195de37..d8a20e9d1 100644 --- a/test/unit/sources/newgrounds_test.rb +++ b/test/unit/sources/newgrounds_test.rb @@ -4,10 +4,11 @@ module Sources class NewGroundsTest < ActiveSupport::TestCase context "The source for a newgrounds picture" do setup do - @url = "https://www.newgrounds.com/art/view/natthelich/fire-emblem-marth-plus-progress-pic" - @comment = "https://art.ngfiles.com/comments/57000/iu_57615_7115981.jpg" + @url = "https://www.newgrounds.com/art/view/natthelich/d-d-light-domain-cleric-nathaniel-8" + @image_url = "https://art.ngfiles.com/images/1138000/1138016_natthelich_d-d-light-domain-cleric-nathaniel-8.png?f1578591058" + @comment = "https://art.ngfiles.com/comments/84000/iu_84427_7115981.jpg" @image_1 = Sources::Strategies.find(@url) - @image_2 = Sources::Strategies.find("https://art.ngfiles.com/images/1033000/1033622_natthelich_fire-emblem-marth-plus-progress-pic.png?f1569487181") + @image_2 = Sources::Strategies.find(@image_url) @image_3 = Sources::Strategies.find(@comment, @url) end @@ -18,9 +19,9 @@ module Sources end should "get the artist commentary title" do - assert_equal("Fire Emblem - Marth (plus progress pic)", @image_1.artist_commentary_title) - assert_equal("Fire Emblem - Marth (plus progress pic)", @image_2.artist_commentary_title) - assert_equal("Fire Emblem - Marth (plus progress pic)", @image_3.artist_commentary_title) + assert_equal("D&D - Light Domain Cleric, Nathaniel", @image_1.artist_commentary_title) + assert_equal("D&D - Light Domain Cleric, Nathaniel", @image_2.artist_commentary_title) + assert_equal("D&D - Light Domain Cleric, Nathaniel", @image_3.artist_commentary_title) end should "get profile url" do @@ -30,10 +31,10 @@ module Sources end should "get the image urls" do - assert_match(%r{https?://art\.ngfiles\.com/images/1033000/1033622_natthelich_fire-emblem-marth-plus-progress-pic\.png(?:\?\w+)?}i, @image_1.image_url) + assert_match(%r{https://art.ngfiles.com/images/1138000/1138016_natthelich_d-d-light-domain-cleric-nathaniel-8.png}i, @image_1.image_url) assert_includes(@image_1.image_urls, @comment) - assert_match(%r{https?://art\.ngfiles\.com/images/1033000/1033622_natthelich_fire-emblem-marth-plus-progress-pic\.png(?:\?\w+)?}i, @image_2.image_url) + assert_match(%r{https://art.ngfiles.com/images/1138000/1138016_natthelich_d-d-light-domain-cleric-nathaniel-8.png}i, @image_2.image_url) assert_equal(@comment, @image_3.image_url) end @@ -44,16 +45,18 @@ module Sources end should "download an image" do - assert_downloaded(630365, @image_1.image_url) - assert_downloaded(630365, @image_2.image_url) - assert_downloaded(129033, @image_3.image_url) + assert_downloaded(1195723, @image_1.image_url) + assert_downloaded(1195723, @image_2.image_url) + assert_downloaded(158058, @image_3.image_url) end should "get the tags" do tags = [ - %w[fire-emblem https://www.newgrounds.com/search/conduct/art?match=tags&tags=fire-emblem], - %w[marth https://www.newgrounds.com/search/conduct/art?match=tags&tags=marth ] + %w[cleric https://www.newgrounds.com/search/conduct/art?match=tags&tags=cleric], + %w[nathaniel https://www.newgrounds.com/search/conduct/art?match=tags&tags=nathaniel], + %w[oc https://www.newgrounds.com/search/conduct/art?match=tags&tags=oc] ] + assert_equal(tags, @image_1.tags) assert_equal(tags, @image_2.tags) assert_equal(tags, @image_3.tags) diff --git a/test/unit/sources/pixiv_test.rb b/test/unit/sources/pixiv_test.rb index d9a96a348..a68d75ad0 100644 --- a/test/unit/sources/pixiv_test.rb +++ b/test/unit/sources/pixiv_test.rb @@ -98,7 +98,7 @@ module Sources end should "get the remote image size" do - assert_equal(854_653, @site.remote_size) + assert_equal(863_758, @site.remote_size) end should "get the full size image url" do diff --git a/test/unit/upload_service_test.rb b/test/unit/upload_service_test.rb index 51a7a30b5..c8041ebfe 100644 --- a/test/unit/upload_service_test.rb +++ b/test/unit/upload_service_test.rb @@ -135,9 +135,9 @@ class UploadServiceTest < ActiveSupport::TestCase @upload = @service.start! assert_equal("preprocessed", @upload.status) - assert_equal(294591, @upload.file_size) + assert_equal(317733, @upload.file_size) assert_equal("jpg", @upload.file_ext) - assert_equal("3cb1ef624714c15dbb2d6e7b1d57faef", @upload.md5) + assert_equal("4c71da5638b897aa6da1150e742e2982", @upload.md5) assert(File.exist?(Danbooru.config.storage_manager.file_path(@upload.md5, "jpg", :original))) assert(File.exist?(Danbooru.config.storage_manager.file_path(@upload.md5, "jpg", :preview))) end