Fix turnstile
This commit is contained in:
@@ -51,13 +51,15 @@ export function buildSiteIntegrations({
|
||||
],
|
||||
hooks: {
|
||||
beforeChange: [
|
||||
// Keys edited in the panel → clear the old Turnstile status, so a stale
|
||||
// Keys edited in the panel → clear that integration's old status, so a stale
|
||||
// "not working" banner doesn't linger until the next form submission.
|
||||
({ context, data, originalDoc }) => {
|
||||
if (context?.ipalIntegrationStatus || !data) {return data}
|
||||
const changed = (k: string) => k in data && data[k] !== originalDoc?.[k]
|
||||
if (changed('turnstileSecretKey') || changed('turnstileSiteKey')) {
|
||||
data.turnstileStatus = { checkedAt: null, code: null, message: null, since: null, state: null }
|
||||
const cleared = { checkedAt: null, code: null, message: null, since: null, state: null }
|
||||
if (changed('turnstileSecretKey') || changed('turnstileSiteKey')) {data.turnstileStatus = cleared}
|
||||
if (Object.keys(data).some((k) => (k === 'emailTransport' || k.startsWith('smtp')) && changed(k))) {
|
||||
data.emailStatus = cleared
|
||||
}
|
||||
return data
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user