From 7ef7bf4ac5744f2881cfc95ea22ca0a6db4065a8 Mon Sep 17 00:00:00 2001 From: Blaine Jester Date: Mon, 22 Apr 2024 09:15:41 -0700 Subject: [PATCH 1/2] Properly format node_id+channel_id query parameter --- .../frontend/channelEdit/vuex/clipboard/actions.js | 2 +- .../shared/data/__tests__/ContentNodeResource.spec.js | 4 ++-- .../contentcuration/frontend/shared/data/resources.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/vuex/clipboard/actions.js b/contentcuration/contentcuration/frontend/channelEdit/vuex/clipboard/actions.js index d6327f65fe..af95347d20 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/vuex/clipboard/actions.js +++ b/contentcuration/contentcuration/frontend/channelEdit/vuex/clipboard/actions.js @@ -193,7 +193,7 @@ export function addClipboardNodeFromListener(context, obj) { .then(() => context.dispatch( 'contentNode/loadContentNodes', - { '[node_id+channel_id]__in': [obj.source_node_id, obj.source_channel_id] }, + { '[node_id+channel_id]__in': [[obj.source_node_id, obj.source_channel_id]] }, { root } ) ) diff --git a/contentcuration/contentcuration/frontend/shared/data/__tests__/ContentNodeResource.spec.js b/contentcuration/contentcuration/frontend/shared/data/__tests__/ContentNodeResource.spec.js index b8fc305e93..542d0ca6aa 100644 --- a/contentcuration/contentcuration/frontend/shared/data/__tests__/ContentNodeResource.spec.js +++ b/contentcuration/contentcuration/frontend/shared/data/__tests__/ContentNodeResource.spec.js @@ -720,7 +720,7 @@ describe('ContentNode methods', () => { ); expect(table.get).toHaveBeenCalledWith({ '[node_id+channel_id]': [node_id, channel_id] }); expect(fetchCollection).toHaveBeenCalledWith({ - _node_id_channel_id_: [node_id, channel_id], + '[node_id+channel_id]__in': [[node_id, channel_id]], }); }); @@ -731,7 +731,7 @@ describe('ContentNode methods', () => { await expect(ContentNode.getByNodeIdChannelId(node_id, channel_id)).resolves.toBeFalsy(); expect(table.get).toHaveBeenCalledWith({ '[node_id+channel_id]': [node_id, channel_id] }); expect(fetchCollection).toHaveBeenCalledWith({ - _node_id_channel_id_: [node_id, channel_id], + '[node_id+channel_id]__in': [[node_id, channel_id]], }); }); }); diff --git a/contentcuration/contentcuration/frontend/shared/data/resources.js b/contentcuration/contentcuration/frontend/shared/data/resources.js index 89d99945f9..f22d7d10ef 100644 --- a/contentcuration/contentcuration/frontend/shared/data/resources.js +++ b/contentcuration/contentcuration/frontend/shared/data/resources.js @@ -1644,7 +1644,7 @@ export const ContentNode = new TreeResource({ const values = [nodeId, channelId]; return this.table.get({ '[node_id+channel_id]': values }).then(node => { if (!node) { - return this.fetchCollection({ _node_id_channel_id_: values }).then(nodes => nodes[0]); + return this.fetchCollection({ '[node_id+channel_id]__in': [values] }).then(nodes => nodes[0]); } return node; }); From 19a15f527003fc18ca552bb404c7480438d5a174 Mon Sep 17 00:00:00 2001 From: Blaine Jester Date: Mon, 22 Apr 2024 09:24:51 -0700 Subject: [PATCH 2/2] Fix linting issue --- .../contentcuration/frontend/shared/data/resources.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contentcuration/contentcuration/frontend/shared/data/resources.js b/contentcuration/contentcuration/frontend/shared/data/resources.js index f22d7d10ef..e23399479f 100644 --- a/contentcuration/contentcuration/frontend/shared/data/resources.js +++ b/contentcuration/contentcuration/frontend/shared/data/resources.js @@ -1644,7 +1644,9 @@ export const ContentNode = new TreeResource({ const values = [nodeId, channelId]; return this.table.get({ '[node_id+channel_id]': values }).then(node => { if (!node) { - return this.fetchCollection({ '[node_id+channel_id]__in': [values] }).then(nodes => nodes[0]); + return this.fetchCollection({ '[node_id+channel_id]__in': [values] }).then( + nodes => nodes[0] + ); } return node; });