mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-30 18:46:01 +01:00 
			
		
		
		
	fix: move call to filter:middleware.buildHeader out of parallel so that req can be overridden by plugins prior to loading config
				
					
				
			This commit is contained in:
		| @@ -34,10 +34,11 @@ middleware.buildHeader = helpers.try(async (req, res, next) => { | |||||||
| 	if (req.method === 'GET') { | 	if (req.method === 'GET') { | ||||||
| 		await require('./index').applyCSRFasync(req, res); | 		await require('./index').applyCSRFasync(req, res); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	({ req, locals: res.locals } = await plugins.hooks.fire('filter:middleware.buildHeader', { req: req, locals: res.locals })); | ||||||
| 	const [config, canLoginIfBanned] = await Promise.all([ | 	const [config, canLoginIfBanned] = await Promise.all([ | ||||||
| 		controllers.api.loadConfig(req), | 		controllers.api.loadConfig(req), | ||||||
| 		user.bans.canLoginIfBanned(req.uid), | 		user.bans.canLoginIfBanned(req.uid), | ||||||
| 		plugins.hooks.fire('filter:middleware.buildHeader', { req: req, locals: res.locals }), |  | ||||||
| 	]); | 	]); | ||||||
|  |  | ||||||
| 	if (!canLoginIfBanned && req.loggedIn) { | 	if (!canLoginIfBanned && req.loggedIn) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user