* Python code cleanup by the cleanup-python-code Jenkins job. This pull request was generated by the cleanup-python-code Jenkins job, which ran ``` cd lms/djangoapps/dashboard; find . -type f -name '*.py' | while read fname; do sed -i 's/ # lint-amnesty, pylint: disable=super-with-arguments//; s/ # lint-amnesty, pylint: disable=import-error, wrong-import-order//; s/ # lint-amnesty, pylint: disable=wrong-import-order//' "$fname"; done; find . -type f -name '*.py' | while read fname; do pyupgrade --exit-zero-even-if-changed --py3-plus --py36-plus --py38-plus "$fname"; done; isort --recursive . ``` The following packages were installed: `pyupgrade,isort` * feedback done Co-authored-by: Zulqarnain <muhammad.zulqarnain@arbisoft.com>
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
"""
|
|
Views handling read (GET) requests for the Discussion tab and inline discussions.
|
|
"""
|
|
|
|
|
|
from django.conf import settings
|
|
from django.utils.translation import ugettext_noop
|
|
|
|
import lms.djangoapps.discussion.django_comment_client.utils as utils
|
|
from lms.djangoapps.courseware.tabs import EnrolledTab
|
|
from openedx.features.lti_course_tab.tab import DiscussionLtiCourseTab
|
|
from xmodule.tabs import TabFragmentViewMixin
|
|
|
|
|
|
class DiscussionTab(TabFragmentViewMixin, EnrolledTab):
|
|
"""
|
|
A tab for the cs_comments_service forums.
|
|
"""
|
|
|
|
type = 'discussion'
|
|
title = ugettext_noop('Discussion')
|
|
priority = None
|
|
view_name = 'forum_form_discussion'
|
|
fragment_view_name = 'lms.djangoapps.discussion.views.DiscussionBoardFragmentView'
|
|
is_hideable = settings.FEATURES.get('ALLOW_HIDING_DISCUSSION_TAB', False)
|
|
is_default = False
|
|
body_class = 'discussion'
|
|
online_help_token = 'discussions'
|
|
|
|
@classmethod
|
|
def is_enabled(cls, course, user=None):
|
|
if not super().is_enabled(course, user):
|
|
return False
|
|
# Disable the regular discussion tab if LTI-based external Discussion forum is enabled
|
|
if DiscussionLtiCourseTab.is_enabled(course, user):
|
|
return False
|
|
return utils.is_discussion_enabled(course.id)
|