2013-02-06 03:16:51 +08:00
|
|
|
Fabricator(:notification) do
|
2019-01-18 06:46:04 +08:00
|
|
|
transient :post
|
2013-03-01 20:07:44 +08:00
|
|
|
notification_type Notification.types[:mentioned]
|
2013-02-06 03:16:51 +08:00
|
|
|
user
|
2019-01-18 06:46:04 +08:00
|
|
|
topic { |attrs| attrs[:post]&.topic || Fabricate(:topic, user: attrs[:user]) }
|
|
|
|
data '{"poison":"ivy","killer":"croc"}'
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:quote_notification, from: :notification) do
|
2013-03-01 20:07:44 +08:00
|
|
|
notification_type Notification.types[:quoted]
|
2013-02-06 03:16:51 +08:00
|
|
|
user
|
2017-07-28 09:20:09 +08:00
|
|
|
topic { |attrs| Fabricate(:topic, user: attrs[:user]) }
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:private_message_notification, from: :notification) do
|
2013-03-01 20:07:44 +08:00
|
|
|
notification_type Notification.types[:private_message]
|
2019-01-18 06:46:04 +08:00
|
|
|
data do |attrs|
|
|
|
|
post = attrs[:post] || Fabricate(:post, topic: attrs[:topic], user: attrs[:user])
|
|
|
|
{
|
|
|
|
topic_title: attrs[:topic].title,
|
|
|
|
original_post_id: post.id,
|
|
|
|
original_post_type: post.post_type,
|
|
|
|
original_username: post.user.username,
|
|
|
|
revision_number: nil,
|
|
|
|
display_username: post.user.username
|
|
|
|
}.to_json
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:replied_notification, from: :notification) do
|
|
|
|
notification_type Notification.types[:replied]
|
|
|
|
data do |attrs|
|
|
|
|
post = attrs[:post] || Fabricate(:post, topic: attrs[:topic], user: attrs[:user])
|
|
|
|
{
|
|
|
|
topic_title: attrs[:topic].title,
|
|
|
|
original_post_id: post.id,
|
|
|
|
original_username: post.user.username,
|
|
|
|
revision_number: nil,
|
|
|
|
display_username: post.user.username
|
|
|
|
}.to_json
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:posted_notification, from: :notification) do
|
|
|
|
notification_type Notification.types[:posted]
|
|
|
|
data do |attrs|
|
|
|
|
post = attrs[:post] || Fabricate(:post, topic: attrs[:topic], user: attrs[:user])
|
|
|
|
{
|
|
|
|
topic_title: attrs[:topic].title,
|
|
|
|
original_post_id: post.id,
|
|
|
|
original_post_type: post.post_type,
|
|
|
|
original_username: post.user.username,
|
|
|
|
revision_number: nil,
|
|
|
|
display_username: post.user.username
|
|
|
|
}.to_json
|
|
|
|
end
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|