Load reverse relations mappings at startup

This allows Zotero.Relations.getByPredicateAndObject()/getByObject() and
Zotero.Item::getLinkedItem()/Zotero.Collection::getLinkedCollection() to
be synchronous, which is necessary for word processor integration.
This commit is contained in:
Dan Stillman 2016-03-18 04:04:33 -04:00
parent 5d3e7f555c
commit da45df06cc
12 changed files with 187 additions and 92 deletions

View file

@ -424,7 +424,7 @@ describe("Zotero.CollectionTreeView", function() {
assert.equal(treeRow.ref.libraryID, group.libraryID);
assert.equal(treeRow.ref.id, ids[0]);
// New item should link back to original
var linked = yield item.getLinkedItem(group.libraryID);
var linked = item.getLinkedItem(group.libraryID);
assert.equal(linked.id, treeRow.ref.id);
// Check attachment
@ -434,7 +434,7 @@ describe("Zotero.CollectionTreeView", function() {
treeRow = itemsView.getRow(1);
assert.equal(treeRow.ref.id, ids[1]);
// New attachment should link back to original
linked = yield attachment.getLinkedItem(group.libraryID);
linked = attachment.getLinkedItem(group.libraryID);
assert.equal(linked.id, treeRow.ref.id);
return group.eraseTx();
@ -466,7 +466,7 @@ describe("Zotero.CollectionTreeView", function() {
var item = yield createDataObject('item', false, { skipSelect: true });
yield drop('item', 'L' + group.libraryID, [item.id]);
var droppedItem = yield item.getLinkedItem(group.libraryID);
var droppedItem = item.getLinkedItem(group.libraryID);
droppedItem.setCollections([collection.id]);
droppedItem.deleted = true;
yield droppedItem.saveTx();