mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Removed redundant code for handling orphaned webhooks
issue https://github.com/TryGhost/Team/issues/526 refs https://github.com/TryGhost/Team/issues/477
This commit is contained in:
parent
a71d5dc633
commit
70627d84a7
1 changed files with 0 additions and 17 deletions
|
@ -15,23 +15,6 @@ module.exports = {
|
|||
data: [],
|
||||
permissions: true,
|
||||
async query(frame) {
|
||||
const isIntegrationRequest = frame.options.context && frame.options.context.integration && frame.options.context.integration.id;
|
||||
|
||||
// NOTE: this check can be removed once `webhooks.integration_id` gets foreigh ke constraint (Ghost 4.0)
|
||||
if (!isIntegrationRequest && frame.data.webhooks[0].integration_id) {
|
||||
const integration = await models.Integration.findOne({id: frame.data.webhooks[0].integration_id}, {context: {internal: true}});
|
||||
|
||||
if (!integration) {
|
||||
throw new errors.ValidationError({
|
||||
message: i18n.t('notices.data.validation.index.schemaValidationFailed', {
|
||||
key: 'integration_id'
|
||||
}),
|
||||
context: i18n.t('errors.api.webhooks.nonExistingIntegrationIdProvided.context'),
|
||||
help: i18n.t('errors.api.webhooks.nonExistingIntegrationIdProvided.help')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const webhook = await models.Webhook.getByEventAndTarget(
|
||||
frame.data.webhooks[0].event,
|
||||
frame.data.webhooks[0].target_url,
|
||||
|
|
Loading…
Reference in a new issue