Fix invalid document citation style recovery. Closes #1543
This commit is contained in:
parent
11701f68a0
commit
0f1687f1c7
3 changed files with 15 additions and 7 deletions
|
@ -1030,7 +1030,7 @@ Zotero.Server.Connector.InstallStyle.prototype = {
|
||||||
|
|
||||||
init: Zotero.Promise.coroutine(function* (requestData) {
|
init: Zotero.Promise.coroutine(function* (requestData) {
|
||||||
try {
|
try {
|
||||||
var styleName = yield Zotero.Styles.install(
|
var { styleName, styleID } = yield Zotero.Styles.install(
|
||||||
requestData.data, requestData.query.origin || null, true
|
requestData.data, requestData.query.origin || null, true
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -448,9 +448,10 @@ Zotero.Integration = new function() {
|
||||||
|
|
||||||
let installed = false;
|
let installed = false;
|
||||||
try {
|
try {
|
||||||
await Zotero.Styles.install(
|
let { styleTitle, styleID } = await Zotero.Styles.install(
|
||||||
{url: data.style.styleID}, data.style.styleID, true
|
{url: data.style.styleID}, data.style.styleID, true
|
||||||
);
|
);
|
||||||
|
data.style.styleID = styleID;
|
||||||
installed = true;
|
installed = true;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
@ -464,10 +465,15 @@ Zotero.Integration = new function() {
|
||||||
}
|
}
|
||||||
if (installed) {
|
if (installed) {
|
||||||
await session.setData(data, true);
|
await session.setData(data, true);
|
||||||
|
} else {
|
||||||
|
await session.setDocPrefs();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
await session.setDocPrefs();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
await session.setDocPrefs();
|
||||||
}
|
}
|
||||||
await session.setDocPrefs();
|
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,7 +279,6 @@ Zotero.Styles = new function() {
|
||||||
* @param {Boolean} [silent=false] Skip prompts
|
* @param {Boolean} [silent=false] Skip prompts
|
||||||
*/
|
*/
|
||||||
this.install = Zotero.Promise.coroutine(function* (style, origin, silent=false) {
|
this.install = Zotero.Promise.coroutine(function* (style, origin, silent=false) {
|
||||||
var styleTitle;
|
|
||||||
var warnDeprecated;
|
var warnDeprecated;
|
||||||
if (style instanceof Components.interfaces.nsIFile) {
|
if (style instanceof Components.interfaces.nsIFile) {
|
||||||
warnDeprecated = true;
|
warnDeprecated = true;
|
||||||
|
@ -299,7 +298,7 @@ Zotero.Styles = new function() {
|
||||||
else if (style.url) {
|
else if (style.url) {
|
||||||
style.string = yield Zotero.File.getContentsFromURLAsync(style.url);
|
style.string = yield Zotero.File.getContentsFromURLAsync(style.url);
|
||||||
}
|
}
|
||||||
styleTitle = yield _install(style.string, origin, false, silent);
|
var { styleTitle, styleID } = yield _install(style.string, origin, false, silent);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
// Unless user cancelled, show an alert with the error
|
// Unless user cancelled, show an alert with the error
|
||||||
|
@ -321,7 +320,7 @@ Zotero.Styles = new function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return styleTitle;
|
return { styleTitle, styleID };
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -503,7 +502,10 @@ Zotero.Styles = new function() {
|
||||||
yield win.Zotero_Preferences.Cite.refreshStylesList(styleID);
|
yield win.Zotero_Preferences.Cite.refreshStylesList(styleID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return existingTitle || title;
|
return {
|
||||||
|
styleTitle: existingTitle || title,
|
||||||
|
styleID: styleID
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue