Skip to content

Commit 7e80061

Browse files
Taimoor  Ahmedormsbee
authored andcommitted
fix: Discussion xblock error when loading for the first time
This PR fixes the user not being created when accessing the discussion xblock as the course_key was missing in some of the api calls and that lead to the forum backend not being fetched correctly.
1 parent 1e39adf commit 7e80061

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • openedx/core/djangoapps/django_comment_common/comment_client

openedx/core/djangoapps/django_comment_common/comment_client/user.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def _retrieve(self, *args, **kwargs):
193193
if course_id:
194194
course_id = str(course_id)
195195
retrieve_params['course_id'] = course_id
196-
course_key = utils.get_course_key(course_id)
196+
course_key = utils.get_course_key(course_id) or utils.get_course_key(kwargs.get("course_key"))
197197

198198
if is_forum_v2_enabled(course_key):
199199
group_ids = [retrieve_params['group_id']] if 'group_id' in retrieve_params else []
@@ -207,6 +207,7 @@ def _retrieve(self, *args, **kwargs):
207207
try:
208208
response = forum_api.get_user(**params)
209209
except ForumV2RequestError as e:
210+
course_id = str(course_key)
210211
self.save({"course_id": course_id})
211212
response = forum_api.get_user(**params)
212213
else:

0 commit comments

Comments
 (0)