From 8d9c7acb3c7bc4d4f34a21601de6a538b7f8336a Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 13 Dec 2017 09:12:54 +0300 Subject: [PATCH] only preserve old style name on update if it was actually customized We didn't detect that previously and just blindly assumed that a local name is always customized by a user, which is nonsense, obviously. To ensure reliable detection a new property is added to the style object: "originalName". From now on the styles that didn't change their name remotely will be successfully marked as having non-customized names, hence the names will update along with the code. Should be like 99% of styles. As for the remaining 1%, welp, only uninstalling and reinstalling the style anew would switch to the new remote name. --- background/update.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/background/update.js b/background/update.js index 724a69de..b27c28f2 100644 --- a/background/update.js +++ b/background/update.js @@ -125,10 +125,16 @@ var updater = { json.id = style.id; json.updateDate = Date.now(); json.reason = 'update'; + // keep current state delete json.enabled; + // keep local name customizations - delete json.name; + if (style.originalName !== style.name && style.name !== json.name) { + delete json.name; + } else { + json.originalName = json.name; + } if (styleSectionsEqual(json, style)) { // update digest even if save === false as there might be just a space added etc.