FEATURE: Decorate topic-level bookmark button with reminder time (#9426)

* Show the correct bookmark with clock icon when topic-level bookmark reminder time is set and show the time of the reminder in the title on hover.
* Add a new bookmark lib and reminder time formatting function to show time with today/tomorrow shorthand for readability. E.g. tomorrow at 8:00am instead of Apr 16 2020 at 8:00am. This only applies to today + tomorrow, future dates are still treated the same.
This commit is contained in:
Martin Brennan
2020-04-16 09:20:44 +10:00
committed by GitHub
parent 3c72cbc5de
commit d7f744490a
11 changed files with 137 additions and 25 deletions

View File

@@ -61,6 +61,7 @@ class TopicViewSerializer < ApplicationSerializer
:is_warning,
:chunk_size,
:bookmarked,
:bookmark_reminder_at,
:message_archived,
:topic_timer,
:private_topic_timer,
@@ -192,6 +193,14 @@ class TopicViewSerializer < ApplicationSerializer
end
end
def include_bookmark_reminder_at?
SiteSetting.enable_bookmarks_with_reminders? && bookmarked
end
def bookmark_reminder_at
object.first_post_bookmark_reminder_at
end
def topic_timer
TopicTimerSerializer.new(object.topic.public_topic_timer, root: false)
end