Scheduling infrastructure for absolutely everyone.
Baikal CalDAV error hint (#6021)
Leo Giovanettia638708871e0
diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex c445ac1ff2c..4a09c31c4ee 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -920,7 +920,7 @@"allow_booker_to_select_duration": "Allow booker to select duration","impersonate_user_tip": "All uses of this feature is audited.","impersonating_user_warning": "Impersonating username \"{{user}}\".",- "impersonating_stop_instructions": "<0>Click Here to stop</0>.",+ "impersonating_stop_instructions": "Click here to stop","event_location_changed": "Updated - Your event changed the location","location_changed_event_type_subject": "Location Changed: {{eventType}} with {{name}} at {{date}}","current_location": "Current Location",diff --git a/packages/app-store/caldavcalendar/api/add.ts b/packages/app-store/caldavcalendar/api/add.tsindex 98fa3fe297a..600f0accac2 100644--- a/packages/app-store/caldavcalendar/api/add.ts+++ b/packages/app-store/caldavcalendar/api/add.ts@@ -40,8 +40,22 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)await prisma.credential.create({data,});- } catch (reason) {- logger.error("Could not add this caldav account", reason);+ } catch (e) {+ logger.error("Could not add this caldav account", e);+ if (e instanceof Error) {+ let message = e.message;+ if (e.message.indexOf("Invalid credentials") > -1 && url.indexOf("dav.php") > -1) {+ const parsedUrl = new URL(url);+ const adminUrl =+ parsedUrl.protocol ++ "//" ++ parsedUrl.hostname ++ (parsedUrl.port ? ":" + parsedUrl.port : "") ++ "/admin/?/settings/standard/";+ message = `Couldn\'t connect to caldav account, please verify WebDAV authentication type is set to "Basic"`;+ return res.status(500).json({ message, actionUrl: adminUrl });+ }+ }return res.status(500).json({ message: "Could not add this caldav account" });}diff --git a/packages/app-store/caldavcalendar/pages/setup/index.tsx b/packages/app-store/caldavcalendar/pages/setup/index.tsxindex bfcc1fe61d8..424b7b57339 100644--- a/packages/app-store/caldavcalendar/pages/setup/index.tsx+++ b/packages/app-store/caldavcalendar/pages/setup/index.tsx@@ -18,6 +18,7 @@ export default function CalDavCalendarSetup() {});const [errorMessage, setErrorMessage] = useState("");+ const [errorActionUrl, setErrorActionUrl] = useState("");return (<div className="flex h-screen bg-gray-200">@@ -49,6 +50,9 @@ export default function CalDavCalendarSetup() {const json = await res.json();if (!res.ok) {setErrorMessage(json?.message || t("something_went_wrong"));+ if (json.actionUrl) {+ setErrorActionUrl(json.actionUrl);+ }} else {router.push(json.url);}@@ -78,7 +82,24 @@ export default function CalDavCalendarSetup() {/></fieldset>- {errorMessage && <Alert severity="error" title={errorMessage} className="my-4" />}+ {errorMessage && (+ <Alert+ severity="error"+ title={errorMessage}+ actions={+ errorActionUrl !== "" ? (+ <Button+ href={errorActionUrl}+ color="secondary"+ target="_blank"+ className="ml-5 w-32 !p-5">+ Go to Admin+ </Button>+ ) : undefined+ }+ className="my-4"+ />+ )}<div className="mt-5 justify-end space-x-2 sm:mt-4 sm:flex"><Button type="button" color="secondary" onClick={() => router.back()}>{t("cancel")}diff --git a/packages/features/ee/impersonation/components/ImpersonatingBanner.tsx b/packages/features/ee/impersonation/components/ImpersonatingBanner.tsxindex 89f8e25587a..7a032900ffc 100644--- a/packages/features/ee/impersonation/components/ImpersonatingBanner.tsx+++ b/packages/features/ee/impersonation/components/ImpersonatingBanner.tsx@@ -16,7 +16,7 @@ function ImpersonatingBanner() {variant="warning"actions={<a className="border-b border-b-black" href="/auth/logout">- Click Here To stop+ {t("impersonating_stop_instructions")}</a>}/>