mirror of
https://github.com/zotero/zotero.git
synced 2026-10-10 03:28:10 +00:00
Mark the first request when using Replace Online Library
Add a restoreToServer=1 query parameter so we can identify restores server-side if necessary
This commit is contained in:
parent
5336c3562b
commit
a69b55ea96
3 changed files with 10 additions and 3 deletions
|
|
@ -825,7 +825,8 @@ Zotero.Sync.APIClient.prototype = {
|
|||
'sort',
|
||||
'direction',
|
||||
'since',
|
||||
'sincetime'
|
||||
'sincetime',
|
||||
'restoreToServer'
|
||||
];
|
||||
queryParams = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -2045,11 +2045,13 @@ Zotero.Sync.Data.Engine.prototype._restoreToServer = async function () {
|
|||
let ObjectType = Zotero.Utilities.capitalize(objectType);
|
||||
let objectsClass = Zotero.DataObjectUtilities.getObjectsClassForObjectType(objectType);
|
||||
|
||||
// Get all object versions from the API
|
||||
// Get all object versions from the API, marking the first request so that restores can
|
||||
// be identified in server logs
|
||||
let results = await this.apiClient.getVersions(
|
||||
this.library.libraryType,
|
||||
this.libraryTypeID,
|
||||
objectType
|
||||
objectType,
|
||||
libraryVersion ? undefined : { restoreToServer: 1 }
|
||||
);
|
||||
if (libraryVersion && libraryVersion != results.libraryVersion) {
|
||||
throw new Error(remoteUpdatedError
|
||||
|
|
|
|||
|
|
@ -5206,6 +5206,10 @@ describe("Zotero.Sync.Data.Engine", function () {
|
|||
for (let type of types) {
|
||||
let plural = Zotero.DataObjectUtilities.getObjectTypePlural(type);
|
||||
let suffix = type == 'item' ? '&includeTrashed=1' : '';
|
||||
// Only the first request of the restore is marked
|
||||
if (type == types[0]) {
|
||||
suffix += '&restoreToServer=1';
|
||||
}
|
||||
|
||||
let json = {};
|
||||
json[objectJSON[type][0].key] = objectJSON[type][0].version;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue