mirror of
https://github.com/OHTU-German-learning-website/OHTU-German-learning-website.git
synced 2026-10-12 19:13:51 +03:00
rename and fix feedback form
This commit is contained in:
@@ -4,11 +4,28 @@ const isCI = process.env.CI === "true";
|
|||||||
|
|
||||||
const settings = {
|
const settings = {
|
||||||
hideToska: false,
|
hideToska: false,
|
||||||
disableToska: true,
|
// Keep disabled only when explicitly requested via env.
|
||||||
|
disableToska: process.env.PATE_DISABLE_TOSKA === "true",
|
||||||
color: "orange",
|
color: "orange",
|
||||||
header: "GRADESA",
|
header: "GRADESA",
|
||||||
headerFontColor: "white",
|
headerFontColor: "white",
|
||||||
dryrun: false,
|
dryrun: process.env.PATE_DRYRUN === "true",
|
||||||
|
};
|
||||||
|
|
||||||
|
const looksLikeProviderFailure = (payload) => {
|
||||||
|
if (!payload || typeof payload !== "object") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (payload.ok === false || payload.success === false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (payload.error || payload.errors || payload.messageType === "error") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const sendEmail = async ({ to, subject, text }) => {
|
const sendEmail = async ({ to, subject, text }) => {
|
||||||
@@ -55,10 +72,30 @@ const sendEmail = async ({ to, subject, text }) => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const responseText = await response.text();
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const errorBody = await response.text();
|
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`PATE email sending failed with status ${response.status}: ${errorBody}`
|
`PATE email sending failed with status ${response.status}: ${responseText}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let payload;
|
||||||
|
try {
|
||||||
|
payload = responseText ? JSON.parse(responseText) : null;
|
||||||
|
} catch {
|
||||||
|
payload = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (looksLikeProviderFailure(payload)) {
|
||||||
|
throw new Error(
|
||||||
|
`PATE reported email failure: ${payload.message || responseText}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.dryrun) {
|
||||||
|
throw new Error(
|
||||||
|
"Email sending is configured as dry-run (PATE_DRYRUN=true)."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ function StudentSideBar() {
|
|||||||
Glossar
|
Glossar
|
||||||
</Link>
|
</Link>
|
||||||
<Link className={styles.sidebarLink} href="/contact">
|
<Link className={styles.sidebarLink} href="/contact">
|
||||||
Kontaktieren Sie unser Team
|
Brauchen Sie Hilfe?
|
||||||
</Link>
|
</Link>
|
||||||
<SidebarGroup
|
<SidebarGroup
|
||||||
title="Links zu anderen Webseiten"
|
title="Links zu anderen Webseiten"
|
||||||
|
|||||||
Reference in New Issue
Block a user