FIX: Do not raise if post no longer exists (#12428)

This commit is contained in:
Bianca Nenciu 2021-03-17 19:22:05 +02:00 committed by GitHub
parent 52859bdeab
commit 97623f5351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -304,7 +304,7 @@ module Jobs
.where(user_id: @current_user.id)
.where(post_action_type_id: PostActionType.types[:like])
.each do |pa|
post = Post.with_deleted.find(pa.post_id)
post = Post.with_deleted.find_by(id: pa.post_id)
yield [
pa.id,
pa.post_id,

View File

@ -396,6 +396,7 @@ describe Jobs::ExportUserArchive do
PostActionCreator.like(user, post3)
PostActionCreator.like(admin, post3)
PostActionDestroyer.destroy(user, post3, :like)
post3.destroy!
data, csv_out = make_component_csv
expect(data.length).to eq(2)