-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Zombie organisation services (closes #420)
- Loading branch information
Showing
47 changed files
with
639 additions
and
590 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import makeDebug from 'debug' | ||
|
||
const debug = makeDebug('aktnmap:organisations:hooks') | ||
|
||
export function removeOrganisationAlerts (hook) { | ||
if (hook.type !== 'after') { | ||
throw new Error('The \'removeOrganisationAlerts\' hook should only be used as a \'after\' hook.') | ||
} | ||
|
||
const app = hook.app | ||
const orgAlertService = app.getService('alerts', hook.result) | ||
return orgAlertService.find({ paginate: false }) | ||
.then(alerts => { | ||
return Promise.all(alerts.map(group => { | ||
return orgAlertService.remove(group._id.toString(), { | ||
user: hook.params.user | ||
}) | ||
})) | ||
}) | ||
.then(alerts => { | ||
debug('Removed alerts for organisation ' + hook.result._id) | ||
return hook | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,8 @@ describe('billing', () => { | |
expect(subscriptionService).toExist() | ||
await new Promise(resolve => server.once('listening', () => resolve())) | ||
}) | ||
// Let enough time to process | ||
.timeout(5000) | ||
|
||
it('creates a test user', async () => { | ||
const user = await userService.create({ email: '[email protected]', name: 'test-user' }, { checkAuthorisation: true }) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.