[deploy] update articles when touched by reactions (#7001)

This commit is contained in:
Molly Struve 2020-04-01 13:26:56 -05:00 committed by GitHub
parent be63775a46
commit ef358c0213
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -309,6 +309,7 @@ class Article < ApplicationRecord
def touch_by_reaction
async_score_calc
index!
index_to_elasticsearch
end
def comments_blob

View file

@ -851,4 +851,12 @@ RSpec.describe Article, type: :model do
expect(feed_article.attributes.keys).to match_array(fields)
end
end
describe "#touch_by_reaction" do
it "reindexes elasticsearch doc" do
sidekiq_assert_enqueued_with(job: Search::IndexToElasticsearchWorker, args: [described_class.to_s, article.search_id]) do
article.touch_by_reaction
end
end
end
end