Fix showing of WebDAV settings in sync prefs
This commit is contained in:
parent
0ea328dac5
commit
caaee87e9e
|
@ -494,6 +494,12 @@ Zotero.Sync.Storage.Local = {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark all stored files for upload checking
|
||||||
|
*
|
||||||
|
* This is used when switching between storage modes in the preferences so that all existing files
|
||||||
|
* are uploaded via the new mode if necessary.
|
||||||
|
*/
|
||||||
resetModeSyncStates: Zotero.Promise.coroutine(function* () {
|
resetModeSyncStates: Zotero.Promise.coroutine(function* () {
|
||||||
var sql = "SELECT itemID FROM items JOIN itemAttachments USING (itemID) "
|
var sql = "SELECT itemID FROM items JOIN itemAttachments USING (itemID) "
|
||||||
+ "WHERE libraryID=? AND itemTypeID=? AND linkMode IN (?, ?)";
|
+ "WHERE libraryID=? AND itemTypeID=? AND linkMode IN (?, ?)";
|
||||||
|
@ -504,7 +510,7 @@ Zotero.Sync.Storage.Local = {
|
||||||
Zotero.Attachments.LINK_MODE_IMPORTED_URL,
|
Zotero.Attachments.LINK_MODE_IMPORTED_URL,
|
||||||
];
|
];
|
||||||
var itemIDs = yield Zotero.DB.columnQueryAsync(sql, params);
|
var itemIDs = yield Zotero.DB.columnQueryAsync(sql, params);
|
||||||
for (let itemID of items) {
|
for (let itemID of itemIDs) {
|
||||||
let item = Zotero.Items.get(itemID);
|
let item = Zotero.Items.get(itemID);
|
||||||
item._attachmentSyncState = this.SYNC_STATE_TO_UPLOAD;
|
item._attachmentSyncState = this.SYNC_STATE_TO_UPLOAD;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,22 @@ describe("Zotero.Sync.Storage.Local", function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("#resetModeSyncStates()", function () {
|
||||||
|
it("should reset attachment sync states to 'to_upload'", function* () {
|
||||||
|
var attachment = yield importFileAttachment('test.png');
|
||||||
|
attachment.attachmentSyncState = 'in_sync';
|
||||||
|
yield attachment.saveTx();
|
||||||
|
|
||||||
|
var local = Zotero.Sync.Storage.Local;
|
||||||
|
yield local.resetModeSyncStates()
|
||||||
|
assert.strictEqual(attachment.attachmentSyncState, local.SYNC_STATE_TO_UPLOAD);
|
||||||
|
var state = yield Zotero.DB.valueQueryAsync(
|
||||||
|
"SELECT syncState FROM itemAttachments WHERE itemID=?", attachment.id
|
||||||
|
);
|
||||||
|
assert.strictEqual(state, local.SYNC_STATE_TO_UPLOAD);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("#processDownload()", function () {
|
describe("#processDownload()", function () {
|
||||||
var file1Name = 'index.html';
|
var file1Name = 'index.html';
|
||||||
var file1Contents = '<html><body>Test</body></html>';
|
var file1Contents = '<html><body>Test</body></html>';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user