Add missing data for org milestone notifications (#1939)

* Remove duplicate line

* Add missing json_data for org notifications
This commit is contained in:
Andy Zhao 2019-03-01 16:42:38 -05:00 committed by Ben Halpern
parent 8b8dbd0172
commit b157190ef0
2 changed files with 4 additions and 3 deletions

View file

@ -6,7 +6,6 @@ class RandomGif
"9PyhoXey73EpW" => { aspect_ratio: 0.753 },
"OcZp0maz6ALok" => { aspect_ratio: 1.000 },
"Is1O1TWV0LEJi" => { aspect_ratio: 0.565 },
"xjZtu4qi1biIo" => { aspect_ratio: 1.0000 },
"lz24Z42jLcTa8" => { aspect_ratio: 0.776 },
"g9582DNuQppxC" => { aspect_ratio: 0.562 },
"l4HodBpDmoMA5p9bG" => { aspect_ratio: 1.000 },

View file

@ -258,11 +258,13 @@ class Notification < ApplicationRecord
milestone_hash[:next_milestone] = next_milestone(milestone_hash)
return unless should_send_milestone?(milestone_hash)
json_data = { article: article_data(milestone_hash[:article]), gif_id: RandomGif.new.random_id }
Notification.create!(
user_id: milestone_hash[:article].user_id,
notifiable_id: milestone_hash[:article].id,
notifiable_type: "Article",
json_data: { article: article_data(milestone_hash[:article]), gif_id: RandomGif.new.random_id },
json_data: json_data,
action: "Milestone::#{milestone_hash[:type]}::#{milestone_hash[:next_milestone]}",
)
if milestone_hash[:article].organization_id
@ -270,7 +272,7 @@ class Notification < ApplicationRecord
organization_id: milestone_hash[:article].organization_id,
notifiable_id: milestone_hash[:article].id,
notifiable_type: "Article",
json_data: { article: article_data(milestone_hash[:article]) },
json_data: json_data,
action: "Milestone::#{milestone_hash[:type]}::#{milestone_hash[:next_milestone]}",
)
end