2019-12-10 23:04:02 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
Fabricator(:bookmark) do
|
|
|
|
user
|
2022-04-21 18:23:42 -04:00
|
|
|
post {
|
|
|
|
if !SiteSetting.use_polymorphic_bookmarks
|
|
|
|
Fabricate(:post)
|
|
|
|
end
|
|
|
|
}
|
2019-12-10 23:04:02 -05:00
|
|
|
name "This looked interesting"
|
2020-03-11 20:16:00 -04:00
|
|
|
reminder_at { 1.day.from_now.iso8601 }
|
|
|
|
reminder_set_at { Time.zone.now }
|
2022-04-21 18:23:42 -04:00
|
|
|
bookmarkable {
|
|
|
|
if SiteSetting.use_polymorphic_bookmarks
|
|
|
|
Fabricate(:post)
|
|
|
|
end
|
|
|
|
}
|
2022-03-29 22:43:11 -04: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-10 23:04:02 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:bookmark_next_business_day_reminder, from: :bookmark) do
|
|
|
|
reminder_at do
|
2020-03-11 20:16:00 -04:00
|
|
|
date = if Time.zone.now.friday?
|
|
|
|
Time.zone.now + 3.days
|
|
|
|
elsif Time.zone.now.saturday?
|
|
|
|
Time.zone.now + 2.days
|
2019-12-10 23:04:02 -05:00
|
|
|
else
|
2020-03-11 20:16:00 -04:00
|
|
|
Time.zone.now + 1.day
|
2019-12-10 23:04:02 -05:00
|
|
|
end
|
|
|
|
date.iso8601
|
|
|
|
end
|
2020-03-11 20:16:00 -04:00
|
|
|
reminder_set_at { Time.zone.now }
|
2019-12-10 23:04:02 -05:00
|
|
|
end
|