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
d24e47a9
Commit
d24e47a9
authored
Jun 28, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueDiscussionsRefactor: Do changes after data format change and fix dummy data.
parent
44ccf2b1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
34 deletions
+43
-34
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+18
-20
app/assets/javascripts/notes/components/issue_discussion.vue
app/assets/javascripts/notes/components/issue_discussion.vue
+7
-7
app/assets/javascripts/notes/components/issue_note.vue
app/assets/javascripts/notes/components/issue_note.vue
+2
-2
app/assets/javascripts/notes/components/issue_note_awards_list.vue
...s/javascripts/notes/components/issue_note_awards_list.vue
+2
-2
app/assets/javascripts/notes/stores/issue_notes_store.js
app/assets/javascripts/notes/stores/issue_notes_store.js
+14
-3
No files found.
app/assets/javascripts/notes/components/issue_comment_form.vue
View file @
d24e47a9
...
@@ -7,23 +7,17 @@ import MarkdownField from '../../vue_shared/components/markdown/field.vue';
...
@@ -7,23 +7,17 @@ import MarkdownField from '../../vue_shared/components/markdown/field.vue';
export
default
{
export
default
{
props
:
{},
props
:
{},
data
()
{
data
()
{
const
{
create_note_path
,
state
}
=
window
.
gl
.
issueData
;
const
{
currentUserData
}
=
window
.
gl
;
return
{
return
{
note
:
''
,
note
:
''
,
markdownPreviewUrl
:
''
,
markdownPreviewUrl
:
''
,
markdownDocsUrl
:
''
,
markdownDocsUrl
:
''
,
// FIXME: @fatihacet - Fix the mock data below.
noteType
:
'
comment
'
,
noteType
:
'
comment
'
,
issueState
:
'
open
'
,
issueState
:
state
,
endpoint
:
'
/gitlab-org/gitlab-ce/notes
'
,
endpoint
:
create_note_path
,
author
:
{
author
:
currentUserData
,
avatar_url
:
'
http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon
'
,
id
:
1
,
name
:
'
Administrator
'
,
path
:
'
/root
'
,
state
:
'
active
'
,
username
:
'
root
'
,
},
};
};
},
},
components
:
{
components
:
{
...
@@ -47,13 +41,12 @@ export default {
...
@@ -47,13 +41,12 @@ export default {
methods
:
{
methods
:
{
handleSave
()
{
handleSave
()
{
const
data
=
{
const
data
=
{
endpoint
:
`
${
this
.
endpoint
}
?full_data=1`
,
endpoint
:
this
.
endpoint
,
noteData
:
{
noteData
:
{
target_type
:
'
issue
'
,
full_data
:
true
,
target_id
:
'
89
'
,
note
:
{
note
:
{
noteable_type
:
'
Issue
'
,
noteable_type
:
'
Issue
'
,
noteable_id
:
89
,
noteable_id
:
window
.
gl
.
issueData
.
id
,
note
:
this
.
note
,
note
:
this
.
note
,
}
}
},
},
...
@@ -64,12 +57,14 @@ export default {
...
@@ -64,12 +57,14 @@ export default {
}
}
this
.
$store
.
dispatch
(
'
createNewNote
'
,
data
)
this
.
$store
.
dispatch
(
'
createNewNote
'
,
data
)
.
then
(()
=>
{
.
then
((
res
)
=>
{
if
(
res
.
errors
)
{
return
this
.
handleError
();
}
this
.
discard
();
this
.
discard
();
})
})
.
catch
(()
=>
{
.
catch
(
this
.
handleError
);
new
Flash
(
'
Something went wrong while adding your comment. Please try again.
'
);
// eslint-disable-line
});
},
},
discard
()
{
discard
()
{
this
.
note
=
''
;
this
.
note
=
''
;
...
@@ -78,6 +73,9 @@ export default {
...
@@ -78,6 +73,9 @@ export default {
setNoteType
(
type
)
{
setNoteType
(
type
)
{
this
.
noteType
=
type
;
this
.
noteType
=
type
;
},
},
handleError
()
{
new
Flash
(
'
Something went wrong while adding your comment. Please try again.
'
);
// eslint-disable-line
},
},
},
mounted
()
{
mounted
()
{
const
issuableDataEl
=
document
.
getElementById
(
'
js-issuable-app-initial-data
'
);
const
issuableDataEl
=
document
.
getElementById
(
'
js-issuable-app-initial-data
'
);
...
...
app/assets/javascripts/notes/components/issue_discussion.vue
View file @
d24e47a9
...
@@ -19,7 +19,7 @@ export default {
...
@@ -19,7 +19,7 @@ export default {
return
{
return
{
registerLink
:
'
#
'
,
registerLink
:
'
#
'
,
signInLink
:
'
#
'
,
signInLink
:
'
#
'
,
newNotePath
:
''
,
newNotePath
:
window
.
gl
.
issueData
.
create_note_path
,
isReplying
:
false
,
isReplying
:
false
,
};
};
},
},
...
@@ -30,6 +30,9 @@ export default {
...
@@ -30,6 +30,9 @@ export default {
author
()
{
author
()
{
return
this
.
discussion
.
author
;
return
this
.
discussion
.
author
;
},
},
canReply
()
{
return
window
.
gl
.
issueData
.
current_user
.
can_create_note
;
},
},
},
components
:
{
components
:
{
IssueNote
,
IssueNote
,
...
@@ -48,10 +51,6 @@ export default {
...
@@ -48,10 +51,6 @@ export default {
this
.
registerLink
=
registerLink
.
getAttribute
(
'
href
'
);
this
.
registerLink
=
registerLink
.
getAttribute
(
'
href
'
);
this
.
signInLink
=
signInLink
.
getAttribute
(
'
href
'
);
this
.
signInLink
=
signInLink
.
getAttribute
(
'
href
'
);
}
}
// TODO: @fatihacet - Reimplement this when we have data for it.
// const newNotePath = document.querySelector('.js-main-target-form').getAttribute('action');
// this.newNotePath = `${newNotePath}?full_data=1`;
},
},
methods
:
{
methods
:
{
toggleDiscussion
()
{
toggleDiscussion
()
{
...
@@ -73,6 +72,7 @@ export default {
...
@@ -73,6 +72,7 @@ export default {
target_type
:
'
issue
'
,
target_type
:
'
issue
'
,
target_id
:
this
.
discussion
.
noteable_id
,
target_id
:
this
.
discussion
.
noteable_id
,
note
:
{
note
},
note
:
{
note
},
full_data
:
true
,
},
},
};
};
...
@@ -130,7 +130,7 @@ export default {
...
@@ -130,7 +130,7 @@ export default {
<div
class=
"flash-container"
></div>
<div
class=
"flash-container"
></div>
<div
class=
"discussion-reply-holder"
>
<div
class=
"discussion-reply-holder"
>
<button
<button
v-if=
"
note.can_r
eply && !isReplying"
v-if=
"
canR
eply && !isReplying"
@
click=
"showReplyForm"
@
click=
"showReplyForm"
type=
"button"
type=
"button"
class=
"btn btn-text-field"
class=
"btn btn-text-field"
...
@@ -141,7 +141,7 @@ export default {
...
@@ -141,7 +141,7 @@ export default {
:updateHandler=
"saveReply"
:updateHandler=
"saveReply"
:cancelHandler=
"cancelReplyForm"
/>
:cancelHandler=
"cancelReplyForm"
/>
<div
<div
v-if=
"!
note.can_r
eply"
v-if=
"!
canR
eply"
class=
"disabled-comment text-center"
>
class=
"disabled-comment text-center"
>
Please
Please
<a
:href=
"registerLink"
>
register
</a>
<a
:href=
"registerLink"
>
register
</a>
...
...
app/assets/javascripts/notes/components/issue_note.vue
View file @
d24e47a9
...
@@ -104,8 +104,8 @@ export default {
...
@@ -104,8 +104,8 @@ export default {
<issue-note-actions
<issue-note-actions
:accessLevel=
"note.human_access"
:accessLevel=
"note.human_access"
:canAward=
"note.emoji_awardable"
:canAward=
"note.emoji_awardable"
:canEdit=
"note.can_edit"
:canEdit=
"note.c
urrent_user.c
an_edit"
:canDelete=
"note.can_edit"
:canDelete=
"note.c
urrent_user.c
an_edit"
:reportAbusePath=
"note.report_abuse_path"
:reportAbusePath=
"note.report_abuse_path"
:editHandler=
"editHandler"
:editHandler=
"editHandler"
:deleteHandler=
"deleteHandler"
/>
:deleteHandler=
"deleteHandler"
/>
...
...
app/assets/javascripts/notes/components/issue_note_awards_list.vue
View file @
d24e47a9
<
script
>
<
script
>
import
{
glEmojiTag
}
from
'
~/behaviors/gl_
emoji
'
;
import
*
as
Emoji
from
'
../../
emoji
'
;
import
emojiSmiling
from
'
icons/_emoji_slightly_smiling_face.svg
'
;
import
emojiSmiling
from
'
icons/_emoji_slightly_smiling_face.svg
'
;
import
emojiSmile
from
'
icons/_emoji_smile.svg
'
;
import
emojiSmile
from
'
icons/_emoji_smile.svg
'
;
import
emojiSmiley
from
'
icons/_emoji_smiley.svg
'
;
import
emojiSmiley
from
'
icons/_emoji_smiley.svg
'
;
...
@@ -66,7 +66,7 @@ export default {
...
@@ -66,7 +66,7 @@ export default {
},
},
methods
:
{
methods
:
{
getAwardHTML
(
name
)
{
getAwardHTML
(
name
)
{
return
glEmojiTag
(
name
);
return
Emoji
.
glEmojiTag
(
name
);
},
},
getAwardClassBindings
(
awardList
,
awardName
)
{
getAwardClassBindings
(
awardList
,
awardName
)
{
return
{
return
{
...
...
app/assets/javascripts/notes/stores/issue_notes_store.js
View file @
d24e47a9
...
@@ -53,8 +53,16 @@ const mutations = {
...
@@ -53,8 +53,16 @@ const mutations = {
}
}
},
},
addNewNote
(
storeState
,
note
)
{
addNewNote
(
storeState
,
note
)
{
// TODO: @fatihacet - When we get the correct data from server update the store
const
{
discussion_id
,
type
}
=
note
;
// storeState.notes.push(note);
const
noteData
=
{
expanded
:
true
,
id
:
discussion_id
,
individual_note
:
!
(
type
===
'
DiscussionNote
'
),
notes
:
[
note
],
reply_id
:
discussion_id
,
};
storeState
.
notes
.
push
(
noteData
);
},
},
};
};
...
@@ -100,7 +108,10 @@ const actions = {
...
@@ -100,7 +108,10 @@ const actions = {
.
createNewNote
(
endpoint
,
noteData
)
.
createNewNote
(
endpoint
,
noteData
)
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
res
.
json
())
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
context
.
commit
(
'
addNewNote
'
,
res
);
if
(
!
res
.
errors
)
{
context
.
commit
(
'
addNewNote
'
,
res
);
}
return
res
;
});
});
},
},
};
};
...
...
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