Skip to content

Commit 0fd5644

Browse files
authored
Merge pull request #4580 from akolson/remote-publish-change-edgecase
Update publish logic with edge case
2 parents 3d68d39 + 8e15cef commit 0fd5644

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

contentcuration/contentcuration/frontend/shared/data/applyRemoteChanges.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,17 @@ class ReturnedChanges extends ChangeDispatcher {
186186
}
187187

188188
// Publish changes associate with the channel, but we open a transaction on contentnode
189-
return transaction(change, TABLE_NAMES.CONTENTNODE, () => {
189+
return transaction(change, TABLE_NAMES.CONTENTNODE, TABLE_NAMES.CHANGES_TABLE, () => {
190190
return db
191191
.table(TABLE_NAMES.CONTENTNODE)
192192
.where({ channel_id: change.channel_id })
193+
.and(node => {
194+
const unpublishedNodeIds = db[TABLE_NAMES.CHANGES_TABLE]
195+
.where({ table: TABLE_NAMES.CONTENTNODE, key: node.id })
196+
.limit(1)
197+
.toArray();
198+
return unpublishedNodeIds.length === 0;
199+
})
193200
.modify({ changed: false, published: true });
194201
});
195202
}

0 commit comments

Comments
 (0)