Skip to content

Commit 1a9b8b1

Browse files
committed
Allow for new two-step book record creation (BL-12568)
1 parent 0ede0e5 commit 1a9b8b1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cloud/main.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,16 @@ Parse.Cloud.beforeSave(
295295
book.set("updateSource", newUpdateSource);
296296
}
297297
// As of April 2020, BloomDesktop 4.7 now sets the updateSource to "BloomDesktop {version}".
298+
// In Bloom 5.6 (Oct 2023), we started uploading through an API.
299+
// For book updates, updateSource behaves as previously. But for new books,
300+
// the parse record creation is a two-step process. upload-start creates an empty record
301+
// with updateSource="BloomDesktop via API". Then upload-finish fills in the record
302+
// and includes updateSource="BloomDesktop {version} (new book)" so we can distinguish
303+
// that type of new-book update from a real update.
298304
if (newUpdateSource.startsWith("BloomDesktop")) {
299305
// Change came from BloomDesktop upload (or reupload)
300306
book.addUnique("tags", "system:Incoming");
301-
if (book.isNew()) {
307+
if (book.isNew() || newUpdateSource.endsWith("(new book)")) {
302308
book.set("harvestState", "New");
303309
} else {
304310
book.set("harvestState", "Updated");

0 commit comments

Comments
 (0)