mirror of
https://github.com/discourse/discourse.git
synced 2025-06-07 23:47:17 +08:00
FIX: adds support for location and details in ICS calendar (#26862)
This commit is contained in:
@ -25,6 +25,8 @@ export default class DownloadCalendar extends Component {
|
|||||||
this.args.model.calendar.dates,
|
this.args.model.calendar.dates,
|
||||||
{
|
{
|
||||||
recurrenceRule: this.args.model.calendar.recurrenceRule,
|
recurrenceRule: this.args.model.calendar.recurrenceRule,
|
||||||
|
location: this.args.model.calendar.location,
|
||||||
|
details: this.args.model.calendar.details,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -89,6 +89,8 @@ export function generateIcsData(title, dates, options = {}) {
|
|||||||
`DTSTART:${startDate.utc().format("YMMDDTHHmmss")}Z\n` +
|
`DTSTART:${startDate.utc().format("YMMDDTHHmmss")}Z\n` +
|
||||||
`DTEND:${endDate.utc().format("YMMDDTHHmmss")}Z\n` +
|
`DTEND:${endDate.utc().format("YMMDDTHHmmss")}Z\n` +
|
||||||
(options.recurrenceRule ? `RRULE:${options.recurrenceRule}\n` : ``) +
|
(options.recurrenceRule ? `RRULE:${options.recurrenceRule}\n` : ``) +
|
||||||
|
(options.location ? `LOCATION:${options.location}\n` : ``) +
|
||||||
|
(options.details ? `DESCRIPTION:${options.details}\n` : ``) +
|
||||||
`SUMMARY:${title}\n` +
|
`SUMMARY:${title}\n` +
|
||||||
"END:VEVENT\n"
|
"END:VEVENT\n"
|
||||||
);
|
);
|
||||||
|
@ -24,12 +24,21 @@ module("Unit | Utility | download-calendar", function (hooks) {
|
|||||||
shouldAdvanceTime: true,
|
shouldAdvanceTime: true,
|
||||||
shouldClearNativeTimers: true,
|
shouldClearNativeTimers: true,
|
||||||
});
|
});
|
||||||
const data = generateIcsData("event test", [
|
const data = generateIcsData(
|
||||||
|
"event test",
|
||||||
|
[
|
||||||
|
{
|
||||||
|
startsAt: "2021-10-12T15:00:00.000Z",
|
||||||
|
endsAt: "2021-10-12T16:00:00.000Z",
|
||||||
|
},
|
||||||
|
],
|
||||||
{
|
{
|
||||||
startsAt: "2021-10-12T15:00:00.000Z",
|
recurrenceRule: "FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR",
|
||||||
endsAt: "2021-10-12T16:00:00.000Z",
|
location: "Paris",
|
||||||
},
|
details: "Good soup",
|
||||||
]);
|
}
|
||||||
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
data,
|
data,
|
||||||
`BEGIN:VCALENDAR
|
`BEGIN:VCALENDAR
|
||||||
@ -40,6 +49,9 @@ UID:1634050800000_1634054400000
|
|||||||
DTSTAMP:20220404T211500Z
|
DTSTAMP:20220404T211500Z
|
||||||
DTSTART:20211012T150000Z
|
DTSTART:20211012T150000Z
|
||||||
DTEND:20211012T160000Z
|
DTEND:20211012T160000Z
|
||||||
|
RRULE:FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR
|
||||||
|
LOCATION:Paris
|
||||||
|
DESCRIPTION:Good soup
|
||||||
SUMMARY:event test
|
SUMMARY:event test
|
||||||
END:VEVENT
|
END:VEVENT
|
||||||
END:VCALENDAR`
|
END:VCALENDAR`
|
||||||
|
Reference in New Issue
Block a user