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