Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
a218e819
Commit
a218e819
authored
Aug 14, 2020
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Aug 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assure all `thread` objects are assigned a unique `id`
parent
51ef55a1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
build-thread.js
src/sidebar/util/build-thread.js
+1
-1
build-thread-test.js
src/sidebar/util/test/build-thread-test.js
+5
-2
No files found.
src/sidebar/util/build-thread.js
View file @
a218e819
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
* Default state for new threads
* Default state for new threads
*/
*/
const
DEFAULT_THREAD_STATE
=
{
const
DEFAULT_THREAD_STATE
=
{
id
:
'__default__'
,
collapsed
:
false
,
collapsed
:
false
,
visible
:
true
,
visible
:
true
,
replyCount
:
0
,
replyCount
:
0
,
...
@@ -88,6 +87,7 @@ function setParent(threads, id, parents = []) {
...
@@ -88,6 +87,7 @@ function setParent(threads, id, parents = []) {
threads
[
parentId
]
=
{
threads
[
parentId
]
=
{
...
DEFAULT_THREAD_STATE
,
...
DEFAULT_THREAD_STATE
,
children
:
[],
children
:
[],
id
:
parentId
,
};
};
// Link up this new thread to _its_ parent, which should be the original
// Link up this new thread to _its_ parent, which should be the original
// thread's grandparent
// thread's grandparent
...
...
src/sidebar/util/test/build-thread-test.js
View file @
a218e819
...
@@ -184,11 +184,14 @@ describe('sidebar/util/build-thread', function () {
...
@@ -184,11 +184,14 @@ describe('sidebar/util/build-thread', function () {
references
:
[
'3'
],
references
:
[
'3'
],
},
},
];
];
const
thread
=
createThread
(
fixture
);
// Get the threads with `id` key included
const
thread
=
createThread
(
fixture
,
{},
[
'id'
]);
// It should create a thread with an id of the missing annotation (3)
assert
.
deepEqual
(
thread
,
[
assert
.
deepEqual
(
thread
,
[
{
{
id
:
'3'
,
annotation
:
undefined
,
annotation
:
undefined
,
children
:
[{
annotation
:
fixture
[
0
],
children
:
[]
}],
children
:
[{
id
:
'1'
,
annotation
:
fixture
[
0
],
children
:
[]
}],
},
},
]);
]);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment