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
ff6acdf1
Commit
ff6acdf1
authored
Jun 21, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotesRefactor: Implement discussion reply.
parent
905ad9cd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
2 deletions
+40
-2
app/assets/javascripts/notes/components/issue_discussion.vue
app/assets/javascripts/notes/components/issue_discussion.vue
+19
-2
app/assets/javascripts/notes/services/issue_notes_service.js
app/assets/javascripts/notes/services/issue_notes_service.js
+3
-0
app/assets/javascripts/notes/stores/issue_notes_store.js
app/assets/javascripts/notes/stores/issue_notes_store.js
+18
-0
No files found.
app/assets/javascripts/notes/components/issue_discussion.vue
View file @
ff6acdf1
...
@@ -17,6 +17,7 @@ export default {
...
@@ -17,6 +17,7 @@ export default {
return
{
return
{
registerLink
:
'
#
'
,
registerLink
:
'
#
'
,
signInLink
:
'
#
'
,
signInLink
:
'
#
'
,
newNotePath
:
''
,
isReplying
:
false
,
isReplying
:
false
,
};
};
},
},
...
@@ -45,6 +46,9 @@ export default {
...
@@ -45,6 +46,9 @@ export default {
this
.
registerLink
=
registerLink
.
getAttribute
(
'
href
'
);
this
.
registerLink
=
registerLink
.
getAttribute
(
'
href
'
);
this
.
signInLink
=
signInLink
.
getAttribute
(
'
href
'
);
this
.
signInLink
=
signInLink
.
getAttribute
(
'
href
'
);
}
}
const
newNotePath
=
document
.
querySelector
(
'
.js-main-target-form
'
).
getAttribute
(
'
action
'
);
this
.
newNotePath
=
`
${
newNotePath
}
?full_data=1`
;
},
},
methods
:
{
methods
:
{
toggleDiscussion
()
{
toggleDiscussion
()
{
...
@@ -58,8 +62,21 @@ export default {
...
@@ -58,8 +62,21 @@ export default {
cancelReplyForm
()
{
cancelReplyForm
()
{
this
.
isReplying
=
false
;
this
.
isReplying
=
false
;
},
},
saveReply
()
{
saveReply
({
note
})
{
const
data
=
{
endpoint
:
this
.
newNotePath
,
reply
:
{
in_reply_to_discussion_id
:
this
.
note
.
reply_id
,
target_type
:
'
issue
'
,
target_id
:
this
.
discussion
.
noteable_id
,
note
:
{
note
},
},
};
this
.
$store
.
dispatch
(
'
replyToDiscussion
'
,
data
)
.
then
(()
=>
{
this
.
isReplying
=
false
;
this
.
isReplying
=
false
;
});
},
},
},
},
};
};
...
...
app/assets/javascripts/notes/services/issue_notes_service.js
View file @
ff6acdf1
...
@@ -10,4 +10,7 @@ export default {
...
@@ -10,4 +10,7 @@ export default {
deleteNote
(
endpoint
)
{
deleteNote
(
endpoint
)
{
return
Vue
.
http
.
delete
(
endpoint
);
return
Vue
.
http
.
delete
(
endpoint
);
},
},
replyToDiscussion
(
endpoint
,
data
)
{
return
Vue
.
http
.
post
(
endpoint
,
data
,
{
emulateJSON
:
true
});
},
};
};
app/assets/javascripts/notes/stores/issue_notes_store.js
View file @
ff6acdf1
...
@@ -38,6 +38,11 @@ const mutations = {
...
@@ -38,6 +38,11 @@ const mutations = {
}
}
}
}
},
},
addNewReplyToDiscussion
(
storeState
,
note
)
{
const
noteObj
=
findNoteObjectById
(
storeState
.
notes
,
note
.
discussion_id
);
noteObj
.
notes
.
push
(
note
);
},
};
};
const
actions
=
{
const
actions
=
{
...
@@ -62,6 +67,19 @@ const actions = {
...
@@ -62,6 +67,19 @@ const actions = {
new
Flash
(
'
Something went wrong while deleting your note. Please try again.
'
);
// eslint-disable-line
new
Flash
(
'
Something went wrong while deleting your note. Please try again.
'
);
// eslint-disable-line
});
});
},
},
replyToDiscussion
(
context
,
data
)
{
const
{
endpoint
,
reply
}
=
data
;
return
service
.
replyToDiscussion
(
endpoint
,
reply
)
.
then
((
res
)
=>
res
.
json
())
.
then
((
res
)
=>
{
context
.
commit
(
'
addNewReplyToDiscussion
'
,
res
);
})
.
catch
(()
=>
{
new
Flash
(
'
Something went wrong while adding your reply. Please try again.
'
);
// eslint-disable-line
});
},
};
};
export
default
{
export
default
{
...
...
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