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
42a399a3
Commit
42a399a3
authored
Aug 11, 2020
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Aug 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove removed annotations from additional selection collections
parent
5011915f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
selection.js
src/sidebar/store/modules/selection.js
+15
-7
selection-test.js
src/sidebar/store/modules/test/selection-test.js
+6
-0
No files found.
src/sidebar/store/modules/selection.js
View file @
42a399a3
...
@@ -266,12 +266,6 @@ const update = {
...
@@ -266,12 +266,6 @@ const update = {
},
},
REMOVE_ANNOTATIONS
:
function
(
state
,
action
)
{
REMOVE_ANNOTATIONS
:
function
(
state
,
action
)
{
const
selection
=
{
...
state
.
selected
};
action
.
annotationsToRemove
.
forEach
(
annotation
=>
{
if
(
annotation
.
id
)
{
delete
selection
[
annotation
.
id
];
}
});
let
newTab
=
state
.
selectedTab
;
let
newTab
=
state
.
selectedTab
;
// If the orphans tab is selected but no remaining annotations are orphans,
// If the orphans tab is selected but no remaining annotations are orphans,
// switch back to annotations tab
// switch back to annotations tab
...
@@ -281,9 +275,23 @@ const update = {
...
@@ -281,9 +275,23 @@ const update = {
)
{
)
{
newTab
=
uiConstants
.
TAB_ANNOTATIONS
;
newTab
=
uiConstants
.
TAB_ANNOTATIONS
;
}
}
const
removeAnns
=
collection
=>
{
action
.
annotationsToRemove
.
forEach
(
annotation
=>
{
if
(
annotation
.
id
)
{
delete
collection
[
annotation
.
id
];
}
if
(
annotation
.
$tag
)
{
delete
collection
[
annotation
.
$tag
];
}
});
return
collection
;
};
return
{
return
{
...
setTab
(
newTab
,
state
.
selectedTab
),
...
setTab
(
newTab
,
state
.
selectedTab
),
selected
:
selection
,
expanded
:
removeAnns
({
...
state
.
expanded
}),
forcedVisible
:
removeAnns
({
...
state
.
forcedVisible
}),
selected
:
removeAnns
({
...
state
.
selected
}),
};
};
},
},
};
};
...
...
src/sidebar/store/modules/test/selection-test.js
View file @
42a399a3
...
@@ -271,11 +271,17 @@ describe('sidebar/store/modules/selection', () => {
...
@@ -271,11 +271,17 @@ describe('sidebar/store/modules/selection', () => {
describe
(
'#REMOVE_ANNOTATIONS'
,
function
()
{
describe
(
'#REMOVE_ANNOTATIONS'
,
function
()
{
it
(
'removing an annotation should also remove it from the selection'
,
function
()
{
it
(
'removing an annotation should also remove it from the selection'
,
function
()
{
store
.
selectAnnotations
([
1
,
2
,
3
]);
store
.
selectAnnotations
([
1
,
2
,
3
]);
store
.
setForcedVisible
(
2
,
true
);
store
.
setForcedVisible
(
1
,
true
);
store
.
setExpanded
(
1
,
true
);
store
.
setExpanded
(
2
,
true
);
store
.
removeAnnotations
([{
id
:
2
}]);
store
.
removeAnnotations
([{
id
:
2
}]);
assert
.
deepEqual
(
getSelectionState
().
selected
,
{
assert
.
deepEqual
(
getSelectionState
().
selected
,
{
1
:
true
,
1
:
true
,
3
:
true
,
3
:
true
,
});
});
assert
.
deepEqual
(
store
.
forcedVisibleAnnotations
(),
[
'1'
]);
assert
.
deepEqual
(
store
.
expandedMap
(),
{
1
:
true
});
});
});
});
});
...
...
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