Commit b3793f43 by Attiya Ishaque Committed by GitHub

Merge pull request #14819 from edx/ai/TNL-6284-blank-subcategories

TNL-6284 Empty subcategory will not render in inline discussion modules.
parents f00059f2 a7550912
......@@ -178,6 +178,22 @@ class CoursewareContextTestCase(ModuleStoreTestCase):
assertThreadCorrect(threads[0], self.discussion1, "Chapter / Discussion 1")
assertThreadCorrect(threads[1], self.discussion2, "Subsection / Discussion 2")
def test_empty_discussion_subcategory_title(self):
"""
Test that for empty subcategory inline discussion modules,
the divider " / " is not rendered on a post or inline discussion topic label.
"""
discussion = ItemFactory.create(
parent_location=self.course.location,
category="discussion",
discussion_id="discussion",
discussion_category="Chapter",
discussion_target="" # discussion-subcategory
)
thread = {"commentable_id": discussion.discussion_id}
utils.add_courseware_context([thread], self.course, self.user)
self.assertNotIn('/', thread.get("courseware_title"))
@ddt.data((ModuleStoreEnum.Type.mongo, 2), (ModuleStoreEnum.Type.split, 1))
@ddt.unpack
def test_get_accessible_discussion_xblocks(self, modulestore_type, expected_discussion_xblocks):
......
......@@ -147,7 +147,7 @@ def get_discussion_id_map_entry(xblock):
xblock.discussion_id,
{
"location": xblock.location,
"title": xblock.discussion_category.split("/")[-1].strip() + " / " + xblock.discussion_target
"title": xblock.discussion_category.split("/")[-1].strip() + (" / " + xblock.discussion_target if xblock.discussion_target else "")
}
)
......
......@@ -15,7 +15,11 @@ from openedx.core.djangolib.js_utils import js_escaped_string
data-read-only="${'false' if can_create_thread else 'true'}">
<div class="discussion-module-header">
<h3 class="hd hd-3 discussion-module-title">${_(display_name)}</h3>
<div class="inline-discussion-topic"><span class="inline-discussion-topic-title">${_("Topic:")}</span> ${discussion_category} / ${discussion_target}</div>
<div class="inline-discussion-topic"><span class="inline-discussion-topic-title">${_("Topic:")}</span> ${discussion_category}
% if discussion_target:
/ ${discussion_target}
%endif
</div>
</div>
<button class="discussion-show btn" data-discussion-id="${discussion_id}">
<span class="button-text">${_("Show Discussion")}</span>
......
......@@ -23,7 +23,9 @@ from openedx.core.djangolib.markup import HTML
data-cohorted="${str(entries[entry]['is_cohorted']).lower()}"
role="option"
>
% if entry:
<span class="forum-nav-browse-title">${entry}</span>
%endif
</li>
</%def>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment