mirror of
https://github.com/discourse/discourse.git
synced 2026-08-07 13:19:19 +08:00
- Adds a **Calendar** tab to user preferences where users can generate ICS subscription URLs for external calendar apps (Google Calendar, Apple Calendar, Outlook, etc.) - Core provides a **Bookmarked Reminders** feed (always available) - When the discourse-calendar plugin is enabled, **All Events** and **My Events** feeds are also shown - URLs use scoped user API keys (read-only, ICS format only) with rate limiting and scope validation - Adds `include_interested` parameter to EventFinder so "My Events" includes both going and interested events - Adds `register_calendar_subscription_feed` plugin API for plugins to register additional ICS feeds Start State <img width="1328" height="362" alt="image" src="https://github.com/user-attachments/assets/60918591-7845-4cad-90c2-0493040d76c7" /> After clicking on Generate <img width="1326" height="808" alt="image" src="https://github.com/user-attachments/assets/aa3455fc-93c7-447b-8f82-16ef95580b37" /> After refreshing page <img width="1323" height="415" alt="image" src="https://github.com/user-attachments/assets/f22c02f8-02fd-49e5-b713-99dbba794037" /> --------- Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
46 lines
1.4 KiB
Ruby
Vendored
46 lines
1.4 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
describe "Calendar subscription feeds" do
|
|
fab!(:user)
|
|
|
|
before do
|
|
SiteSetting.calendar_enabled = true
|
|
SiteSetting.discourse_post_event_enabled = true
|
|
end
|
|
|
|
it "includes event feeds when calendar plugin is enabled" do
|
|
sign_in(user)
|
|
post "/calendar-subscriptions.json"
|
|
expect(response.status).to eq(200)
|
|
|
|
body = response.parsed_body
|
|
expect(body["urls"]["all_events"]).to include("/discourse-post-event/events.ics")
|
|
expect(body["urls"]["my_events"]).to include("attending_user=#{user.username_lower}")
|
|
expect(body["urls"]["my_events"]).to include("include_interested=true")
|
|
expect(body["urls"]["bookmarks"]).to include("/u/#{user.username_lower}/bookmarks.ics")
|
|
end
|
|
|
|
it "includes the events_calendar scope on the key" do
|
|
sign_in(user)
|
|
post "/calendar-subscriptions.json"
|
|
|
|
api_key =
|
|
UserApiKey.joins(:client).find_by(
|
|
user_id: user.id,
|
|
user_api_key_clients: {
|
|
client_id: CalendarSubscriptionsController::CLIENT_ID,
|
|
},
|
|
)
|
|
expect(api_key.scopes.map(&:name)).to contain_exactly(
|
|
"discourse-calendar:events_calendar",
|
|
"bookmarks_calendar",
|
|
)
|
|
end
|
|
|
|
it "lists all available feeds" do
|
|
sign_in(user)
|
|
get "/calendar-subscriptions.json"
|
|
|
|
expect(response.parsed_body["feeds"]).to contain_exactly("bookmarks", "all_events", "my_events")
|
|
end
|
|
end
|