mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-07 14:46:41 +00:00
fix: maintenance mode not enqeuing notifications
This commit is contained in:
parent
197b2f5370
commit
bccd1a0d31
@ -4,12 +4,13 @@ onModelAfterUpdate((e) => {
|
|||||||
const newModel = /** @type {models.Record} */ (e.model)
|
const newModel = /** @type {models.Record} */ (e.model)
|
||||||
const oldModel = newModel.originalCopy()
|
const oldModel = newModel.originalCopy()
|
||||||
|
|
||||||
const { mkLog, enqueueNotification } = /** @type {Lib} */ (
|
const { mkLog, enqueueNotification, audit } = /** @type {Lib} */ (
|
||||||
require(`${__hooks}/lib.js`)
|
require(`${__hooks}/lib.js`)
|
||||||
)
|
)
|
||||||
|
|
||||||
const log = mkLog(`maintenance-mode`)
|
const log = mkLog(`maintenance-mode`)
|
||||||
|
|
||||||
|
try {
|
||||||
// Bail out if we aren't in maintenance mode
|
// Bail out if we aren't in maintenance mode
|
||||||
const isMaintenance = newModel.get('maintenance')
|
const isMaintenance = newModel.get('maintenance')
|
||||||
// log({ isMaintenance })
|
// log({ isMaintenance })
|
||||||
@ -34,7 +35,7 @@ onModelAfterUpdate((e) => {
|
|||||||
const subdomain = newModel.getString(`subdomain`)
|
const subdomain = newModel.getString(`subdomain`)
|
||||||
const address = user.getString(`email`)
|
const address = user.getString(`email`)
|
||||||
log({ instanceId, subdomain, address })
|
log({ instanceId, subdomain, address })
|
||||||
enqueueNotification(`email`, `maintenance_mode`, uid, {
|
enqueueNotification(`email`, `maintenance-mode`, uid, {
|
||||||
log,
|
log,
|
||||||
dao,
|
dao,
|
||||||
message_template_vars: {
|
message_template_vars: {
|
||||||
@ -42,4 +43,10 @@ onModelAfterUpdate((e) => {
|
|||||||
instanceId,
|
instanceId,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
} catch (e) {
|
||||||
|
audit('ERROR', `Failed to enqueue template with ${e}`, {
|
||||||
|
log,
|
||||||
|
dao,
|
||||||
|
})
|
||||||
|
}
|
||||||
}, 'instances')
|
}, 'instances')
|
||||||
|
2
src/mothership-app/pb_hooks/types/lib.d.ts
vendored
2
src/mothership-app/pb_hooks/types/lib.d.ts
vendored
@ -24,7 +24,7 @@ interface Lib {
|
|||||||
enqueueNotification: (
|
enqueueNotification: (
|
||||||
channel: 'email' | 'lemonbot',
|
channel: 'email' | 'lemonbot',
|
||||||
template:
|
template:
|
||||||
| 'maintenance_mode'
|
| 'maintenance-mode'
|
||||||
| 'lemon_order_email'
|
| 'lemon_order_email'
|
||||||
| 'lemon_order_discord'
|
| 'lemon_order_discord'
|
||||||
| 'welcome',
|
| 'welcome',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user