Repository navigation
feat: keep customer locale edits and panel images out of the tracked files - #46
Merged
Merged
Conversation
Merged
9 of 15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
An update via
git pullfailed as soon as a customer had edited a locale in the dashboard or replaced the panel logo, because both live in tracked files. That blocked the dashboard's update button, our bulk update of hosted bots and every self-hoster.Customer locale layer. Edits from the dashboard now go to
locales/custom/<lang>.json(gitignored) and hold only the values that differ from the shipped file. The bot and the transcript load the shipped file and lay the custom file on top (src/utils/locales.js). New keys and fixes to untouched texts arrive with every update, customer texts stay. A broken custom file only logs a warning. The editor still shows the full file,PUTstores the difference, and a newDELETE /locales/:name(with a button in the editor) resets a file to the default.Panel images. Customer images in
assets/are gitignored.panel.jslooks inassets/<file>first and falls back toassets/default/<file>. The default logo is copied toassets/default/logo.png;assets/logo.pngstays tracked in this release, because the first update to this version still runs through the old plaingit pull, and moving it now would break exactly that update for anyone with their own logo. It can be removed in a later release.Update routine.
src/utils/updater.jsruns behind the dashboard's update button and behind the newnpm run update. It resetspackage-lock.json, moves legacy edits of tracked locales into the custom layer once (backup as<file>.pre-custom-layer), puts a replaced logo aside and back, thengit pull --ff-onlyandnpm install --omit=dev. Files put aside come back even if the pull fails.Related Issue
None. Came up while updating the hosted bots to 2.22.0: all three customers had edited a locale that the release changed.
Type of Change
How Was This Tested?
npm test: 423 passed. New:tests/locale-layer.test.js,tests/panel-assets.test.js,tests/updater.test.js(the updater tests use real temporary git repos with an upstream and a release commit). Counter-checks: diff returning the whole object, migration not writing the custom file, reversed precedence and logo not restored each turned the tests red, then restored. The real routes were smoke-tested through Express (GET, PUT, invalid PUT, path traversal, DELETE, audits).Not yet tried on a running hosted bot.
Checklist
client.t(...)and the dashboard UI keys are in all sevenweb/src/localesfilesMSK_API_KEYnpm start) and I verified my change on a test serverdocs/in both languages)CHANGELOG.mdentry under[Unreleased]After deploying, the dashboard service itself needs one restart (the update button only restarts the bot), otherwise the old routes keep writing into the tracked files.