mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: on rebakes should not recreate quoted_posts records
Previously every rebake would remove and recreate records in this table This caused created_at and updated_at to keep changing Yes, I know the SQL is somewhat complex, but this makes quote extraction more efficient cause we do everything in 2 round trips. This also removes some concurrency protection we should no longer need
This commit is contained in:
@@ -70,11 +70,19 @@ describe QuotedPost do
|
||||
HTML
|
||||
|
||||
QuotedPost.create!(post_id: post2.id, quoted_post_id: 999)
|
||||
quote = QuotedPost.create!(post_id: post2.id, quoted_post_id: post1.id)
|
||||
original_date = quote.created_at
|
||||
|
||||
freeze_time 1.hour.from_now
|
||||
|
||||
QuotedPost.extract_from(post2)
|
||||
expect(QuotedPost.where(post_id: post2.id).count).to eq(1)
|
||||
expect(QuotedPost.find_by(post_id: post2.id, quoted_post_id: post1.id)).not_to eq(nil)
|
||||
|
||||
quote.reload
|
||||
|
||||
expect(original_date).to eq_time(quote.created_at)
|
||||
|
||||
expect(post2.reply_quoted).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user