diff --git a/app/models/post.rb b/app/models/post.rb index 218f8df62..a4b56dc88 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -40,7 +40,6 @@ class Post < ApplicationRecord after_commit :remove_iqdb_async, :on => :destroy after_commit :update_iqdb_async, :on => :create after_commit :notify_pubsub - after_create {|rec| rec.uploader.increment!(:post_upload_count)} belongs_to :updater, :class_name => "User", optional: true # this is handled in versions belongs_to :approver, class_name: "User", optional: true diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index f894f254e..8b82cfd1d 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -1823,6 +1823,13 @@ class PostTest < ActiveSupport::TestCase assert_equal(user2.id, post.uploader_id) assert_equal(user2.name, post.uploader_name) end + + should "increment the uploaders post_upload_count" do + assert_difference(-> { CurrentUser.user.post_upload_count }) do + post = FactoryBot.create(:post, uploader: CurrentUser.user) + CurrentUser.user.reload + end + end end end diff --git a/test/unit/upload_test.rb b/test/unit/upload_test.rb index b5cad216e..51b5a46f2 100644 --- a/test/unit/upload_test.rb +++ b/test/unit/upload_test.rb @@ -29,13 +29,6 @@ class UploadTest < ActiveSupport::TestCase assert_equal(["You have reached your upload limit for the day"], @upload.errors.full_messages) end end - - should "increment the uploaders post_upload_count" do - assert_difference(-> { CurrentUser.user.post_upload_count }) do - FactoryBot.create(:source_upload) - CurrentUser.user.reload - end - end end end end