From 79077df713ecacfa7c9d56a768bee1fad28323e9 Mon Sep 17 00:00:00 2001 From: evazion Date: Tue, 4 Aug 2020 12:01:41 -0500 Subject: [PATCH] posts: don't move favorites to parent when expunging. Don't automatically move favorites to the parent when expunging a post. This can be done manually if necessary. Posts shouldn't have their favorites moved unless they're duplicates, which expunged posts usually aren't. --- app/models/post.rb | 1 - test/unit/post_test.rb | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index de38f1edd..30120b034 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -973,7 +973,6 @@ class Post < ApplicationRecord Post.without_timeout do ModAction.log("permanently deleted post ##{id}", :post_permanent_delete) - give_favorites_to_parent update_children_on_destroy decrement_tag_post_counts remove_from_all_pools diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index 73de4156b..d8349b44f 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -224,18 +224,6 @@ class PostTest < ActiveSupport::TestCase assert_equal(false, p1.has_children?) end - should "reassign favorites to the parent" do - p1 = FactoryBot.create(:post) - c1 = FactoryBot.create(:post, :parent_id => p1.id) - user = FactoryBot.create(:user) - c1.add_favorite!(user) - c1.expunge! - p1.reload - assert(!Favorite.exists?(:post_id => c1.id, :user_id => user.id)) - assert(Favorite.exists?(:post_id => p1.id, :user_id => user.id)) - assert_equal(0, c1.score) - end - should "update the parent's has_children flag" do p1 = FactoryBot.create(:post) c1 = FactoryBot.create(:post, :parent_id => p1.id)