mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 11:20:57 -06:00
4037cdb6db
We have a .ics endpoint for user bookmarks, this commit makes it so polymorphic bookmarks work on that endpoint, using the serializer associated with the RegisteredBookmarkable.
35 lines
1.3 KiB
Plaintext
35 lines
1.3 KiB
Plaintext
<% if SiteSetting.use_polymorphic_bookmarks %>
|
|
BEGIN:VCALENDAR
|
|
VERSION:2.0
|
|
PRODID:-//Discourse//<%= Discourse.current_hostname %>//<%= Discourse.full_version %>//EN
|
|
<% @bookmark_reminders.each do |bookmark| %>
|
|
BEGIN:VEVENT
|
|
UID:bookmark_reminder_#<%= bookmark.id %>@<%= Discourse.current_hostname %>
|
|
DTSTAMP:<%= bookmark.updated_at.strftime(I18n.t("datetime_formats.formats.calendar_ics")) %>
|
|
DTSTART:<%= bookmark.reminder_at_ics_start %>
|
|
DTEND:<%= bookmark.reminder_at_ics_end %>
|
|
SUMMARY:<%= bookmark.name.presence || bookmark.title %>
|
|
DESCRIPTION:<%= bookmark.bookmarkable_url %>
|
|
URL:<%= bookmark.bookmarkable_url %>
|
|
END:VEVENT
|
|
<% end %>
|
|
END:VCALENDAR
|
|
|
|
<% else %>
|
|
BEGIN:VCALENDAR
|
|
VERSION:2.0
|
|
PRODID:-//Discourse//<%= Discourse.current_hostname %>//<%= Discourse.full_version %>//EN
|
|
<% @bookmark_reminders.each do |bookmark| %>
|
|
BEGIN:VEVENT
|
|
UID:bookmark_reminder_#<%= bookmark.id %>@<%= Discourse.current_hostname %>
|
|
DTSTAMP:<%= bookmark.updated_at.strftime(I18n.t("datetime_formats.formats.calendar_ics")) %>
|
|
DTSTART:<%= bookmark.reminder_at_ics %>
|
|
DTEND:<%= bookmark.reminder_at_ics(offset: 1.hour) %>
|
|
SUMMARY:<%= bookmark.name.presence || bookmark.topic.title %>
|
|
DESCRIPTION:<%= Discourse.base_url %>/t/-/<%= bookmark.topic_id %>
|
|
URL:<%= Discourse.base_url %>/t/-/<%= bookmark.topic_id %>
|
|
END:VEVENT
|
|
<% end %>
|
|
END:VCALENDAR
|
|
<% end %>
|