Move My Publications into My Library

Instead of My Publications being a separate library, have it be a
special collection inside My Library. Top-level items can be dragged
into it as before, and child items can be toggled off and on with a
button in the item pane. Newly added child items won't be shown by
default.

For upgraders, items in the My Publications library will be moved into
My Library, which might result in their being duplicated if the items
weren't removed from My Library. The client will then upload those new
items into My Library.

The API endpoint will continue to show items in the separate My
Publications library until My Publications items are added to My
Library, so the profile page will continue to show them.
This commit is contained in:
Dan Stillman 2017-04-12 00:56:37 -04:00
parent e311279947
commit 5ff2a59f87
28 changed files with 969 additions and 239 deletions

View file

@ -336,6 +336,36 @@ describe("Zotero.Item", function () {
})
})
describe("#inPublications", function () {
it("should add item to publications table", function* () {
var item = yield createDataObject('item');
item.inPublications = true;
yield item.saveTx();
assert.ok(item.inPublications);
assert.equal(
(yield Zotero.DB.valueQueryAsync(
"SELECT COUNT(*) FROM publicationsItems WHERE itemID=?", item.id)),
1
);
})
it("should be set to false after save", function* () {
var collection = yield createDataObject('collection');
var item = createUnsavedDataObject('item');
item.inPublications = false;
yield item.saveTx();
item.inPublications = false;
yield item.saveTx();
assert.isFalse(item.inPublications);
assert.equal(
(yield Zotero.DB.valueQueryAsync(
"SELECT COUNT(*) FROM publicationsItems WHERE itemID=?", item.id)),
0
);
})
});
describe("#parentID", function () {
it("should create a child note", function* () {
var item = new Zotero.Item('book');
@ -1168,6 +1198,25 @@ describe("Zotero.Item", function () {
assert.notProperty(json, "filename");
assert.notProperty(json, "path");
});
it("should include inPublications=true for items in My Publications", function* () {
var item = createUnsavedDataObject('item');
item.inPublications = true;
var json = item.toJSON();
assert.propertyVal(json, "inPublications", true);
});
it("shouldn't include inPublications for items not in My Publications in patch mode", function* () {
var item = createUnsavedDataObject('item');
var json = item.toJSON();
assert.notProperty(json, "inPublications");
});
it("should include inPublications=false for items not in My Publications in full mode", function* () {
var item = createUnsavedDataObject('item');
var json = item.toJSON({ mode: 'full' });
assert.property(json, "inPublications", false);
});
})
describe("'full' mode", function () {