mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 10:17:19 +08:00
Add deleted_by
to Trashable
tables
This commit is contained in:
@ -215,7 +215,7 @@ describe Notification do
|
||||
|
||||
Notification.create!(read: false, user_id: p2.user_id, topic_id: p2.topic_id, post_number: p2.post_number, data: '[]',
|
||||
notification_type: Notification.types[:liked])
|
||||
p2.trash!
|
||||
p2.trash!(p.user)
|
||||
|
||||
# we may want to make notification "trashable" but for now we nuke pm notifications from deleted topics/posts
|
||||
Notification.ensure_consistency!
|
||||
|
@ -1296,16 +1296,17 @@ describe Topic do
|
||||
|
||||
describe 'trash!' do
|
||||
context "its category's topic count" do
|
||||
let(:moderator) { Fabricate(:moderator) }
|
||||
let(:category) { Fabricate(:category) }
|
||||
|
||||
it "subtracts 1 if topic is being deleted" do
|
||||
topic = Fabricate(:topic, category: category)
|
||||
expect { topic.trash! }.to change { category.reload.topic_count }.by(-1)
|
||||
expect { topic.trash!(moderator) }.to change { category.reload.topic_count }.by(-1)
|
||||
end
|
||||
|
||||
it "doesn't subtract 1 if topic is already deleted" do
|
||||
topic = Fabricate(:topic, category: category, deleted_at: 1.day.ago)
|
||||
expect { topic.trash! }.to_not change { category.reload.topic_count }
|
||||
expect { topic.trash!(moderator) }.to_not change { category.reload.topic_count }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -62,7 +62,7 @@ describe UserAction do
|
||||
|
||||
other_stats.should == expecting
|
||||
|
||||
public_topic.trash!
|
||||
public_topic.trash!(user)
|
||||
stats_for_user.should == []
|
||||
stream_count.should == 0
|
||||
|
||||
|
Reference in New Issue
Block a user