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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
a2cba2b1
Commit
a2cba2b1
authored
Jul 07, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotesRefactor: Use notesById getter.
parent
993936fb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
app/assets/javascripts/notes/stores/issue_notes_store.js
app/assets/javascripts/notes/stores/issue_notes_store.js
+12
-8
No files found.
app/assets/javascripts/notes/stores/issue_notes_store.js
View file @
a2cba2b1
...
@@ -16,6 +16,17 @@ const getters = {
...
@@ -16,6 +16,17 @@ const getters = {
targetNoteHash
(
storeState
)
{
targetNoteHash
(
storeState
)
{
return
storeState
.
targetNoteHash
;
return
storeState
.
targetNoteHash
;
},
},
notesById
(
storeState
)
{
const
notesById
=
{};
storeState
.
notes
.
forEach
((
note
)
=>
{
note
.
notes
.
forEach
((
n
)
=>
{
notesById
[
n
.
id
]
=
n
;
});
});
return
notesById
;
},
};
};
const
mutations
=
{
const
mutations
=
{
...
@@ -131,14 +142,7 @@ const actions = {
...
@@ -131,14 +142,7 @@ const actions = {
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
res
.
json
())
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
.
notes
.
length
)
{
if
(
res
.
notes
.
length
)
{
const
notesById
=
{};
const
{
notesById
}
=
context
.
getters
;
// Simple lookup object to check whether we have a discussion id already in our store
context
.
state
.
notes
.
forEach
((
note
)
=>
{
note
.
notes
.
forEach
((
n
)
=>
{
notesById
[
n
.
id
]
=
true
;
});
});
res
.
notes
.
forEach
((
note
)
=>
{
res
.
notes
.
forEach
((
note
)
=>
{
if
(
notesById
[
note
.
id
])
{
if
(
notesById
[
note
.
id
])
{
...
...
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