mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: deprecated emailer hook
This commit is contained in:
@@ -175,7 +175,7 @@ describe('API', async () => {
|
||||
|
||||
after(async () => {
|
||||
plugins.hooks.unregister('core', 'filter:search.query', dummySearchHook);
|
||||
plugins.hooks.unregister('emailer-test', 'filter:email.send');
|
||||
plugins.hooks.unregister('emailer-test', 'static:email.send');
|
||||
});
|
||||
|
||||
async function setupData() {
|
||||
@@ -306,7 +306,7 @@ describe('API', async () => {
|
||||
});
|
||||
// Attach an emailer hook so related requests do not error
|
||||
plugins.hooks.register('emailer-test', {
|
||||
hook: 'filter:email.send',
|
||||
hook: 'static:email.send',
|
||||
method: dummyEmailerHook,
|
||||
});
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('authentication', () => {
|
||||
before((done) => {
|
||||
// Attach an emailer hook so related requests do not error
|
||||
plugins.hooks.register('authentication-test', {
|
||||
hook: 'filter:email.send',
|
||||
hook: 'static:email.send',
|
||||
method: dummyEmailerHook,
|
||||
});
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('authentication', () => {
|
||||
});
|
||||
|
||||
after(() => {
|
||||
plugins.hooks.unregister('authentication-test', 'filter:email.send');
|
||||
plugins.hooks.unregister('authentication-test', 'static:email.send');
|
||||
});
|
||||
|
||||
it('should allow login with email for uid 1', async () => {
|
||||
|
||||
@@ -346,7 +346,7 @@ describe('Controllers', () => {
|
||||
before(async () => {
|
||||
// Attach an emailer hook so related requests do not error
|
||||
plugins.hooks.register('emailer-test', {
|
||||
hook: 'filter:email.send',
|
||||
hook: 'static:email.send',
|
||||
method: dummyEmailerHook,
|
||||
});
|
||||
|
||||
@@ -361,7 +361,7 @@ describe('Controllers', () => {
|
||||
|
||||
after(() => {
|
||||
meta.config.requireEmailAddress = 0;
|
||||
plugins.hooks.unregister('emailer-test', 'filter:email.send');
|
||||
plugins.hooks.unregister('emailer-test', 'static:email.send');
|
||||
});
|
||||
|
||||
it('email interstitial should still apply if empty email entered and requireEmailAddress is enabled', async () => {
|
||||
|
||||
@@ -58,14 +58,14 @@ describe('emailer', () => {
|
||||
};
|
||||
|
||||
Plugins.hooks.register('emailer-test', {
|
||||
hook: 'filter:email.send',
|
||||
hook: 'static:email.send',
|
||||
method,
|
||||
});
|
||||
|
||||
Emailer.sendToEmail(template, email, language, params, (err) => {
|
||||
assert.equal(err, error);
|
||||
|
||||
Plugins.hooks.unregister('emailer-test', 'filter:email.send', method);
|
||||
Plugins.hooks.unregister('emailer-test', 'static:email.send', method);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -157,14 +157,14 @@ describe('emailer', () => {
|
||||
assert(false); // if thrown, email was sent
|
||||
};
|
||||
Plugins.hooks.register('emailer-test', {
|
||||
hook: 'filter:email.send',
|
||||
hook: 'static:email.send',
|
||||
method,
|
||||
});
|
||||
|
||||
await user.bans.ban(recipientUid);
|
||||
await Emailer.send('test', recipientUid, {});
|
||||
|
||||
Plugins.hooks.unregister('emailer-test', 'filter:email.send', method);
|
||||
Plugins.hooks.unregister('emailer-test', 'static:email.send', method);
|
||||
});
|
||||
|
||||
it('should return true if the template is "banned"', async () => {
|
||||
@@ -172,12 +172,12 @@ describe('emailer', () => {
|
||||
assert(true); // if thrown, email was sent
|
||||
};
|
||||
Plugins.hooks.register('emailer-test', {
|
||||
hook: 'filter:email.send',
|
||||
hook: 'static:email.send',
|
||||
method,
|
||||
});
|
||||
|
||||
await Emailer.send('banned', recipientUid, {});
|
||||
Plugins.hooks.unregister('emailer-test', 'filter:email.send', method);
|
||||
Plugins.hooks.unregister('emailer-test', 'static:email.send', method);
|
||||
});
|
||||
|
||||
it('should return true if system settings allow sending to banned users', async () => {
|
||||
@@ -185,7 +185,7 @@ describe('emailer', () => {
|
||||
assert(true); // if thrown, email was sent
|
||||
};
|
||||
Plugins.hooks.register('emailer-test', {
|
||||
hook: 'filter:email.send',
|
||||
hook: 'static:email.send',
|
||||
method,
|
||||
});
|
||||
|
||||
@@ -194,7 +194,7 @@ describe('emailer', () => {
|
||||
meta.config.sendEmailToBanned = 0;
|
||||
await user.bans.unban(recipientUid);
|
||||
|
||||
Plugins.hooks.unregister('emailer-test', 'filter:email.send', method);
|
||||
Plugins.hooks.unregister('emailer-test', 'static:email.send', method);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('Flags', () => {
|
||||
const dummyEmailerHook = async (data) => {};
|
||||
// Attach an emailer hook so related requests do not error
|
||||
plugins.hooks.register('flags-test', {
|
||||
hook: 'filter:email.send',
|
||||
hook: 'static:email.send',
|
||||
method: dummyEmailerHook,
|
||||
});
|
||||
|
||||
@@ -70,7 +70,7 @@ describe('Flags', () => {
|
||||
});
|
||||
|
||||
after(() => {
|
||||
plugins.hooks.unregister('flags-test', 'filter:email.send');
|
||||
plugins.hooks.unregister('flags-test', 'static:email.send');
|
||||
});
|
||||
|
||||
describe('.create()', () => {
|
||||
|
||||
@@ -236,12 +236,12 @@ describe('socket.io', () => {
|
||||
before(() => {
|
||||
// Attach an emailer hook so related requests do not error
|
||||
plugins.hooks.register('emailer-test', {
|
||||
hook: 'filter:email.send',
|
||||
hook: 'static:email.send',
|
||||
method: dummyEmailerHook,
|
||||
});
|
||||
});
|
||||
after(() => {
|
||||
plugins.hooks.unregister('emailer-test', 'filter:email.send');
|
||||
plugins.hooks.unregister('emailer-test', 'static:email.send');
|
||||
});
|
||||
|
||||
it('should validate emails', (done) => {
|
||||
|
||||
@@ -38,7 +38,7 @@ describe('User', () => {
|
||||
before((done) => {
|
||||
// Attach an emailer hook so related requests do not error
|
||||
plugins.hooks.register('emailer-test', {
|
||||
hook: 'filter:email.send',
|
||||
hook: 'static:email.send',
|
||||
method: dummyEmailerHook,
|
||||
});
|
||||
|
||||
@@ -56,7 +56,7 @@ describe('User', () => {
|
||||
});
|
||||
});
|
||||
after(() => {
|
||||
plugins.hooks.unregister('emailer-test', 'filter:email.send');
|
||||
plugins.hooks.unregister('emailer-test', 'static:email.send');
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('email confirmation (library methods)', () => {
|
||||
before(() => {
|
||||
// Attach an emailer hook so related requests do not error
|
||||
plugins.hooks.register('emailer-test', {
|
||||
hook: 'filter:email.send',
|
||||
hook: 'static:email.send',
|
||||
method: dummyEmailerHook,
|
||||
});
|
||||
});
|
||||
@@ -36,7 +36,7 @@ describe('email confirmation (library methods)', () => {
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
plugins.hooks.unregister('emailer-test', 'filter:email.send');
|
||||
plugins.hooks.unregister('emailer-test', 'static:email.send');
|
||||
});
|
||||
|
||||
describe('isValidationPending', () => {
|
||||
|
||||
Reference in New Issue
Block a user