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
Léo-Paul Géneau
gitlab-ce
Commits
3343bf30
Commit
3343bf30
authored
Jul 28, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ci skip] Remove DOM querying for paths, save them in the store
parent
d34c620f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
42 deletions
+45
-42
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+13
-23
app/assets/javascripts/notes/components/issue_note_signed_out_widget.vue
...scripts/notes/components/issue_note_signed_out_widget.vue
+5
-9
app/assets/javascripts/notes/components/issue_notes_app.vue
app/assets/javascripts/notes/components/issue_notes_app.vue
+12
-7
app/assets/javascripts/notes/index.js
app/assets/javascripts/notes/index.js
+4
-0
app/assets/javascripts/notes/stores/getters.js
app/assets/javascripts/notes/stores/getters.js
+7
-1
app/assets/javascripts/notes/stores/index.js
app/assets/javascripts/notes/stores/index.js
+1
-0
app/assets/javascripts/notes/stores/mutations.js
app/assets/javascripts/notes/stores/mutations.js
+0
-1
app/views/projects/issues/_discussion.html.haml
app/views/projects/issues/_discussion.html.haml
+3
-1
No files found.
app/assets/javascripts/notes/components/issue_comment_form.vue
View file @
3343bf30
<
script
>
/* global Flash */
/* global Flash */
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
}
from
'
vuex
'
;
import
userAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
import
markdownField
from
'
../../vue_shared/components/markdown/field.vue
'
;
import
issueNoteSignedOutWidget
from
'
./issue_note_signed_out_widget.vue
'
;
...
...
@@ -10,18 +10,18 @@
export
default
{
data
()
{
const
{
create_note_path
,
state
}
=
window
.
gl
.
issueData
;
const
{
currentUserData
}
=
window
.
gl
;
const
{
getUserData
,
getIssueData
}
=
this
.
$store
.
getters
;
return
{
note
:
''
,
markdownDocsUrl
:
''
,
quickActionsDocsUrl
:
null
,
markdownPreviewUrl
:
g
l
.
i
ssueData
.
preview_note_path
,
markdownDocsUrl
:
getIssueData
.
markdownDocs
,
quickActionsDocsUrl
:
getIssueData
.
quickActionsDocs
,
markdownPreviewUrl
:
g
etI
ssueData
.
preview_note_path
,
noteType
:
constants
.
COMMENT
,
issueState
:
state
,
endpoint
:
create_note_path
,
author
:
currentUserData
,
issueState
:
getIssueData
.
state
,
endpoint
:
getIssueData
.
create_note_path
,
author
:
getUserData
,
canUpdateIssue
:
getIssueData
.
current_user
.
can_update
,
};
},
components
:
{
...
...
@@ -30,10 +30,6 @@
issueNoteSignedOutWidget
,
},
computed
:
{
...
mapGetters
([
'
getNotesDataByProp
'
,
'
getIssueDataByProp
'
,
]),
isLoggedIn
()
{
return
window
.
gon
.
current_user_id
;
},
...
...
@@ -60,9 +56,6 @@
'
js-note-target-reopen
'
:
!
this
.
isIssueOpen
,
};
},
canUpdateIssue
()
{
return
this
.
getIssueDataByProp
(
current_user
).
can_update
;
},
},
methods
:
{
...
mapActions
([
...
...
@@ -106,12 +99,12 @@
if
(
withIssueAction
)
{
if
(
this
.
isIssueOpen
)
{
gl
.
issueData
.
state
=
constants
.
CLOSED
;
this
.
issueState
=
constants
.
CLOSED
;
}
else
{
gl
.
issueData
.
state
=
constants
.
REOPENED
;
this
.
issueState
=
constants
.
REOPENED
;
}
gl
.
issueData
.
state
=
this
.
issueState
;
this
.
isIssueOpen
=
!
this
.
isIssueOpen
;
// This is out of scope for the Notes Vue component.
...
...
@@ -139,7 +132,7 @@
editMyLastNote
()
{
if
(
this
.
note
===
''
)
{
const
myLastNoteId
=
$
(
'
.js-my-note
'
).
last
().
attr
(
'
id
'
);
debugger
;
if
(
myLastNoteId
)
{
eventHub
.
$emit
(
'
enterEditMode
'
,
{
noteId
:
parseInt
(
myLastNoteId
.
replace
(
'
note_
'
,
''
),
10
),
...
...
@@ -149,9 +142,6 @@
},
},
mounted
()
{
this
.
markdownDocsUrl
=
this
.
getIssueDataByProp
(
markdownDocs
);
this
.
quickActionsDocsUrl
=
this
.
getIssueDataByProp
(
quickActionsDocs
);
eventHub
.
$on
(
'
issueStateChanged
'
,
(
isClosed
)
=>
{
this
.
issueState
=
isClosed
?
constants
.
CLOSED
:
constants
.
REOPENED
;
});
...
...
app/assets/javascripts/notes/components/issue_note_signed_out_widget.vue
View file @
3343bf30
<
script
>
export
default
{
data
()
{
const
{
newSessionPath
,
registerPath
}
=
this
.
$store
.
getters
.
notesData
;
return
{
signInLink
:
'
#
'
,
signInLink
:
newSessionPath
,
registerLink
:
registerPath
,
};
},
mounted
()
{
const
wrapper
=
document
.
querySelector
(
'
.js-notes-wrapper
'
);
if
(
wrapper
)
{
this
.
signInLink
=
wrapper
.
dataset
.
newSessionPath
;
}
},
};
</
script
>
...
...
@@ -20,7 +16,7 @@
Please
<a
:href=
"signInLink"
>
register
</a>
or
<a
:href=
"
signIn
Link"
>
sign in
</a>
<a
:href=
"
register
Link"
>
sign in
</a>
to reply
</div>
</
template
>
app/assets/javascripts/notes/components/issue_notes_app.vue
View file @
3343bf30
...
...
@@ -25,6 +25,10 @@
type
:
Object
,
required
:
true
,
},
userData
:
{
type
:
Object
,
required
:
true
,
},
},
store
,
data
()
{
...
...
@@ -43,21 +47,21 @@
},
computed
:
{
...
mapGetters
([
'
notes
'
,
'
notesById
'
,
'
getNotesData
'
,
'
getNotesDataByProp
'
,
'
setLastFetchedAt
'
,
'
setTargetNoteHash
'
,
]),
},
methods
:
{
...
mapGetters
([
'
getNotesDataByProp
'
,
]),
...
mapActions
({
actionFetchNotes
:
'
fetchNotes
'
,
poll
:
'
poll
'
,
toggleAward
:
'
toggleAward
'
,
scrollToNoteIfNeeded
:
'
scrollToNoteIfNeeded
'
,
setNotesData
:
'
setNotesData
'
setNotesData
:
'
setNotesData
'
,
setIssueData
:
'
setIssueData
'
,
setUserData
:
'
setUserData
'
,
}),
getComponentName
(
note
)
{
if
(
note
.
isPlaceholderNote
)
{
...
...
@@ -75,7 +79,7 @@
return
note
.
individual_note
?
note
.
notes
[
0
]
:
note
;
},
fetchNotes
()
{
this
.
actionFetchNotes
(
his
.
getNotesDataByProp
(
'
discussionsPath
'
))
this
.
actionFetchNotes
(
t
his
.
getNotesDataByProp
(
'
discussionsPath
'
))
.
then
(()
=>
{
this
.
isLoading
=
false
;
...
...
@@ -126,6 +130,7 @@
created
()
{
this
.
setNotesData
(
this
.
notesData
);
this
.
setIssueData
(
this
.
issueData
);
this
.
setUserData
(
this
.
userData
)
},
mounted
()
{
this
.
fetchNotes
();
...
...
app/assets/javascripts/notes/index.js
View file @
3343bf30
...
...
@@ -15,6 +15,9 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
notesData
:
{
lastFetchedAt
:
notesDataset
.
lastFetchedAt
,
discussionsPath
:
notesDataset
.
discussionsPath
,
newSessionPath
:
notesDataset
.
newSessionPath
,
registerPath
:
notesDataset
.
registerPath
,
notesPath
:
notesDataset
.
notesPath
,
},
};
},
...
...
@@ -26,6 +29,7 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
props
:
{
issueData
:
this
.
issueData
,
notesData
:
this
.
notesData
,
userData
:
this
.
currentUserData
,
},
});
},
...
...
app/assets/javascripts/notes/stores/getters.js
View file @
3343bf30
export
const
notes
=
state
=>
state
.
notes
;
export
const
targetNoteHash
=
state
=>
state
.
targetNoteHash
;
export
const
getNotesData
=
state
=>
state
.
notesData
;
export
const
getNotesDataByProp
=
state
=>
prop
=>
state
.
notesData
[
prop
];
export
const
getIssueDataByProp
=
state
=>
prop
=>
state
.
notesData
[
prop
];
export
const
getIssueData
=
state
=>
state
.
issueData
;
export
const
getIssueDataByProp
=
state
=>
prop
=>
state
.
issueData
[
prop
];
export
const
getUserData
=
state
=>
state
.
userData
;
export
const
getUserDataByProp
=
state
=>
prop
=>
state
.
notesData
[
prop
];
export
const
notesById
=
(
state
)
=>
{
...
...
app/assets/javascripts/notes/stores/index.js
View file @
3343bf30
...
...
@@ -16,6 +16,7 @@ export default new Vuex.Store({
notesData
:
{},
userData
:
{},
issueData
:
{},
paths
:
{},
},
actions
,
getters
,
...
...
app/assets/javascripts/notes/stores/mutations.js
View file @
3343bf30
...
...
@@ -69,7 +69,6 @@ export default {
[
types
.
SET_USER_DATA
](
state
,
data
)
{
state
.
userData
=
data
;
},
[
types
.
SET_INITAL_NOTES
](
state
,
notes
)
{
state
.
notes
=
notes
;
},
...
...
app/views/projects/issues/_discussion.html.haml
View file @
3343bf30
...
...
@@ -5,8 +5,10 @@
%section
#js-vue-notes
{
data:
{
discussions_path:
discussions_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
@issue
,
format: :json
),
register_path:
"#{new_session_path(:user, redirect_to_referer: 'yes')}#register-pane"
,
new_session_path:
new_session_path
(
:user
,
redirect_to_referer:
'yes'
),
notes_path:
'
#
{
notes_url
}?
full_data
=
1
'
,
last_fetched_at:
Time
.
now
.
to_i
,
notes_path:
'
#
{
notes_url
}?
full_data
=
1
'
,
last_fetched_at:
Time
.
now
.
to_i
,
issue_data:
serialize_issuable
(
@issue
),
current_user_data:
UserSerializer
.
new
.
represent
(
current_user
).
to_json
}}
-
content_for
:page_specific_javascripts
do
...
...
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