Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fc4b64a2
Commit
fc4b64a2
authored
Nov 03, 2021
by
Thomas Randolph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a mutation for setting the viewed status of a file
This viewed status is specifically used in the file tree
parent
97ee889c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
app/assets/javascripts/diffs/store/mutation_types.js
app/assets/javascripts/diffs/store/mutation_types.js
+1
-0
app/assets/javascripts/diffs/store/mutations.js
app/assets/javascripts/diffs/store/mutations.js
+3
-0
spec/frontend/diffs/store/mutations_spec.js
spec/frontend/diffs/store/mutations_spec.js
+20
-0
No files found.
app/assets/javascripts/diffs/store/mutation_types.js
View file @
fc4b64a2
...
@@ -21,6 +21,7 @@ export const REMOVE_LINE_DISCUSSIONS_FOR_FILE = 'REMOVE_LINE_DISCUSSIONS_FOR_FIL
...
@@ -21,6 +21,7 @@ export const REMOVE_LINE_DISCUSSIONS_FOR_FILE = 'REMOVE_LINE_DISCUSSIONS_FOR_FIL
export
const
TOGGLE_FOLDER_OPEN
=
'
TOGGLE_FOLDER_OPEN
'
;
export
const
TOGGLE_FOLDER_OPEN
=
'
TOGGLE_FOLDER_OPEN
'
;
export
const
SET_SHOW_TREE_LIST
=
'
SET_SHOW_TREE_LIST
'
;
export
const
SET_SHOW_TREE_LIST
=
'
SET_SHOW_TREE_LIST
'
;
export
const
VIEW_DIFF_FILE
=
'
VIEW_DIFF_FILE
'
;
export
const
VIEW_DIFF_FILE
=
'
VIEW_DIFF_FILE
'
;
export
const
SET_DIFF_FILE_VIEWED
=
'
SET_DIFF_FILE_VIEWED
'
;
export
const
OPEN_DIFF_FILE_COMMENT_FORM
=
'
OPEN_DIFF_FILE_COMMENT_FORM
'
;
export
const
OPEN_DIFF_FILE_COMMENT_FORM
=
'
OPEN_DIFF_FILE_COMMENT_FORM
'
;
export
const
UPDATE_DIFF_FILE_COMMENT_FORM
=
'
UPDATE_DIFF_FILE_COMMENT_FORM
'
;
export
const
UPDATE_DIFF_FILE_COMMENT_FORM
=
'
UPDATE_DIFF_FILE_COMMENT_FORM
'
;
...
...
app/assets/javascripts/diffs/store/mutations.js
View file @
fc4b64a2
...
@@ -258,6 +258,9 @@ export default {
...
@@ -258,6 +258,9 @@ export default {
state
.
currentDiffFileId
=
fileId
;
state
.
currentDiffFileId
=
fileId
;
Vue
.
set
(
state
.
viewedDiffFileIds
,
fileId
,
true
);
Vue
.
set
(
state
.
viewedDiffFileIds
,
fileId
,
true
);
},
},
[
types
.
SET_DIFF_FILE_VIEWED
](
state
,
{
id
,
seen
})
{
Vue
.
set
(
state
.
viewedDiffFileIds
,
id
,
seen
);
},
[
types
.
OPEN_DIFF_FILE_COMMENT_FORM
](
state
,
formData
)
{
[
types
.
OPEN_DIFF_FILE_COMMENT_FORM
](
state
,
formData
)
{
state
.
commentForms
.
push
({
state
.
commentForms
.
push
({
...
formData
,
...
formData
,
...
...
spec/frontend/diffs/store/mutations_spec.js
View file @
fc4b64a2
...
@@ -643,6 +643,26 @@ describe('DiffsStoreMutations', () => {
...
@@ -643,6 +643,26 @@ describe('DiffsStoreMutations', () => {
});
});
});
});
describe
(
'
SET_DIFF_FILE_VIEWED
'
,
()
=>
{
let
state
;
beforeEach
(()
=>
{
state
=
{
viewedDiffFileIds
:
{
123
:
true
},
};
});
it
.
each
`
id | bool | outcome
${
'
abc
'
}
|
${
true
}
|
${{
123
:
true
,
abc
:
true
}
}
${
'
123
'
}
|
${
false
}
|
${{
123
:
false
}
}
`
(
'
sets the viewed files list to $bool for the id $id
'
,
({
id
,
bool
,
outcome
})
=>
{
mutations
[
types
.
SET_DIFF_FILE_VIEWED
](
state
,
{
id
,
seen
:
bool
});
expect
(
state
.
viewedDiffFileIds
).
toEqual
(
outcome
);
});
});
describe
(
'
Set highlighted row
'
,
()
=>
{
describe
(
'
Set highlighted row
'
,
()
=>
{
it
(
'
sets highlighted row
'
,
()
=>
{
it
(
'
sets highlighted row
'
,
()
=>
{
const
state
=
createState
();
const
state
=
createState
();
...
...
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