Centralize API.getBrew descended calls to splitTextStyleAndMetadata.

This does not address "static" pages nor change tests that called splitTextStyleAndMetadata in their own fashion.
This commit is contained in:
David Bolack
2026-09-02 12:01:50 -05:00
parent b7e67b1ab5
commit 9e1910339b
4 changed files with 1 additions and 24 deletions
+1 -3
View File
@@ -192,13 +192,13 @@ const api = {
const fixedStub = migrateSystemsToTags(stub);
req.brew = fixedStub;
splitTextStyleAndMetadata(req.brew);
next();
};
},
getCSS : async (req, res)=>{
const { brew } = req;
if(!brew) return res.status(404).send('');
splitTextStyleAndMetadata(brew);
if(!brew.style) return res.status(404).send('');
res.set({
@@ -344,7 +344,6 @@ const api = {
});
currentTheme = req.brew;
splitTextStyleAndMetadata(currentTheme);
if(!currentTheme.tags.some((tag)=>tag === 'meta:theme' || tag === 'meta:Theme'))
throw { brewId: req.params.id, name: 'Invalid Theme Selected', message: 'Selected theme does not have the meta:theme tag', status: 422, HBErrorCode: '10' };
themeName ??= currentTheme.title;
@@ -383,7 +382,6 @@ const api = {
// Initialize brew from request and body, destructure query params, and set the initial value for the after-save method
const brewFromClient = api.excludePropsFromUpdate(req.body);
const brewFromServer = req.brew;
splitTextStyleAndMetadata(brewFromServer);
if(brewFromServer?.version !== brewFromClient?.version){
console.log(`Version mismatch on brew ${brewFromClient.editId}`);