Skip to content

A platform for community discussion. Free, open, simple.

FIX: restore rrule in more-menu "Add to Calendar" ICS export (#38969)

Régis Hanoldfe6ae5f423e
diff --git a/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/more-menu.gjs b/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/more-menu.gjs
index f918f050381..66ecaa5a51c 100644
--- a/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/more-menu.gjs
+++ b/plugins/discourse-calendar/assets/javascripts/discourse/components/discourse-post-event/more-menu.gjs
@@ -88,6 +88,7 @@ export default class DiscoursePostEventMoreMenu extends Component {
},
],
{
+ rrule: event.rrule,
location: event.location,
details: event.description,
}
diff --git a/plugins/discourse-calendar/spec/system/page_objects/discourse_calendar/post_event.rb b/plugins/discourse-calendar/spec/system/page_objects/discourse_calendar/post_event.rb
index fb41d24c518..7e21e0f1a2b 100644
--- a/plugins/discourse-calendar/spec/system/page_objects/discourse_calendar/post_event.rb
+++ b/plugins/discourse-calendar/spec/system/page_objects/discourse_calendar/post_event.rb
@@ -50,6 +50,12 @@ module PageObjects
self
end
+ def add_to_calendar
+ open_more_menu
+ find(".add-to-calendar .btn").click
+ self
+ end
+
def edit
open_more_menu
find(".edit-event").click
diff --git a/plugins/discourse-calendar/spec/system/post_event_spec.rb b/plugins/discourse-calendar/spec/system/post_event_spec.rb
index 25eca4b1632..b428d27013c 100644
--- a/plugins/discourse-calendar/spec/system/post_event_spec.rb
+++ b/plugins/discourse-calendar/spec/system/post_event_spec.rb
@@ -385,4 +385,28 @@ describe "Post event" do
expect(bulk_invite_modal_page).to be_closed
end
end
+
+ context "with add to calendar from more menu" do
+ it "includes rrule for recurring events" do
+ admin.user_option.update!(default_calendar: "ics")
+
+ title = "Weekly standup"
+ raw = <<~MD
+ [event start='2222-02-22 14:00' recurrence='every_week']
+ [/event]
+ MD
+ post = PostCreator.create!(admin, title:, raw:)
+
+ visit(post.topic.url)
+
+ ics_content = nil
+ page.driver.with_playwright_page do |pw_page|
+ download = pw_page.expect_download { post_event_page.add_to_calendar }
+ ics_content = download.path.then { |path| File.read(path) }
+ end
+
+ expect(ics_content).to include("RRULE:")
+ expect(ics_content).to include("FREQ=WEEKLY")
+ end
+ end
end