commit f40b7ae6ac8f59272dd252f551170617aae67d47
parent 9bf4bac2923deb42abc5aab2be515b0cd27c29e4
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 17 Nov 2017 09:29:00 -0500
Show warning on Firefox profile access error after installation
https://www.zotero.org/support/kb/data_missing_after_zotero_5_upgrade
Diffstat:
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/xpcom/dataDirectory.js b/chrome/content/zotero/xpcom/dataDirectory.js
@@ -227,6 +227,7 @@ Zotero.DataDirectory = {
Zotero.debug("An error occurred locating the Firefox profile; "
+ "not attempting to migrate from Zotero for Firefox");
Zotero.logError(e);
+ Zotero.fxProfileAccessError = true;
}
if (defProfile) {
let profileDir = defProfile[0];
@@ -304,6 +305,7 @@ Zotero.DataDirectory = {
e.dataDir = nsIFile.path;
throw e;
}
+ Zotero.fxProfileAccessError = true;
}
}
// If no custom dir specified, check for a subdirectory
@@ -325,6 +327,7 @@ Zotero.DataDirectory = {
catch (e) {
if (!(e instanceof OS.File.Error && e.becauseNoSuchFile)) {
Zotero.logError(e);
+ Zotero.fxProfileAccessError = true;
}
}
}
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
@@ -414,6 +414,31 @@ var ZoteroPane = new function()
searchBar.inputField.select();
}, 1);
+ if (Zotero.fxProfileAccessError) {
+ Zotero.uiReadyPromise.delay(2000).then(function () {
+ var ps = Services.prompt;
+ var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING
+ + ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING;
+ var text = "Zotero was unable to access your Firefox profile directory.\n\n"
+ + "If you’re upgrading from Zotero 4.0 for Firefox and don’t see the data "
+ + "you expect, it may be located elsewhere on your computer. "
+ + "Click “More Information” for help restoring your previous data.\n\n"
+ + "If you’re new to Zotero, you can ignore this message.";
+ var url = 'https://www.zotero.org/support/kb/data_missing_after_zotero_5_upgrade';
+ let index = ps.confirmEx(null,
+ Zotero.getString('general.warning'),
+ text,
+ buttonFlags,
+ Zotero.getString('general.moreInformation'),
+ "Ignore",
+ null, null, {}
+ );
+ if (index == 0) {
+ this.loadURI(url);
+ }
+ }.bind(this));
+ }
+
// Auto-sync on pane open or if new account
if (Zotero.Prefs.get('sync.autoSync') || Zotero.initAutoSync) {
yield Zotero.proxyAuthComplete;
@@ -428,6 +453,9 @@ var ZoteroPane = new function()
else if (Zotero.Sync.Server.manualSyncRequired) {
Zotero.debug('Manual sync required -- skipping auto-sync', 4);
}
+ else if (Zotero.fxProfileAccessError) {
+ Zotero.debug('Firefox profile access error -- skipping initial auto-sync', 4);
+ }
else {
Zotero.Sync.Runner.sync({
background: true