Adjustments to citation retraction warning (#1704)
- Fix don't-show-again checkbox for non-DB items - Tweak warning text - Don't show comma after year if year is missing (which it shouldn't be) - Remove redundant try/catch
This commit is contained in:
parent
4337362a1b
commit
45f6492494
2 changed files with 12 additions and 14 deletions
|
@ -971,7 +971,7 @@ Zotero.Integration.Fields.prototype.updateSession = Zotero.Promise.coroutine(fun
|
||||||
yield this._session.handleRetractedItems();
|
yield this._session.handleRetractedItems();
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
Zotero.debug('Retracted item handling failed');
|
Zotero.debug('Retracted item handling failed', 2);
|
||||||
Zotero.logError(e);
|
Zotero.logError(e);
|
||||||
}
|
}
|
||||||
this._session.regenAll = false;
|
this._session.regenAll = false;
|
||||||
|
@ -1939,7 +1939,8 @@ Zotero.Integration.Session.prototype.handleRetractedItems = async function () {
|
||||||
const dealWithRetracted = (citedItem, inLibrary) => {
|
const dealWithRetracted = (citedItem, inLibrary) => {
|
||||||
let dontPromptAgain = this.promptForRetraction(citedItem, inLibrary);
|
let dontPromptAgain = this.promptForRetraction(citedItem, inLibrary);
|
||||||
if (dontPromptAgain) {
|
if (dontPromptAgain) {
|
||||||
for (let citation of this.citationsByItemID[citedItem.id]) {
|
let itemID = citedItem.id || citedItem.cslItemID;
|
||||||
|
for (let citation of this.citationsByItemID[itemID]) {
|
||||||
for (let item of citation.citationItems) {
|
for (let item of citation.citationItems) {
|
||||||
item.ignoreRetraction = true;
|
item.ignoreRetraction = true;
|
||||||
}
|
}
|
||||||
|
@ -1961,13 +1962,9 @@ Zotero.Integration.Session.prototype.handleRetractedItems = async function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
var retractedIndices = await Zotero.Retractions.getRetractionsFromJSON(
|
||||||
var retractedIndices = await Zotero.Retractions.getRetractionsFromJSON(
|
embeddedZoteroItems.map(item => item.toJSON())
|
||||||
embeddedZoteroItems.map(item => item.toJSON()));
|
);
|
||||||
} catch (e) {
|
|
||||||
Zotero.debug("Retraction for embedded docs lookup failed");
|
|
||||||
Zotero.logError(e);
|
|
||||||
}
|
|
||||||
for (let index of retractedIndices) {
|
for (let index of retractedIndices) {
|
||||||
dealWithRetracted(embeddedZoteroItems[index]);
|
dealWithRetracted(embeddedZoteroItems[index]);
|
||||||
}
|
}
|
||||||
|
@ -1978,10 +1975,11 @@ Zotero.Integration.Session.prototype.promptForRetraction = function (citedItem,
|
||||||
let buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_OK);
|
let buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_OK);
|
||||||
// Cannot use citedItem.firstCreator since embedded items do not have that
|
// Cannot use citedItem.firstCreator since embedded items do not have that
|
||||||
let creator = citedItem.getCreator(0);
|
let creator = citedItem.getCreator(0);
|
||||||
|
let year = citedItem.getField('year');
|
||||||
let itemString = (creator ? creator.lastName + ", " : "")
|
let itemString = (creator ? creator.lastName + ", " : "")
|
||||||
+ citedItem.getField('year') + ", "
|
+ (year ? year + ", " : "")
|
||||||
+ citedItem.getDisplayTitle();
|
+ citedItem.getDisplayTitle();
|
||||||
let promptText = Zotero.getString('retraction.citedItemWarning')
|
let promptText = Zotero.getString('retraction.citationWarning')
|
||||||
+ "\n\n"
|
+ "\n\n"
|
||||||
+ itemString;
|
+ itemString;
|
||||||
if (inLibrary) {
|
if (inLibrary) {
|
||||||
|
@ -1993,7 +1991,7 @@ Zotero.Integration.Session.prototype.promptForRetraction = function (citedItem,
|
||||||
promptText,
|
promptText,
|
||||||
buttonFlags,
|
buttonFlags,
|
||||||
null, null, null,
|
null, null, null,
|
||||||
Zotero.getString('retraction.citedItemWarning.dontWarn'), checkbox);
|
Zotero.getString('retraction.citationWarning.dontWarn'), checkbox);
|
||||||
|
|
||||||
return checkbox.value;
|
return checkbox.value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1211,5 +1211,5 @@ retraction.details = More details:
|
||||||
retraction.credit = Data from %S
|
retraction.credit = Data from %S
|
||||||
retraction.citeWarning.text1 = The item you are citing has been retracted. Do you still want to add it to your document?
|
retraction.citeWarning.text1 = The item you are citing has been retracted. Do you still want to add it to your document?
|
||||||
retraction.citeWarning.text2 = You can view the item in your library for further details on the retraction.
|
retraction.citeWarning.text2 = You can view the item in your library for further details on the retraction.
|
||||||
retraction.citedItemWarning = A cited item in your document has been retracted:
|
retraction.citationWarning = A citation in your document has been retracted:
|
||||||
retraction.citedItemWarning.dontWarn = Don’t warn me about this item again
|
retraction.citationWarning.dontWarn = Don’t warn me about this citation again
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue