Skip to content

Commit

Permalink
Comment Template: Remove the id from the comment object
Browse files Browse the repository at this point in the history
  • Loading branch information
michalczaplinski committed Dec 3, 2021
1 parent 712a9c1 commit 802e379
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
16 changes: 3 additions & 13 deletions packages/block-library/src/comment-template/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,21 @@ describe( 'Convert to tree', () => {

expect( comments ).toEqual( [
{
id: 1,
commentId: 1,
parent: 0,
children: [
{
children: [],
id: 6,
commentId: 6,
parent: 1,
children: [],
},
],
},
{
id: 2,
commentId: 2,
parent: 0,
children: [
{ children: [], commentId: 3, id: 3, parent: 2 },
{ commentId: 3, children: [] },
{
children: [
{ children: [], commentId: 5, id: 5, parent: 4 },
],
id: 4,
commentId: 4,
parent: 2,
children: [ { commentId: 5, children: [] } ],
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/comment-template/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const convertToTree = ( data ) => {

// First create a hash table of { [id]: { ...comment, children: [] }}
data.forEach( ( item ) => {
table[ item.id ] = { ...item, commentId: item.id, children: [] };
table[ item.id ] = { commentId: item.id, children: [] };
} );

const tree = [];
Expand Down

0 comments on commit 802e379

Please sign in to comment.