From 5989b3661e6d48a4bb874c5d0657bad296a8a688 Mon Sep 17 00:00:00 2001 From: Camille Moussu <66134347+Eriikah@users.noreply.github.com> Date: Mon, 23 Feb 2026 11:29:02 +0100 Subject: [PATCH] [#562] added DAV_BASE_URL to env (#570) Co-authored-by: Camille Moussu --- .../features/Calendars/CalendarModal.test.tsx | 4 +- public/.env.example.js | 1 + src/components/Calendar/AccessTab.tsx | 50 ++++++++++--------- src/window.d.ts | 1 + 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/__test__/features/Calendars/CalendarModal.test.tsx b/__test__/features/Calendars/CalendarModal.test.tsx index 61f4485..0e9d6d7 100644 --- a/__test__/features/Calendars/CalendarModal.test.tsx +++ b/__test__/features/Calendars/CalendarModal.test.tsx @@ -307,7 +307,7 @@ describe("CalendarPopover - Tabs Scenarios", () => { }); it("copies CalDAV link from Access tab", async () => { - window.CALENDAR_BASE_URL = "https://cal.example.org"; + window.DAV_BASE_URL = "https://cal.example.org"; Object.assign(navigator, { clipboard: { writeText: jest.fn() }, }); @@ -441,7 +441,7 @@ describe("CalendarPopover - Tabs Scenarios", () => { }); it("fetches and resets the secret link", async () => { - window.CALENDAR_BASE_URL = "https://cal.example.org"; + window.DAV_BASE_URL = "https://cal.example.org"; (getSecretLink as jest.Mock) .mockResolvedValueOnce({ diff --git a/public/.env.example.js b/public/.env.example.js index 495d679..b8162e3 100644 --- a/public/.env.example.js +++ b/public/.env.example.js @@ -6,6 +6,7 @@ var SSO_RESPONSE_TYPE = "code"; var SSO_CODE_CHALLENGE_METHOD = "S256"; var SSO_POST_LOGOUT_REDIRECT = "http://example.com?logout=1"; var CALENDAR_BASE_URL = "https://calendar.example.com"; +var DAV_BASE_URL = "https://dav.example.com"; var MAIL_SPA_URL = "https://mail.example.com"; var VIDEO_CONFERENCE_BASE_URL = "https://meet.linagora.com"; var DEBUG = false; diff --git a/src/components/Calendar/AccessTab.tsx b/src/components/Calendar/AccessTab.tsx index 529aa3f..2f4d82f 100644 --- a/src/components/Calendar/AccessTab.tsx +++ b/src/components/Calendar/AccessTab.tsx @@ -22,7 +22,7 @@ import { SnackbarAlert } from "../Loading/SnackBarAlert"; export function AccessTab({ calendar }: { calendar: Calendar }) { const { t } = useI18n(); - const calDAVLink = `${window.CALENDAR_BASE_URL}${calendar.link.replace(".json", "")}`; + const calDAVLink = `${window.DAV_BASE_URL}${calendar.link.replace(".json", "")}`; const [secretLink, setSecretLink] = useState(""); const [open, setOpen] = useState(false); @@ -82,28 +82,32 @@ export function AccessTab({ calendar }: { calendar: Calendar }) { return ( <> - - - - handleCopy(calDAVLink)} edge="end"> - - - - ), - }} - /> - - - + {!!window.DAV_BASE_URL && ( + + + + handleCopy(calDAVLink)} + edge="end" + > + + + + ), + }} + /> + + + )}