2019-04-29 20:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
Fabricator(:notification) do
|
2019-01-17 17:46:04 -05:00
|
|
|
transient :post
|
2013-03-01 07:07:44 -05:00
|
|
|
notification_type Notification.types[:mentioned]
|
2020-03-31 19:09:20 -04:00
|
|
|
high_priority false
|
2013-02-05 14:16:51 -05:00
|
|
|
user
|
2019-01-17 17:46:04 -05:00
|
|
|
topic { |attrs| attrs[:post]&.topic || Fabricate(:topic, user: attrs[:user]) }
|
2019-07-20 15:36:18 -04:00
|
|
|
post_number { |attrs| attrs[:post]&.post_number }
|
2019-01-17 17:46:04 -05:00
|
|
|
data '{"poison":"ivy","killer":"croc"}'
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:quote_notification, from: :notification) do
|
2013-03-01 07:07:44 -05:00
|
|
|
notification_type Notification.types[:quoted]
|
2013-02-05 14:16:51 -05:00
|
|
|
user
|
2017-07-27 21:20:09 -04:00
|
|
|
topic { |attrs| Fabricate(:topic, user: attrs[:user]) }
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:private_message_notification, from: :notification) do
|
2013-03-01 07:07:44 -05:00
|
|
|
notification_type Notification.types[:private_message]
|
2020-03-31 19:09:20 -04:00
|
|
|
high_priority true
|
2019-01-17 17:46:04 -05: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
|
|
|
|
|
2020-03-31 19:09:20 -04:00
|
|
|
Fabricator(:bookmark_reminder_notification, from: :notification) do
|
|
|
|
notification_type Notification.types[:bookmark_reminder]
|
|
|
|
high_priority true
|
|
|
|
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,
|
|
|
|
bookmark_name: "Check out Mr Freeze's opinion here"
|
|
|
|
}.to_json
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-01-17 17:46:04 -05:00
|
|
|
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-05 14:16:51 -05:00
|
|
|
end
|
2019-07-20 15:36:18 -04:00
|
|
|
|
|
|
|
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
|
2019-08-12 16:59:43 -04:00
|
|
|
|
|
|
|
Fabricator(:watching_first_post_notification, from: :notification) do
|
|
|
|
notification_type Notification.types[:watching_first_post]
|
|
|
|
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
|