Show warning on Firefox profile access error after installation

https://www.zotero.org/support/kb/data_missing_after_zotero_5_upgrade
This commit is contained in:
Dan Stillman 2017-11-17 09:29:00 -05:00
parent 9bf4bac292
commit f40b7ae6ac
2 changed files with 31 additions and 0 deletions

View file

@ -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;
}
}
}

View file

@ -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 youre upgrading from Zotero 4.0 for Firefox and dont 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 youre 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