FIX: add support for default title in localdates (#36511)

When clicking "Add to calendar" in chat we would error out cause title
was
null.
This commit is contained in:
Sam
2025-12-08 11:12:38 +11:00
committed by GitHub
parent 7dff3231e3
commit 60d194acd3
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -5117,6 +5117,7 @@ en:
add_to_calendar: "Add to calendar"
google: "Google Calendar"
ics: "ICS"
default_title: "Scheduled Event"
tagging:
all_tags: "All tags"
other_tags: "Other Tags"
@@ -2,12 +2,13 @@ import downloadCalendarModal from "discourse/components/modal/download-calendar"
import { getOwnerWithFallback } from "discourse/lib/get-owner";
import getURL from "discourse/lib/get-url";
import User from "discourse/models/user";
import { i18n } from "discourse-i18n";
export function downloadCalendar(title, dates, options = {}) {
const currentUser = User.current();
const formattedDates = formatDates(dates);
title = title.trim();
title = (title || i18n("download_calendar.default_title")).trim();
switch (currentUser?.user_option.default_calendar) {
case "ics":