Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adequate course key type in forum v2 #36022

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions openedx/core/djangoapps/discussions/config/waffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
ENABLE_FORUM_V2 = CourseWaffleFlag(f"{WAFFLE_FLAG_NAMESPACE}.enable_forum_v2", __name__)


def is_forum_v2_enabled(course_id):
def is_forum_v2_enabled(course_key):
"""
Returns whether forum V2 is enabled on the course. This is a 2-step check:

Expand All @@ -65,7 +65,7 @@ def is_forum_v2_enabled(course_id):
"""
if is_forum_v2_disabled_globally():
return False
return ENABLE_FORUM_V2.is_enabled(course_id)
return ENABLE_FORUM_V2.is_enabled(course_key)


def is_forum_v2_disabled_globally() -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def retrieve(self, *args, **kwargs):
def _retrieve(self, *args, **kwargs):
course_id = self.attributes.get("course_id") or kwargs.get("course_id")
if course_id:
use_forumv2 = is_forum_v2_enabled(course_id)
course_key = get_course_key(course_id)
use_forumv2 = is_forum_v2_enabled(course_key)
else:
use_forumv2, course_id = is_forum_v2_enabled_for_comment(self.id)
response = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ def _retrieve(self, *args, **kwargs):
request_params = utils.strip_none(request_params)
course_id = kwargs.get("course_id")
if course_id:
use_forumv2 = is_forum_v2_enabled(course_id)
course_key = utils.get_course_key(course_id)
use_forumv2 = is_forum_v2_enabled(course_key)
else:
use_forumv2, course_id = is_forum_v2_enabled_for_thread(self.id)
if use_forumv2:
Expand Down
Loading