Commit 7377634e by wajeeha-khalid Committed by GitHub

Merge pull request #13027 from edx/jia/MA-2139

MA-2139: Mark thread as read for learner on thread/comment creation 
parents 8b8339b1 be72ab76
...@@ -702,6 +702,7 @@ class ThreadViewSetCreateTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase): ...@@ -702,6 +702,7 @@ class ThreadViewSetCreateTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase):
"username": self.user.username, "username": self.user.username,
"created_at": "2015-05-19T00:00:00Z", "created_at": "2015-05-19T00:00:00Z",
"updated_at": "2015-05-19T00:00:00Z", "updated_at": "2015-05-19T00:00:00Z",
"read": True,
}) })
self.register_post_thread_response(cs_thread) self.register_post_thread_response(cs_thread)
request_data = { request_data = {
...@@ -732,12 +733,12 @@ class ThreadViewSetCreateTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase): ...@@ -732,12 +733,12 @@ class ThreadViewSetCreateTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase):
"voted": False, "voted": False,
"vote_count": 0, "vote_count": 0,
"comment_count": 1, "comment_count": 1,
"unread_comment_count": 1, "unread_comment_count": 0,
"comment_list_url": "http://testserver/api/discussion/v1/comments/?thread_id=test_thread", "comment_list_url": "http://testserver/api/discussion/v1/comments/?thread_id=test_thread",
"endorsed_comment_list_url": None, "endorsed_comment_list_url": None,
"non_endorsed_comment_list_url": None, "non_endorsed_comment_list_url": None,
"editable_fields": ["abuse_flagged", "following", "raw_body", "read", "title", "topic_id", "type", "voted"], "editable_fields": ["abuse_flagged", "following", "raw_body", "read", "title", "topic_id", "type", "voted"],
"read": False, "read": True,
"has_endorsed": False, "has_endorsed": False,
"response_count": 0, "response_count": 0,
} }
...@@ -886,7 +887,7 @@ class ThreadViewSetPartialUpdateTest(DiscussionAPIViewTestMixin, ModuleStoreTest ...@@ -886,7 +887,7 @@ class ThreadViewSetPartialUpdateTest(DiscussionAPIViewTestMixin, ModuleStoreTest
@ddt.unpack @ddt.unpack
def test_closed_thread(self, field, value): def test_closed_thread(self, field, value):
self.register_get_user_response(self.user) self.register_get_user_response(self.user)
self.register_thread({"closed": True}) self.register_thread({"closed": True, "read": True})
self.register_flag_response("thread", "test_thread") self.register_flag_response("thread", "test_thread")
request_data = {field: value} request_data = {field: value}
response = self.request_patch(request_data) response = self.request_patch(request_data)
...@@ -895,11 +896,12 @@ class ThreadViewSetPartialUpdateTest(DiscussionAPIViewTestMixin, ModuleStoreTest ...@@ -895,11 +896,12 @@ class ThreadViewSetPartialUpdateTest(DiscussionAPIViewTestMixin, ModuleStoreTest
self.assertEqual( self.assertEqual(
response_data, response_data,
self.expected_response_data({ self.expected_response_data({
"read": True,
"closed": True, "closed": True,
"abuse_flagged": value, "abuse_flagged": value,
"editable_fields": ["abuse_flagged", "read"], "editable_fields": ["abuse_flagged", "read"],
"comment_count": 1, "comment_count": 1,
"unread_comment_count": 1, "unread_comment_count": 0,
}) })
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment