Skip to content

Commit

Permalink
Revert "Sync opencraft-release/palm.1 with Upstream 20230807-1691366566"
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuf-musleh authored Aug 14, 2023
1 parent 8c1ed2c commit 59382ea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 27 deletions.
7 changes: 0 additions & 7 deletions lms/djangoapps/courseware/tests/test_discussion_xblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

from unittest import mock
import ddt
from django.conf import settings
from django.test.utils import override_settings
from django.urls import reverse
from opaque_keys.edx.keys import CourseKey
from web_fragments.fragment import Fragment
Expand Down Expand Up @@ -169,7 +167,6 @@ def test_studio_view(self):
}
)

@override_settings(FEATURES=dict(settings.FEATURES, ENABLE_DISCUSSION_SERVICE='True'))
@ddt.data(
(False, False, False),
(True, False, False),
Expand Down Expand Up @@ -234,7 +231,6 @@ def test_studio_view(self):
fragment = self.block.author_view({})
assert f'data-discussion-id="{self.discussion_id}"' in fragment.content

@override_settings(FEATURES=dict(settings.FEATURES, ENABLE_DISCUSSION_SERVICE='True'))
@ddt.data(
(True, False, False),
(False, True, False),
Expand Down Expand Up @@ -294,7 +290,6 @@ def get_root(self, block):
block = block.get_parent()
return block

@override_settings(FEATURES=dict(settings.FEATURES, ENABLE_DISCUSSION_SERVICE='True'))
def test_html_with_user(self):
"""
Test rendered DiscussionXBlock permissions.
Expand All @@ -313,7 +308,6 @@ def test_html_with_user(self):
assert 'data-user-create-comment="false"' in html
assert 'data-user-create-subcomment="false"' in html

@override_settings(FEATURES=dict(settings.FEATURES, ENABLE_DISCUSSION_SERVICE='True'))
def test_discussion_render_successfully_with_orphan_parent(self):
"""
Test that discussion xblock render successfully
Expand Down Expand Up @@ -413,7 +407,6 @@ class TestXBlockQueryLoad(SharedModuleStoreTestCase):
Test the number of queries executed when rendering the XBlock.
"""

@override_settings(FEATURES=dict(settings.FEATURES, ENABLE_DISCUSSION_SERVICE='True'))
def test_permissions_query_load(self):
"""
Tests that the permissions queries are cached when rendering numerous discussion XBlocks.
Expand Down
35 changes: 15 additions & 20 deletions xmodule/discussion_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,6 @@ def student_view(self, context=None):
"""
Renders student view for LMS.
"""
# to prevent a circular import issue
import lms.djangoapps.discussion.django_comment_client.utils as utils

fragment = Fragment()

if not self.is_visible:
Expand All @@ -192,23 +189,21 @@ def student_view(self, context=None):
),
)

if utils.is_discussion_enabled(self.course_key):
context = {
'discussion_id': self.discussion_id,
'display_name': self.display_name if self.display_name else _("Discussion"),
'user': self.django_user,
'course_id': self.course_key,
'discussion_category': self.discussion_category,
'discussion_target': self.discussion_target,
'can_create_thread': self.has_permission("create_thread"),
'can_create_comment': self.has_permission("create_comment"),
'can_create_subcomment': self.has_permission("create_sub_comment"),
'login_msg': login_msg,
}
fragment.add_content(
self.runtime.service(self, 'mako').render_template('discussion/_discussion_inline.html', context)
)

context = {
'discussion_id': self.discussion_id,
'display_name': self.display_name if self.display_name else _("Discussion"),
'user': self.django_user,
'course_id': self.course_key,
'discussion_category': self.discussion_category,
'discussion_target': self.discussion_target,
'can_create_thread': self.has_permission("create_thread"),
'can_create_comment': self.has_permission("create_comment"),
'can_create_subcomment': self.has_permission("create_sub_comment"),
'login_msg': login_msg,
}

fragment.add_content(self.runtime.service(self, 'mako').render_template('discussion/_discussion_inline.html',
context))
fragment.initialize_js('DiscussionInlineBlock')

return fragment
Expand Down

0 comments on commit 59382ea

Please sign in to comment.