Merge pull request #8524 from edx/gprice/discussion-api-parent-id-fix
Fix bug in discussion API comment update
This commit is contained in:
@@ -85,11 +85,7 @@ def _get_comment_and_context(request, comment_id):
|
||||
"""
|
||||
try:
|
||||
cc_comment = Comment(id=comment_id).retrieve()
|
||||
_, context = _get_thread_and_context(
|
||||
request,
|
||||
cc_comment["thread_id"],
|
||||
cc_comment["parent_id"]
|
||||
)
|
||||
_, context = _get_thread_and_context(request, cc_comment["thread_id"])
|
||||
return cc_comment, context
|
||||
except CommentClientRequestError:
|
||||
raise Http404
|
||||
|
||||
@@ -1689,13 +1689,14 @@ class UpdateCommentTest(CommentsServiceMockMixin, UrlResetMixin, ModuleStoreTest
|
||||
for request in httpretty.httpretty.latest_requests:
|
||||
self.assertEqual(request.method, "GET")
|
||||
|
||||
def test_basic(self):
|
||||
self.register_comment()
|
||||
@ddt.data(None, "test_parent")
|
||||
def test_basic(self, parent_id):
|
||||
self.register_comment({"parent_id": parent_id})
|
||||
actual = update_comment(self.request, "test_comment", {"raw_body": "Edited body"})
|
||||
expected = {
|
||||
"id": "test_comment",
|
||||
"thread_id": "test_thread",
|
||||
"parent_id": None, # TODO: we can't get this without retrieving from the thread :-(
|
||||
"parent_id": parent_id,
|
||||
"author": self.user.username,
|
||||
"author_label": None,
|
||||
"created_at": "2015-06-03T00:00:00Z",
|
||||
|
||||
Reference in New Issue
Block a user