From 7fcc1d35a4cecff34be4bd0eadb897e081d784de Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 21 Oct 2022 04:18:30 -0400 Subject: [PATCH] Reset note Quick Copy pref on upgrade if set to Markdown + Rich Text The default JSON pref value used spaces, but changing the drop-down resulted in a version without spaces, so simply changing the default to include the new link options wouldn't change all existing installs and the "Include App Links" checkbox wouldn't show as enabled for Markdown. This adds a pref migration step to reset the pref to the new default if it's set to Markdown + Rich Text, regardless of whitespace differences. --- chrome/content/zotero/xpcom/prefs.js | 20 +++++++++++++++++++- test/runtests.sh | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/prefs.js b/chrome/content/zotero/xpcom/prefs.js index c34993032a..92804467d0 100644 --- a/chrome/content/zotero/xpcom/prefs.js +++ b/chrome/content/zotero/xpcom/prefs.js @@ -49,7 +49,7 @@ Zotero.Prefs = new function(){ if (!fromVersion) { fromVersion = 0; } - var toVersion = 5; + var toVersion = 6; if (fromVersion < toVersion) { for (var i = fromVersion + 1; i <= toVersion; i++) { switch (i) { @@ -85,6 +85,24 @@ Zotero.Prefs = new function(){ case 5: this.clear('extensions.spellcheck.inline.max-misspellings', true); break; + + // If the note Quick Copy setting was set to Markdown + Rich Text but in a + // non-default way (e.g., because of whitespace differences), clear the pref + // to pick up the new app-link options + case 6: + var o = this.get('export.noteQuickCopy.setting'); + try { + o = JSON.parse(o); + if (o.mode == 'export' + && o.id == Zotero.Translators.TRANSLATOR_ID_MARKDOWN_AND_RICH_TEXT) { + this.clear('export.noteQuickCopy.setting'); + } + } + catch (e) { + Zotero.logError(e); + this.clear('export.noteQuickCopy.setting'); + } + break; } } this.set('prefVersion', toVersion); diff --git a/test/runtests.sh b/test/runtests.sh index 90fdf321f9..1e3d4fb4d0 100755 --- a/test/runtests.sh +++ b/test/runtests.sh @@ -17,7 +17,7 @@ function makePath { if [ -z "$FX_EXECUTABLE" ]; then if [ "`uname`" == "Darwin" ]; then - FX_EXECUTABLE="$( dirname "$ROOT_DIR" )/zotero-standalone-build/xulrunner/Firefox.app/Contents/MacOS/firefox" + FX_EXECUTABLE="$( dirname "$ROOT_DIR" )/zotero-standalone-build-60/xulrunner/Firefox.app/Contents/MacOS/firefox" else FX_EXECUTABLE="$( dirname "$ROOT_DIR" )/zotero-standalone-build/xulrunner/firefox-x86_64/firefox" fi