diff --git a/.circleci/config.yml b/.circleci/config.yml index cabbd2605..ef0ded856 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,6 +45,9 @@ jobs: - run: name: Test splitting command: | + ping -c 5 public-api.secure.pixiv.net + ping -c 5 oauth.secure.pixiv.net + ping -c 5 www.pixiv.net circleci tests glob test/**/*_test.rb | circleci tests split | xargs -I{} docker-compose -f config/docker/compose.yml exec -T web bash -l -c 'cd /app ; bin/rails test {}' docker cp docker_web_1:/app/test/reports /tmp - store_test_results: diff --git a/app/logical/pixiv_api_client.rb b/app/logical/pixiv_api_client.rb index 46f04b725..76c3abaaa 100644 --- a/app/logical/pixiv_api_client.rb +++ b/app/logical/pixiv_api_client.rb @@ -155,7 +155,7 @@ class PixivApiClient raise Error.new("Pixiv API call failed (status=#{resp.code} body=#{body})") end rescue Net::OpenTimeout - print "R" + print "R" if Rails.env.test? sleep(5) retry rescue JSON::ParserError @@ -191,7 +191,7 @@ class PixivApiClient end rescue Net::OpenTimeout - print "R" + print "R" if Rails.env.test? sleep(5) retry end diff --git a/app/models/forum_post.rb b/app/models/forum_post.rb index a260e266d..b5c1d2a60 100644 --- a/app/models/forum_post.rb +++ b/app/models/forum_post.rb @@ -134,6 +134,10 @@ class ForumPost < ApplicationRecord end end + def tag_change_request + bulk_update_request || tag_alias || tag_implication + end + def votable? # shortcut to eliminate posts that are probably not tag change requests body =~ /->/ && (bulk_update_request.present? || tag_alias.present? || tag_implication.present?) && created_at >= TagRelationship::EXPIRY.days.ago diff --git a/app/views/forum_post_votes/_list.html.erb b/app/views/forum_post_votes/_list.html.erb index 2026f5b83..e8475be13 100644 --- a/app/views/forum_post_votes/_list.html.erb +++ b/app/views/forum_post_votes/_list.html.erb @@ -11,6 +11,6 @@ <%= render "forum_post_votes/vote", vote: vote, forum_post: forum_post %> <% end %> -<% if !votes.by(CurrentUser.user.id).exists? %> +<% if forum_post.tag_change_request.is_pending? && !votes.by(CurrentUser.user.id).exists? %> <%= render "forum_post_votes/add_vote", vote: votes.by(CurrentUser.user.id).first, forum_post: forum_post %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/forum_post_votes/_vote.html.erb b/app/views/forum_post_votes/_vote.html.erb index 0246d2125..30f6cb8ce 100644 --- a/app/views/forum_post_votes/_vote.html.erb +++ b/app/views/forum_post_votes/_vote.html.erb @@ -4,7 +4,7 @@ %>