Skip to content

Commit

Permalink
fix: update CourseOverviewTab while changing discussions settings (op…
Browse files Browse the repository at this point in the history
  • Loading branch information
AhtishamShahid committed Oct 27, 2023
1 parent e5b7e3e commit 3c50f3e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions openedx/core/djangoapps/discussions/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from openedx.core.lib.courses import get_course_by_id
from .models import DiscussionsConfiguration, Provider
from .utils import available_division_schemes, get_divided_discussions
from ..content.course_overviews.models import CourseOverviewTab


class LtiSerializer(serializers.ModelSerializer):
Expand Down Expand Up @@ -259,6 +260,12 @@ def update(self, instance: DiscussionsConfiguration, validated_data: dict) -> Di
# have already been set
instance = self._update_lti(instance, validated_data)
instance.save()
# find the discussion tab and update its visibility as per discussions configurations
# It can go out of sync due to unknown reasons
CourseOverviewTab.objects.filter(
course_overview_id=instance.context_key,
type='discussion'
).update(is_hidden=not instance.enabled)
update_discussions_settings_from_course_task.delay(str(instance.context_key))
return instance

Expand Down

0 comments on commit 3c50f3e

Please sign in to comment.