From 58d0839affdadaef6b6b161ec20504ccc6a64ed7 Mon Sep 17 00:00:00 2001 From: ayesha waris <73840786+ayesha-waris@users.noreply.github.com> Date: Wed, 27 Aug 2025 15:24:22 +0500 Subject: [PATCH] fix: added thread id in comment/response reported event (#37276) Co-authored-by: Ayesha Waris --- lms/djangoapps/discussion/django_comment_client/base/views.py | 2 ++ lms/djangoapps/discussion/rest_api/tests/test_api_v2.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lms/djangoapps/discussion/django_comment_client/base/views.py b/lms/djangoapps/discussion/django_comment_client/base/views.py index b81a8fd144..95d5a02010 100644 --- a/lms/djangoapps/discussion/django_comment_client/base/views.py +++ b/lms/djangoapps/discussion/django_comment_client/base/views.py @@ -378,6 +378,7 @@ def track_comment_reported_event(request, course, comment): obj_type = 'comment' if comment.get('parent_id') else 'response' event_name = _EVENT_NAME_TEMPLATE.format(obj_type=obj_type, action_name='reported') event_data = { + 'discussion': {'id': comment.thread_id}, 'body': comment.body[:TRACKING_MAX_FORUM_BODY], 'truncated': len(comment.body) > TRACKING_MAX_FORUM_BODY, 'commentable_id': comment.get('commentable_id', ''), @@ -416,6 +417,7 @@ def track_comment_unreported_event(request, course, comment): obj_type = 'comment' if comment.get('parent_id') else 'response' event_name = _EVENT_NAME_TEMPLATE.format(obj_type=obj_type, action_name='unreported') event_data = { + 'discussion': {'id': comment.thread_id}, 'body': comment.body[:TRACKING_MAX_FORUM_BODY], 'truncated': len(comment.body) > TRACKING_MAX_FORUM_BODY, 'commentable_id': comment.get('commentable_id', ''), diff --git a/lms/djangoapps/discussion/rest_api/tests/test_api_v2.py b/lms/djangoapps/discussion/rest_api/tests/test_api_v2.py index 62284b904c..6543453858 100644 --- a/lms/djangoapps/discussion/rest_api/tests/test_api_v2.py +++ b/lms/djangoapps/discussion/rest_api/tests/test_api_v2.py @@ -896,6 +896,7 @@ class UpdateCommentTest( else "edx.forum.response.unreported" ) expected_event_data = { + "discussion": {'id': 'test_thread'}, "body": "Original body", "id": "test_comment", "content_type": "Response", @@ -958,6 +959,7 @@ class UpdateCommentTest( "body": "Original body", "id": "test_comment", "content_type": "Response", + "discussion": {'id': 'test_thread'}, "commentable_id": "dummy", "truncated": False, "url": "",