FIX: Old notifications didn't link to correct post after moving post

This commit is contained in:
Gerhard Schlager
2019-07-20 21:36:18 +02:00
parent 5fc5a7f5ae
commit 1235105c03
3 changed files with 84 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ Fabricator(:notification) do
notification_type Notification.types[:mentioned]
user
topic { |attrs| attrs[:post]&.topic || Fabricate(:topic, user: attrs[:user]) }
post_number { |attrs| attrs[:post]&.post_number }
data '{"poison":"ivy","killer":"croc"}'
end
@@ -57,3 +58,17 @@ Fabricator(:posted_notification, from: :notification) do
}.to_json
end
end
Fabricator(:mentioned_notification, from: :notification) do
notification_type Notification.types[:mentioned]
data do |attrs|
{
topic_title: attrs[:topic].title,
original_post_id: attrs[:post].id,
original_post_type: attrs[:post].post_type,
original_username: attrs[:post].user.username,
revision_number: nil,
display_username: attrs[:post].user.username
}.to_json
end
end