Commit eb11c629 by wajeeha-khalid Committed by GitHub

Merge pull request #13431 from edx/jia/MA-2663

MA-2663: Donot mark thread unread on any action but creation
parents d2f2c293 03f888b7
......@@ -916,6 +916,11 @@ def update_thread(request, thread_id, update_data):
thread_edited.send(sender=None, user=request.user, post=cc_thread)
api_thread = serializer.data
_do_extra_actions(api_thread, cc_thread, update_data.keys(), actions_form, context, request)
# always return read as True (and therefore unread_comment_count=0) as reasonably
# accurate shortcut, rather than adding additional processing.
api_thread['read'] = True
api_thread['unread_comment_count'] = 0
return api_thread
......
......@@ -2047,7 +2047,7 @@ class UpdateThreadTest(
"endorsed_comment_list_url": None,
"non_endorsed_comment_list_url": None,
"editable_fields": ["abuse_flagged", "following", "raw_body", "read", "title", "topic_id", "type", "voted"],
'read': False,
'read': True,
'has_endorsed': False,
'response_count': 0
}
......
......@@ -833,7 +833,7 @@ class ThreadViewSetPartialUpdateTest(DiscussionAPIViewTestMixin, ModuleStoreTest
def test_basic(self):
self.register_get_user_response(self.user)
self.register_thread({"created_at": "Test Created Date", "updated_at": "Test Updated Date"})
self.register_thread({"created_at": "Test Created Date", "updated_at": "Test Updated Date", "read": True})
request_data = {"raw_body": "Edited body"}
response = self.request_patch(request_data)
self.assertEqual(response.status_code, 200)
......@@ -849,6 +849,7 @@ class ThreadViewSetPartialUpdateTest(DiscussionAPIViewTestMixin, ModuleStoreTest
"created_at": "Test Created Date",
"updated_at": "Test Updated Date",
"comment_count": 1,
"read": True,
})
)
self.assertEqual(
......@@ -864,7 +865,7 @@ class ThreadViewSetPartialUpdateTest(DiscussionAPIViewTestMixin, ModuleStoreTest
"anonymous_to_peers": ["False"],
"closed": ["False"],
"pinned": ["False"],
"read": ["False"],
"read": ["True"],
}
)
......
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