0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-05 10:12:41 +00:00

Add Patch wrapper/unwrapper for saves

Object encapsulation for the win?
This commit is contained in:
David Bolack
2025-07-09 17:16:47 -05:00
parent 8f058d56f2
commit 0f4157d084
2 changed files with 4 additions and 4 deletions

View File

@@ -352,11 +352,11 @@ const api = {
res.setHeader('Content-Type', 'application/json');
return res.status(409).send(JSON.stringify({ message: `The server copy is out of sync with the saved brew. Please save your changes elsewhere, refresh, and try again.` }));
}
let brew = _.assign(brewFromServer, brewFromClient);
brew.title = brew.title.trim();
brew.description = brew.description.trim() || '';
brew.text = applyPatches(brewFromClient.patches, brewFromServer.text)[0];
brew.text = applyPatches(parsePatch(brewFromClient.patches), brewFromServer.text)[0];
brew.text = api.mergeBrewText(brew);
const googleId = brew.googleId;