mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
Disable Failing Webhooks (#11966)
* todo comment * add failures field to webhooks and sanitize * implement logic * use update instead of save * specify timeout and maximum number of retries * add tests
This commit is contained in:
@@ -63,6 +63,21 @@ describe('PUT /user/webhook/:id', () => {
|
||||
expect(webhook.options).to.eql(options);
|
||||
});
|
||||
|
||||
it('ignores protected fields', async () => {
|
||||
const failures = 3;
|
||||
const lastFailureAt = new Date();
|
||||
|
||||
await user.put(`/user/webhook/${webhookToUpdate.id}`, {
|
||||
failures, lastFailureAt,
|
||||
});
|
||||
|
||||
await user.sync();
|
||||
const webhook = user.webhooks.find(hook => webhookToUpdate.id === hook.id);
|
||||
|
||||
expect(webhook.failures).to.eql(0);
|
||||
expect(webhook.lastFailureAt).to.eql(undefined);
|
||||
});
|
||||
|
||||
it('updates a webhook with empty label', async () => {
|
||||
const url = 'http://a-new-url.com';
|
||||
const type = 'groupChatReceived';
|
||||
|
||||
Reference in New Issue
Block a user