2019-12-11 12:04:02 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
Fabricator(:bookmark) do
|
|
|
|
user
|
2022-04-22 06:23:42 +08:00
|
|
|
post {
|
|
|
|
if !SiteSetting.use_polymorphic_bookmarks
|
|
|
|
Fabricate(:post)
|
|
|
|
end
|
|
|
|
}
|
2019-12-11 12:04:02 +08:00
|
|
|
name "This looked interesting"
|
2020-03-12 08:16:00 +08:00
|
|
|
reminder_at { 1.day.from_now.iso8601 }
|
|
|
|
reminder_set_at { Time.zone.now }
|
2022-04-22 06:23:42 +08:00
|
|
|
bookmarkable {
|
|
|
|
if SiteSetting.use_polymorphic_bookmarks
|
|
|
|
Fabricate(:post)
|
|
|
|
end
|
|
|
|
}
|
2022-03-30 10:43:11 +08:00
|
|
|
|
|
|
|
# TODO (martin) [POLYBOOK] Not relevant once polymorphic bookmarks are implemented.
|
|
|
|
before_create do |bookmark|
|
|
|
|
if bookmark.bookmarkable_id.present? || bookmark.bookmarkable.present?
|
|
|
|
bookmark.post = nil
|
|
|
|
bookmark.post_id = nil
|
|
|
|
bookmark.for_topic = false
|
|
|
|
end
|
|
|
|
end
|
2019-12-11 12:04:02 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:bookmark_next_business_day_reminder, from: :bookmark) do
|
|
|
|
reminder_at do
|
2020-03-12 08:16:00 +08:00
|
|
|
date = if Time.zone.now.friday?
|
|
|
|
Time.zone.now + 3.days
|
|
|
|
elsif Time.zone.now.saturday?
|
|
|
|
Time.zone.now + 2.days
|
2019-12-11 12:04:02 +08:00
|
|
|
else
|
2020-03-12 08:16:00 +08:00
|
|
|
Time.zone.now + 1.day
|
2019-12-11 12:04:02 +08:00
|
|
|
end
|
|
|
|
date.iso8601
|
|
|
|
end
|
2020-03-12 08:16:00 +08:00
|
|
|
reminder_set_at { Time.zone.now }
|
2019-12-11 12:04:02 +08:00
|
|
|
end
|