Commit 31fbde9c by cahrens

Rename cohort methods to divided.

parent 8fbf01cd
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
this.pages = options.pages || 1; this.pages = options.pages || 1;
this.current_page = 1; this.current_page = 1;
this.sort_preference = options.sort; this.sort_preference = options.sort;
this.is_commentable_cohorted = options.is_commentable_cohorted; this.is_commentable_divided = options.is_commentable_divided;
this.bind('add', function(item) { this.bind('add', function(item) {
item.discussion = self; item.discussion = self;
}); });
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
Content.loadContentInfos(response.annotated_content_info); Content.loadContentInfos(response.annotated_content_info);
self.pages = response.num_pages; self.pages = response.num_pages;
self.current_page = response.page; self.current_page = response.page;
self.is_commentable_cohorted = response.is_commentable_cohorted; self.is_commentable_divided = response.is_commentable_divided;
return self.reset(new_collection); return self.reset(new_collection);
}, },
error: error error: error
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
DiscussionUtil.loadRoles(response.roles); DiscussionUtil.loadRoles(response.roles);
this.courseSettings = new DiscussionCourseSettings(response.course_settings); this.courseSettings = new DiscussionCourseSettings(response.course_settings);
this.is_commentable_cohorted = response.is_commentable_cohorted; this.is_commentable_divided = response.is_commentable_divided;
this.discussion = new Discussion(undefined, {pages: response.num_pages}); this.discussion = new Discussion(undefined, {pages: response.num_pages});
this.discussion.reset(response.discussion_data, { this.discussion.reset(response.discussion_data, {
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
course_settings: this.courseSettings, course_settings: this.courseSettings,
topicId: discussionId, topicId: discussionId,
startHeader: this.startHeader, startHeader: this.startHeader,
is_commentable_cohorted: response.is_commentable_cohorted is_commentable_divided: response.is_commentable_divided
}); });
this.newPostView.render(); this.newPostView.render();
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
mode: 'inline', mode: 'inline',
startHeader: this.startHeader, startHeader: this.startHeader,
courseSettings: this.courseSettings, courseSettings: this.courseSettings,
is_commentable_cohorted: this.is_commentable_cohorted is_commentable_divided: this.is_commentable_divided
}); });
this.threadView.render(); this.threadView.render();
this.listenTo(this.threadView.showView, 'thread:_delete', this.navigateToAllPosts); this.listenTo(this.threadView.showView, 'thread:_delete', this.navigateToAllPosts);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
DiscussionThreadShowView.__super__.initialize.call(this); DiscussionThreadShowView.__super__.initialize.call(this);
this.mode = options.mode || 'inline'; this.mode = options.mode || 'inline';
this.startHeader = options.startHeader; this.startHeader = options.startHeader;
this.is_commentable_cohorted = options.is_commentable_cohorted; this.is_commentable_divided = options.is_commentable_divided;
if ((_ref = this.mode) !== 'tab' && _ref !== 'inline') { if ((_ref = this.mode) !== 'tab' && _ref !== 'inline') {
throw new Error('invalid mode: ' + this.mode); throw new Error('invalid mode: ' + this.mode);
} }
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
mode: this.mode, mode: this.mode,
startHeader: this.startHeader, startHeader: this.startHeader,
flagged: this.model.isFlagged(), flagged: this.model.isFlagged(),
is_commentable_cohorted: this.is_commentable_cohorted, is_commentable_divided: this.is_commentable_divided,
author_display: this.getAuthorDisplay(), author_display: this.getAuthorDisplay(),
cid: this.model.cid, cid: this.model.cid,
readOnly: $('.discussion-module').data('read-only') readOnly: $('.discussion-module').data('read-only')
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
self.model = collection.get(id); self.model = collection.get(id);
} }
}); });
this.is_commentable_cohorted = options.is_commentable_cohorted; this.is_commentable_divided = options.is_commentable_divided;
this.createShowView(); this.createShowView();
this.responses = new Comments(); this.responses = new Comments();
this.loadedResponses = false; this.loadedResponses = false;
...@@ -423,7 +423,7 @@ ...@@ -423,7 +423,7 @@
model: this.model, model: this.model,
mode: this.mode, mode: this.mode,
startHeader: this.startHeader, startHeader: this.startHeader,
is_commentable_cohorted: this.is_commentable_cohorted is_commentable_divided: this.is_commentable_divided
}); });
this.showView.bind('thread:_delete', this._delete); this.showView.bind('thread:_delete', this._delete);
return this.showView.bind('thread:edit', this.edit); return this.showView.bind('thread:edit', this.edit);
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
html = entryTemplate({ html = entryTemplate({
text: name, text: name,
id: entry.id, id: entry.id,
is_cohorted: entry.is_cohorted is_divided: entry.is_divided
}); });
} else { // subcategory } else { // subcategory
html = categoryTemplate({ html = categoryTemplate({
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
throw new Error('invalid mode: ' + this.mode); throw new Error('invalid mode: ' + this.mode);
} }
this.course_settings = options.course_settings; this.course_settings = options.course_settings;
this.is_commentable_cohorted = options.is_commentable_cohorted; this.is_commentable_divided = options.is_commentable_divided;
this.topicId = options.topicId; this.topicId = options.topicId;
this.discussionBoardView = options.discussionBoardView; this.discussionBoardView = options.discussionBoardView;
}; };
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
context = _.clone(this.course_settings.attributes); context = _.clone(this.course_settings.attributes);
_.extend(context, { _.extend(context, {
cohort_options: this.getCohortOptions(), cohort_options: this.getCohortOptions(),
is_commentable_cohorted: this.is_commentable_cohorted, is_commentable_divided: this.is_commentable_divided,
mode: this.mode, mode: this.mode,
startHeader: this.startHeader, startHeader: this.startHeader,
form_id: this.mode + (this.topicId ? '-' + this.topicId : '') form_id: this.mode + (this.topicId ? '-' + this.topicId : '')
...@@ -85,14 +85,14 @@ ...@@ -85,14 +85,14 @@
}; };
NewPostView.prototype.getCohortOptions = function() { NewPostView.prototype.getCohortOptions = function() {
var userCohortId; var userGroupId;
if (this.course_settings.get('is_cohorted') && DiscussionUtil.isPrivilegedUser()) { if (this.course_settings.get('is_cohorted') && DiscussionUtil.isPrivilegedUser()) {
userCohortId = $('#discussion-container').data('user-cohort-id'); userGroupId = $('#discussion-container').data('user-group-id');
return _.map(this.course_settings.get('cohorts'), function(cohort) { return _.map(this.course_settings.get('cohorts'), function(cohort) {
return { return {
value: cohort.id, value: cohort.id,
text: cohort.name, text: cohort.name,
selected: cohort.id === userCohortId selected: cohort.id === userGroupId
}; };
}); });
} else { } else {
......
...@@ -96,29 +96,29 @@ ...@@ -96,29 +96,29 @@
describe('renderComments', function() { describe('renderComments', function() {
beforeEach(function() { beforeEach(function() {
this.course_settings = new DiscussionCourseSettings({ this.course_settings = new DiscussionCourseSettings({
'category_map': { category_map: {
'children': [ // eslint-disable-line quote-props children: [
['Topic', 'entry'], ['Topic', 'entry'],
['General', 'entry'], ['General', 'entry'],
['Basic Question', 'entry'] ['Basic Question', 'entry']
], ],
'entries': { entries: {
'Topic': { Topic: {
'is_cohorted': true, is_divided: true,
'id': 'topic' id: 'topic'
}, },
'General': { General: {
'sort_key': 'General', sort_key: 'General',
'is_cohorted': false, is_divided: false,
'id': '6.00.1x_General' id: '6.00.1x_General'
}, },
'Basic Question': { 'Basic Question': {
'is_cohorted': false, is_divided: false,
'id': "6>00'1x\"Basic_Question" id: "6>00'1x\"Basic_Question"
} }
} }
}, },
'is_cohorted': true is_cohorted: true
}); });
}); });
......
...@@ -173,23 +173,23 @@ ...@@ -173,23 +173,23 @@
}); });
}); });
describe('cohorting', function() { describe('cohorting', function() {
it('renders correctly for an uncohorted thread', function() { it('renders correctly for a unified thread', function() {
this.view.render(); this.view.render();
return expect(this.view.$('.group-visibility-label').text().trim()) return expect(this.view.$('.group-visibility-label').text().trim())
.toEqual('This post is visible to everyone.'); .toEqual('This post is visible to everyone.');
}); });
it('renders correctly for a cohorted thread', function() { it('renders correctly for a divided thread', function() {
this.thread.set('group_id', '1'); this.thread.set('group_id', '1');
this.thread.set('group_name', 'Mock Cohort'); this.thread.set('group_name', 'Mock Cohort');
this.view.is_commentable_cohorted = true; this.view.is_commentable_divided = true;
this.view.render(); this.view.render();
return expect(this.view.$('.group-visibility-label').text().trim()) return expect(this.view.$('.group-visibility-label').text().trim())
.toEqual('This post is visible only to Mock Cohort.'); .toEqual('This post is visible only to Mock Cohort.');
}); });
it('renders correctly for a grouped uncohorted thread', function() { it('renders correctly for a grouped unified thread', function() {
this.thread.set('group_id', '1'); this.thread.set('group_id', '1');
this.thread.set('group_name', 'Mock Cohort'); this.thread.set('group_name', 'Mock Cohort');
this.view.is_commentable_cohorted = false; this.view.is_commentable_divided = false;
this.view.render(); this.view.render();
return expect(this.view.$('.group-visibility-label').text().trim()) return expect(this.view.$('.group-visibility-label').text().trim())
.toEqual('This post is visible to everyone.'); .toEqual('This post is visible to everyone.');
......
...@@ -16,67 +16,67 @@ ...@@ -16,67 +16,67 @@
DiscussionSpecHelper.setUpGlobals(); DiscussionSpecHelper.setUpGlobals();
DiscussionSpecHelper.setUnderscoreFixtures(); DiscussionSpecHelper.setUnderscoreFixtures();
this.course_settings = new DiscussionCourseSettings({ this.course_settings = new DiscussionCourseSettings({
'category_map': { category_map: {
'subcategories': { subcategories: {
'Basic Question Types': { 'Basic Question Types': {
'subcategories': {}, subcategories: {},
'children': [ children: [
['Selection From Options', 'entry'], ['Selection From Options', 'entry'],
['Numerical Input', 'entry'], ['Numerical Input', 'entry'],
['Very long category name', 'entry'], ['Very long category name', 'entry'],
['Very very very very long category name', 'entry'], ['Very very very very long category name', 'entry'],
['Name with <em>HTML</em>', 'entry'] ['Name with <em>HTML</em>', 'entry']
], ],
'entries': { entries: {
'Selection From Options': { 'Selection From Options': {
'sort_key': null, sort_key: null,
'is_cohorted': true, is_divided: true,
'id': 'cba3e4cd91d0466b9ac50926e495b76f' id: 'cba3e4cd91d0466b9ac50926e495b76f'
}, },
'Numerical Input': { 'Numerical Input': {
'sort_key': null, sort_key: null,
'is_cohorted': false, is_divided: false,
'id': 'c49f0dfb8fc94c9c8d9999cc95190c56' id: 'c49f0dfb8fc94c9c8d9999cc95190c56'
}, },
'Very long category name': { 'Very long category name': {
'sort_key': null, sort_key: null,
'is_cohorted': false, is_divided: false,
'id': 'c49f0dfb8fc94c9c8d9999cc95190c59' id: 'c49f0dfb8fc94c9c8d9999cc95190c59'
}, },
'Very very very very long category name': { 'Very very very very long category name': {
'sort_key': null, sort_key: null,
'is_cohorted': false, is_divided: false,
'id': 'c49f0dfb8fc94c9c8d9999cc95190e32' id: 'c49f0dfb8fc94c9c8d9999cc95190e32'
}, },
'Name with <em>HTML</em>': { 'Name with <em>HTML</em>': {
'sort_key': null, sort_key: null,
'is_cohorted': false, is_divided: false,
'id': 'c49f0dfb8fc94c9c8d9999cc95190363' id: 'c49f0dfb8fc94c9c8d9999cc95190363'
} }
} }
}, },
'Example Inline Discussion': { 'Example Inline Discussion': {
'subcategories': {}, subcategories: {},
'children': [ children: [
['What Are Your Goals for Creating a MOOC?', 'entry'] ['What Are Your Goals for Creating a MOOC?', 'entry']
], ],
'entries': { entries: {
'What Are Your Goals for Creating a MOOC?': { 'What Are Your Goals for Creating a MOOC?': {
'sort_key': null, sort_key: null,
'is_cohorted': true, is_divided: true,
'id': 'cba3e4cd91d0466b9ac50926e495b931' id: 'cba3e4cd91d0466b9ac50926e495b931'
} }
} }
} }
}, },
'children': [ // eslint-disable-line quote-props children: [
['Basic Question Types', 'subcategory'], ['Basic Question Types', 'subcategory'],
['Example Inline Discussion', 'subcategory'] ['Example Inline Discussion', 'subcategory']
], ],
'entries': {} entries: {}
}, },
'is_cohorted': true is_cohorted: true
}); });
}); });
......
...@@ -38,15 +38,15 @@ ...@@ -38,15 +38,15 @@
children: [['Topic', 'entry'], ['General', 'entry'], ['Not Cohorted', 'entry']], children: [['Topic', 'entry'], ['General', 'entry'], ['Not Cohorted', 'entry']],
entries: { entries: {
Topic: { Topic: {
is_cohorted: true, is_divided: true,
id: 'topic' id: 'topic'
}, },
General: { General: {
is_cohorted: true, is_divided: true,
id: 'general' id: 'general'
}, },
'Not Cohorted': { 'Not Cohorted': {
is_cohorted: false, is_divided: false,
id: 'not-cohorted' id: 'not-cohorted'
} }
} }
...@@ -145,20 +145,20 @@ ...@@ -145,20 +145,20 @@
}); });
it('disables the cohort menu if it is set false', function() { it('disables the cohort menu if it is set false', function() {
DiscussionSpecHelper.makeModerator(); DiscussionSpecHelper.makeModerator();
this.view.is_commentable_cohorted = false; this.view.is_commentable_divided = false;
return checkVisibility(this.view, true, true, true); return checkVisibility(this.view, true, true, true);
}); });
it('enables the cohort menu if it is set true', function() { it('enables the cohort menu if it is set true', function() {
DiscussionSpecHelper.makeModerator(); DiscussionSpecHelper.makeModerator();
this.view.is_commentable_cohorted = true; this.view.is_commentable_divided = true;
return checkVisibility(this.view, true, false, true); return checkVisibility(this.view, true, false, true);
}); });
it('is not visible to students when set false', function() { it('is not visible to students when set false', function() {
this.view.is_commentable_cohorted = false; this.view.is_commentable_divided = false;
return checkVisibility(this.view, false, false, true); return checkVisibility(this.view, false, false, true);
}); });
it('is not visible to students when set true', function() { it('is not visible to students when set true', function() {
this.view.is_commentable_cohorted = true; this.view.is_commentable_divided = true;
return checkVisibility(this.view, false, false, true); return checkVisibility(this.view, false, false, true);
}); });
}); });
...@@ -166,33 +166,33 @@ ...@@ -166,33 +166,33 @@
var checkPostCancelReset; var checkPostCancelReset;
beforeEach(function() { beforeEach(function() {
this.course_settings = new DiscussionCourseSettings({ this.course_settings = new DiscussionCourseSettings({
'allow_anonymous_to_peers': true, allow_anonymous_to_peers: true,
'allow_anonymous': true, allow_anonymous: true,
'category_map': { category_map: {
'subcategories': { subcategories: {
'Week 1': { 'Week 1': {
'subcategories': {}, subcategories: {},
'children': [ // eslint-disable-line quote-props children: [
['Topic-Level Student-Visible Label', 'entry'] ['Topic-Level Student-Visible Label', 'entry']
], ],
'entries': { entries: {
'Topic-Level Student-Visible Label': { 'Topic-Level Student-Visible Label': {
'sort_key': null, sort_key: null,
'is_cohorted': false, is_divided: false,
'id': '2b3a858d0c884eb4b272dbbe3f2ffddd' id: '2b3a858d0c884eb4b272dbbe3f2ffddd'
} }
} }
} }
}, },
'children': [ // eslint-disable-line quote-props children: [
['General', 'entry'], ['General', 'entry'],
['Week 1', 'subcategory'] ['Week 1', 'subcategory']
], ],
'entries': { entries: {
'General': { General: {
'sort_key': 'General', sort_key: 'General',
'is_cohorted': false, is_divided: false,
'id': 'i4x-waqastest-waqastest-course-waqastest' id: 'i4x-waqastest-waqastest-course-waqastest'
} }
} }
} }
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
entries: { entries: {
'Topic-Level Student-Visible Label': { 'Topic-Level Student-Visible Label': {
sort_key: null, sort_key: null,
is_cohorted: false, is_divided: false,
id: '2b3a858d0c884eb4b272dbbe3f2ffddd' id: '2b3a858d0c884eb4b272dbbe3f2ffddd'
} }
} }
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
entries: { entries: {
'First topic': { 'First topic': {
sort_key: 'First topic', sort_key: 'First topic',
is_cohorted: false, is_divided: false,
id: 'i4x-waqastest-waqastest-course-waqastest' id: 'i4x-waqastest-waqastest-course-waqastest'
} }
} }
......
...@@ -58,11 +58,11 @@ ...@@ -58,11 +58,11 @@
children: [['Test Topic', 'entry'], ['Other Topic', 'entry']], children: [['Test Topic', 'entry'], ['Other Topic', 'entry']],
entries: { entries: {
'Test Topic': { 'Test Topic': {
is_cohorted: true, is_divided: true,
id: 'test_topic' id: 'test_topic'
}, },
'Other Topic': { 'Other Topic': {
is_cohorted: true, is_divided: true,
id: 'other_topic' id: 'other_topic'
} }
} }
......
<option class="topic-title" data-discussion-id="<%- id %>" data-cohorted="<%- is_cohorted %>"><%- text %></option> <option class="topic-title" data-discussion-id="<%- id %>" data-cohorted="<%- is_divided %>"><%- text %></option>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<ul class="post-errors" style="display: none"></ul> <ul class="post-errors" style="display: none"></ul>
<div class="forum-new-post-form-wrapper"></div> <div class="forum-new-post-form-wrapper"></div>
<% if (cohort_options) { %> <% if (cohort_options) { %>
<div class="post-field group-selector-wrapper <% if (!is_commentable_cohorted) { print('disabled'); } %>"> <div class="post-field group-selector-wrapper <% if (!is_commentable_divided) { print('disabled'); } %>">
<label class="field-label"> <label class="field-label">
<span class="field-label-text"> <span class="field-label-text">
<% //Translators: This labels the selector for which group of students can view a post %> <% //Translators: This labels the selector for which group of students can view a post %>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<%- gettext("Discussion admins, moderators, and TAs can make their posts visible to all students or specify a single cohort.") %> <%- gettext("Discussion admins, moderators, and TAs can make their posts visible to all students or specify a single cohort.") %>
</div> </div>
<div class="field-input"> <div class="field-input">
<select aria-describedby="field_help_visible_to" class="post-topic field-input js-group-select" name="group_id" <% if (!is_commentable_cohorted) { print("disabled"); } %>> <select aria-describedby="field_help_visible_to" class="post-topic field-input js-group-select" name="group_id" <% if (!is_commentable_divided) { print("disabled"); } %>>
<option value=""><%- gettext("All Groups") %></option> <option value=""><%- gettext("All Groups") %></option>
<% _.each(cohort_options, function(opt) { %> <% _.each(cohort_options, function(opt) { %>
<option value="<%- opt.value %>" <% if (opt.selected) { print("selected"); } %>><%- opt.text %></option> <option value="<%- opt.value %>" <% if (opt.selected) { print("selected"); } %>><%- opt.text %></option>
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
%> %>
<% } %> <% } %>
<div class="group-visibility-label"> <div class="group-visibility-label">
<% if (obj.group_name && is_commentable_cohorted) { %> <% if (obj.group_name && is_commentable_divided) { %>
<%- <%-
interpolate( interpolate(
gettext('This post is visible only to %(group_name)s.'), gettext('This post is visible only to %(group_name)s.'),
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
sortPreference = options.sortPreference, sortPreference = options.sortPreference,
threads = options.threads, threads = options.threads,
threadPages = options.threadPages, threadPages = options.threadPages,
isCommentableCohorted = options.isCommentableCohorted, isCommentableDivided = options.isCommentableDivided,
contentInfo = options.contentInfo, contentInfo = options.contentInfo,
user = new DiscussionUser(userInfo), user = new DiscussionUser(userInfo),
discussion, discussion,
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
// Create a discussion model // Create a discussion model
discussion = new Discussion(threads, {pages: threadPages, sort: sortPreference, discussion = new Discussion(threads, {pages: threadPages, sort: sortPreference,
is_commentable_cohorted: isCommentableCohorted}); is_commentable_divided: isCommentableDivided});
courseSettings = new DiscussionCourseSettings(options.courseSettings); courseSettings = new DiscussionCourseSettings(options.courseSettings);
// Create the discussion board view // Create the discussion board view
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
mode: 'tab', mode: 'tab',
startHeader: this.startHeader, startHeader: this.startHeader,
courseSettings: this.courseSettings, courseSettings: this.courseSettings,
is_commentable_cohorted: this.discussion.is_commentable_cohorted is_commentable_divided: this.discussion.is_commentable_divided
}); });
this.main.render(); this.main.render();
this.main.on('thread:responses:rendered', function() { this.main.on('thread:responses:rendered', function() {
......
...@@ -22,7 +22,7 @@ from openedx.core.djangolib.markup import HTML ...@@ -22,7 +22,7 @@ from openedx.core.djangolib.markup import HTML
data-read-only="false" data-read-only="false"
data-sort-preference="${sort_preference}" data-sort-preference="${sort_preference}"
data-flag-moderator="${json.dumps(flag_moderator)}" data-flag-moderator="${json.dumps(flag_moderator)}"
data-user-cohort-id="${user_cohort}"> data-user-group-id="${user_group_id}">
<header class="page-header has-secondary"> <header class="page-header has-secondary">
## Breadcrumb navigation ## Breadcrumb navigation
<div class="page-header-main"> <div class="page-header-main">
......
...@@ -57,7 +57,7 @@ from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_str ...@@ -57,7 +57,7 @@ from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_str
contentInfo: ${annotated_content_info | n, dump_js_escaped_json}, contentInfo: ${annotated_content_info | n, dump_js_escaped_json},
courseName: '${course.display_name_with_default | n, js_escaped_string}', courseName: '${course.display_name_with_default | n, js_escaped_string}',
courseSettings: ${course_settings | n, dump_js_escaped_json}, courseSettings: ${course_settings | n, dump_js_escaped_json},
isCommentableCohorted: ${is_commentable_cohorted | n, dump_js_escaped_json} isCommentableDivided: ${is_commentable_divided | n, dump_js_escaped_json}
}); });
}); });
}); });
......
...@@ -84,7 +84,7 @@ from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_str ...@@ -84,7 +84,7 @@ from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_str
data-read-only="false" data-read-only="false"
data-sort-preference="${sort_preference}" data-sort-preference="${sort_preference}"
data-flag-moderator="${json.dumps(flag_moderator)}" data-flag-moderator="${json.dumps(flag_moderator)}"
data-user-cohort-id="${user_cohort}"> data-user-group-id="${user_group_id}">
</div> </div>
</main> </main>
</div> </div>
......
...@@ -32,7 +32,6 @@ from courseware.courses import get_course_with_access ...@@ -32,7 +32,6 @@ from courseware.courses import get_course_with_access
from courseware.views.views import CourseTabView from courseware.views.views import CourseTabView
from openedx.core.djangoapps.course_groups.cohorts import ( from openedx.core.djangoapps.course_groups.cohorts import (
is_course_cohorted, is_course_cohorted,
get_cohort_id,
get_course_cohorts, get_course_cohorts,
) )
from openedx.core.djangoapps.plugin_api.views import EdxFragmentView from openedx.core.djangoapps.plugin_api.views import EdxFragmentView
...@@ -49,8 +48,10 @@ from django_comment_client.utils import ( ...@@ -49,8 +48,10 @@ from django_comment_client.utils import (
strip_none, strip_none,
add_courseware_context, add_courseware_context,
get_group_id_for_comments_service, get_group_id_for_comments_service,
is_commentable_cohorted is_commentable_divided,
get_group_id_for_user,
) )
import django_comment_client.utils as utils import django_comment_client.utils as utils
import lms.lib.comment_client as cc import lms.lib.comment_client as cc
...@@ -222,7 +223,7 @@ def inline_discussion(request, course_key, discussion_id): ...@@ -222,7 +223,7 @@ def inline_discussion(request, course_key, discussion_id):
add_courseware_context(threads, course, request.user) add_courseware_context(threads, course, request.user)
return utils.JsonResponse({ return utils.JsonResponse({
'is_commentable_cohorted': is_commentable_cohorted(course_key, discussion_id), 'is_commentable_divided': is_commentable_divided(course_key, discussion_id),
'discussion_data': threads, 'discussion_data': threads,
'user_info': user_info, 'user_info': user_info,
'annotated_content_info': annotated_content_info, 'annotated_content_info': annotated_content_info,
...@@ -347,8 +348,8 @@ def _find_thread(request, course, discussion_id, thread_id): ...@@ -347,8 +348,8 @@ def _find_thread(request, course, discussion_id, thread_id):
# verify that the thread belongs to the requesting student's cohort # verify that the thread belongs to the requesting student's cohort
is_moderator = has_permission(request.user, "see_all_cohorts", course.id) is_moderator = has_permission(request.user, "see_all_cohorts", course.id)
if is_commentable_cohorted(course.id, discussion_id) and not is_moderator: if is_commentable_divided(course.id, discussion_id) and not is_moderator:
user_group_id = get_cohort_id(request.user, course.id) user_group_id = get_group_id_for_user(request.user, course.id)
if getattr(thread, "group_id", None) is not None and user_group_id != thread.group_id: if getattr(thread, "group_id", None) is not None and user_group_id != thread.group_id:
return None return None
...@@ -423,7 +424,7 @@ def _create_discussion_board_context(request, course_key, discussion_id=None, th ...@@ -423,7 +424,7 @@ def _create_discussion_board_context(request, course_key, discussion_id=None, th
add_courseware_context(threads, course, user) add_courseware_context(threads, course, user)
with newrelic_function_trace("get_cohort_info"): with newrelic_function_trace("get_cohort_info"):
user_cohort_id = get_cohort_id(user, course_key) user_group_id = get_group_id_for_user(user, course_key)
context.update({ context.update({
'root_url': root_url, 'root_url': root_url,
...@@ -434,11 +435,11 @@ def _create_discussion_board_context(request, course_key, discussion_id=None, th ...@@ -434,11 +435,11 @@ def _create_discussion_board_context(request, course_key, discussion_id=None, th
'annotated_content_info': annotated_content_info, 'annotated_content_info': annotated_content_info,
'is_moderator': has_permission(user, "see_all_cohorts", course_key), 'is_moderator': has_permission(user, "see_all_cohorts", course_key),
'cohorts': course_settings["cohorts"], # still needed to render _thread_list_template 'cohorts': course_settings["cohorts"], # still needed to render _thread_list_template
'user_cohort': user_cohort_id, # read from container in NewPostView 'user_group_id': user_group_id, # read from container in NewPostView
'sort_preference': cc_user.default_sort_key, 'sort_preference': cc_user.default_sort_key,
'category_map': course_settings["category_map"], 'category_map': course_settings["category_map"],
'course_settings': course_settings, 'course_settings': course_settings,
'is_commentable_cohorted': is_commentable_cohorted(course_key, discussion_id) 'is_commentable_divided': is_commentable_divided(course_key, discussion_id)
}) })
return context return context
...@@ -500,7 +501,7 @@ def user_profile(request, course_key, user_id): ...@@ -500,7 +501,7 @@ def user_profile(request, course_key, user_id):
).order_by("name").values_list("name", flat=True).distinct() ).order_by("name").values_list("name", flat=True).distinct()
with newrelic_function_trace("get_cohort_info"): with newrelic_function_trace("get_cohort_info"):
user_cohort_id = get_cohort_id(request.user, course_key) user_group_id = get_group_id_for_user(request.user, course_key)
context = _create_base_discussion_view_context(request, course_key) context = _create_base_discussion_view_context(request, course_key)
context.update({ context.update({
...@@ -508,7 +509,7 @@ def user_profile(request, course_key, user_id): ...@@ -508,7 +509,7 @@ def user_profile(request, course_key, user_id):
'django_user_roles': user_roles, 'django_user_roles': user_roles,
'profiled_user': profiled_user.to_dict(), 'profiled_user': profiled_user.to_dict(),
'threads': threads, 'threads': threads,
'user_cohort': user_cohort_id, 'user_group_id': user_group_id,
'annotated_content_info': annotated_content_info, 'annotated_content_info': annotated_content_info,
'page': query_params['page'], 'page': query_params['page'],
'num_pages': query_params['num_pages'], 'num_pages': query_params['num_pages'],
......
...@@ -43,12 +43,11 @@ from django_comment_common.signals import ( ...@@ -43,12 +43,11 @@ from django_comment_common.signals import (
comment_voted, comment_voted,
comment_deleted, comment_deleted,
) )
from django_comment_client.utils import get_accessible_discussion_xblocks, is_commentable_cohorted from django_comment_client.utils import get_accessible_discussion_xblocks, is_commentable_divided, get_group_id_for_user
from lms.djangoapps.discussion_api.pagination import DiscussionAPIPagination from lms.djangoapps.discussion_api.pagination import DiscussionAPIPagination
from lms.lib.comment_client.comment import Comment from lms.lib.comment_client.comment import Comment
from lms.lib.comment_client.thread import Thread from lms.lib.comment_client.thread import Thread
from lms.lib.comment_client.utils import CommentClientRequestError from lms.lib.comment_client.utils import CommentClientRequestError
from openedx.core.djangoapps.course_groups.cohorts import get_cohort_id
from openedx.core.lib.exceptions import CourseNotFoundError, PageNotFoundError, DiscussionNotFoundError from openedx.core.lib.exceptions import CourseNotFoundError, PageNotFoundError, DiscussionNotFoundError
...@@ -113,10 +112,10 @@ def _get_thread_and_context(request, thread_id, retrieve_kwargs=None): ...@@ -113,10 +112,10 @@ def _get_thread_and_context(request, thread_id, retrieve_kwargs=None):
if ( if (
not context["is_requester_privileged"] and not context["is_requester_privileged"] and
cc_thread["group_id"] and cc_thread["group_id"] and
is_commentable_cohorted(course.id, cc_thread["commentable_id"]) is_commentable_divided(course.id, cc_thread["commentable_id"])
): ):
requester_cohort = get_cohort_id(request.user, course.id) requester_group_id = get_group_id_for_user(request.user, course.id)
if requester_cohort is not None and cc_thread["group_id"] != requester_cohort: if requester_group_id is not None and cc_thread["group_id"] != requester_group_id:
raise ThreadNotFoundError("Thread not found.") raise ThreadNotFoundError("Thread not found.")
return cc_thread, context return cc_thread, context
except CommentClientRequestError: except CommentClientRequestError:
...@@ -547,7 +546,7 @@ def get_thread_list( ...@@ -547,7 +546,7 @@ def get_thread_list(
"user_id": unicode(request.user.id), "user_id": unicode(request.user.id),
"group_id": ( "group_id": (
None if context["is_requester_privileged"] else None if context["is_requester_privileged"] else
get_cohort_id(request.user, course.id) get_group_id_for_user(request.user, course.id)
), ),
"page": page, "page": page,
"per_page": page_size, "per_page": page_size,
...@@ -831,10 +830,10 @@ def create_thread(request, thread_data): ...@@ -831,10 +830,10 @@ def create_thread(request, thread_data):
_check_initializable_thread_fields(thread_data, context) _check_initializable_thread_fields(thread_data, context)
if ( if (
"group_id" not in thread_data and "group_id" not in thread_data and
is_commentable_cohorted(course_key, thread_data.get("topic_id")) is_commentable_divided(course_key, thread_data.get("topic_id"))
): ):
thread_data = thread_data.copy() thread_data = thread_data.copy()
thread_data["group_id"] = get_cohort_id(user, course_key) thread_data["group_id"] = get_group_id_for_user(user, course_key)
serializer = ThreadSerializer(data=thread_data, context=context) serializer = ThreadSerializer(data=thread_data, context=context)
actions_form = ThreadActionsForm(thread_data) actions_form = ThreadActionsForm(thread_data)
if not (serializer.is_valid() and actions_form.is_valid()): if not (serializer.is_valid() and actions_form.is_valid()):
......
...@@ -241,11 +241,11 @@ def create_thread(request, course_id, commentable_id): ...@@ -241,11 +241,11 @@ def create_thread(request, course_id, commentable_id):
thread = cc.Thread(**params) thread = cc.Thread(**params)
# Cohort the thread if required # Divide the thread if required
try: try:
group_id = get_group_id_for_comments_service(request, course_key, commentable_id) group_id = get_group_id_for_comments_service(request, course_key, commentable_id)
except ValueError: except ValueError:
return HttpResponseServerError("Invalid cohort id") return HttpResponseServerError("Invalid group id for commentable")
if group_id is not None: if group_id is not None:
thread.group_id = group_id thread.group_id = group_id
......
...@@ -258,7 +258,7 @@ def _sort_map_entries(category_map, sort_alpha): ...@@ -258,7 +258,7 @@ def _sort_map_entries(category_map, sort_alpha):
category_map["children"] = [(x[0], x[2]) for x in sorted(things, key=lambda x: x[1]["sort_key"])] category_map["children"] = [(x[0], x[2]) for x in sorted(things, key=lambda x: x[1]["sort_key"])]
def get_discussion_category_map(course, user, cohorted_if_in_list=False, exclude_unstarted=True): def get_discussion_category_map(course, user, divided_only_if_explicit=False, exclude_unstarted=True):
""" """
Transform the list of this course's discussion xblocks into a recursive dictionary structure. This is used Transform the list of this course's discussion xblocks into a recursive dictionary structure. This is used
to render the discussion category map in the discussion tab sidebar for a given user. to render the discussion category map in the discussion tab sidebar for a given user.
...@@ -266,15 +266,15 @@ def get_discussion_category_map(course, user, cohorted_if_in_list=False, exclude ...@@ -266,15 +266,15 @@ def get_discussion_category_map(course, user, cohorted_if_in_list=False, exclude
Args: Args:
course: Course for which to get the ids. course: Course for which to get the ids.
user: User to check for access. user: User to check for access.
cohorted_if_in_list (bool): If True, inline topics are marked is_cohorted only if they are divided_only_if_explicit (bool): If True, inline topics are marked is_divided only if they are
in course_cohort_settings.discussion_topics. explicitly listed in course_cohort_settings.discussion_topics.
Example: Example:
>>> example = { >>> example = {
>>> "entries": { >>> "entries": {
>>> "General": { >>> "General": {
>>> "sort_key": "General", >>> "sort_key": "General",
>>> "is_cohorted": True, >>> "is_divided": True,
>>> "id": "i4x-edx-eiorguegnru-course-foobarbaz" >>> "id": "i4x-edx-eiorguegnru-course-foobarbaz"
>>> } >>> }
>>> }, >>> },
...@@ -292,12 +292,12 @@ def get_discussion_category_map(course, user, cohorted_if_in_list=False, exclude ...@@ -292,12 +292,12 @@ def get_discussion_category_map(course, user, cohorted_if_in_list=False, exclude
>>> "entries": { >>> "entries": {
>>> "Working with Videos": { >>> "Working with Videos": {
>>> "sort_key": None, >>> "sort_key": None,
>>> "is_cohorted": False, >>> "is_divided": False,
>>> "id": "d9f970a42067413cbb633f81cfb12604" >>> "id": "d9f970a42067413cbb633f81cfb12604"
>>> }, >>> },
>>> "Videos on edX": { >>> "Videos on edX": {
>>> "sort_key": None, >>> "sort_key": None,
>>> "is_cohorted": False, >>> "is_divided": False,
>>> "id": "98d8feb5971041a085512ae22b398613" >>> "id": "98d8feb5971041a085512ae22b398613"
>>> } >>> }
>>> } >>> }
...@@ -356,14 +356,14 @@ def get_discussion_category_map(course, user, cohorted_if_in_list=False, exclude ...@@ -356,14 +356,14 @@ def get_discussion_category_map(course, user, cohorted_if_in_list=False, exclude
if node[level]["start_date"] > category_start_date: if node[level]["start_date"] > category_start_date:
node[level]["start_date"] = category_start_date node[level]["start_date"] = category_start_date
always_cohort_inline_discussions = ( # pylint: disable=invalid-name divide_all_inline_discussions = ( # pylint: disable=invalid-name
not cohorted_if_in_list and course_cohort_settings.always_cohort_inline_discussions not divided_only_if_explicit and course_cohort_settings.always_cohort_inline_discussions
) )
dupe_counters = defaultdict(lambda: 0) # counts the number of times we see each title dupe_counters = defaultdict(lambda: 0) # counts the number of times we see each title
for entry in entries: for entry in entries:
is_entry_cohorted = ( is_entry_divided = (
course_cohort_settings.is_cohorted and ( course_cohort_settings.is_cohorted and (
always_cohort_inline_discussions or entry["id"] in course_cohort_settings.cohorted_discussions divide_all_inline_discussions or entry["id"] in course_cohort_settings.cohorted_discussions
) )
) )
...@@ -376,7 +376,7 @@ def get_discussion_category_map(course, user, cohorted_if_in_list=False, exclude ...@@ -376,7 +376,7 @@ def get_discussion_category_map(course, user, cohorted_if_in_list=False, exclude
node[level]["entries"][title] = {"id": entry["id"], node[level]["entries"][title] = {"id": entry["id"],
"sort_key": entry["sort_key"], "sort_key": entry["sort_key"],
"start_date": entry["start_date"], "start_date": entry["start_date"],
"is_cohorted": is_entry_cohorted} "is_divided": is_entry_divided}
# TODO. BUG! : course location is not unique across multiple course runs! # TODO. BUG! : course location is not unique across multiple course runs!
# (I think Kevin already noticed this) Need to send course_id with requests, store it # (I think Kevin already noticed this) Need to send course_id with requests, store it
...@@ -386,8 +386,9 @@ def get_discussion_category_map(course, user, cohorted_if_in_list=False, exclude ...@@ -386,8 +386,9 @@ def get_discussion_category_map(course, user, cohorted_if_in_list=False, exclude
"id": entry["id"], "id": entry["id"],
"sort_key": entry.get("sort_key", topic), "sort_key": entry.get("sort_key", topic),
"start_date": datetime.now(UTC()), "start_date": datetime.now(UTC()),
"is_cohorted": (course_cohort_settings.is_cohorted and "is_divided": (
entry["id"] in course_cohort_settings.cohorted_discussions) course_cohort_settings.is_cohorted and entry["id"] in course_cohort_settings.cohorted_discussions
)
} }
_sort_map_entries(category_map, course.discussion_sort_alpha) _sort_map_entries(category_map, course.discussion_sort_alpha)
...@@ -740,7 +741,7 @@ def get_group_id_for_comments_service(request, course_key, commentable_id=None): ...@@ -740,7 +741,7 @@ def get_group_id_for_comments_service(request, course_key, commentable_id=None):
Raises: Raises:
ValueError if the requested group_id is invalid ValueError if the requested group_id is invalid
""" """
if commentable_id is None or is_commentable_cohorted(course_key, commentable_id): if commentable_id is None or is_commentable_divided(course_key, commentable_id):
if request.method == "GET": if request.method == "GET":
requested_group_id = request.GET.get('group_id') requested_group_id = request.GET.get('group_id')
elif request.method == "POST": elif request.method == "POST":
...@@ -755,7 +756,7 @@ def get_group_id_for_comments_service(request, course_key, commentable_id=None): ...@@ -755,7 +756,7 @@ def get_group_id_for_comments_service(request, course_key, commentable_id=None):
raise ValueError raise ValueError
else: else:
# regular users always query with their own id. # regular users always query with their own id.
group_id = get_cohort_id(request.user, course_key) group_id = get_group_id_for_user(request.user, course_key)
return group_id return group_id
else: else:
# Never pass a group_id to the comments service for a non-cohorted # Never pass a group_id to the comments service for a non-cohorted
...@@ -763,6 +764,14 @@ def get_group_id_for_comments_service(request, course_key, commentable_id=None): ...@@ -763,6 +764,14 @@ def get_group_id_for_comments_service(request, course_key, commentable_id=None):
return None return None
def get_group_id_for_user(user, course_key):
"""
This method will be modified to consider Enrollment Tracks.
Currently pass-through to get_cohort_id.
"""
return get_cohort_id(user, course_key)
def is_comment_too_deep(parent): def is_comment_too_deep(parent):
""" """
Determine whether a comment with the given parent violates MAX_COMMENT_DEPTH Determine whether a comment with the given parent violates MAX_COMMENT_DEPTH
...@@ -777,14 +786,15 @@ def is_comment_too_deep(parent): ...@@ -777,14 +786,15 @@ def is_comment_too_deep(parent):
) )
def is_commentable_cohorted(course_key, commentable_id): def is_commentable_divided(course_key, commentable_id):
""" """
Args: Args:
course_key: CourseKey course_key: CourseKey
commentable_id: string commentable_id: string
Returns: Returns:
Bool: is this commentable cohorted? Bool: is this commentable divided, meaning that learners are divided into
groups (either Cohorts or Enrollment Tracks) and only see posts within their group?
Raises: Raises:
Http404 if the course doesn't exist. Http404 if the course doesn't exist.
...@@ -807,7 +817,7 @@ def is_commentable_cohorted(course_key, commentable_id): ...@@ -807,7 +817,7 @@ def is_commentable_cohorted(course_key, commentable_id):
# inline discussions are cohorted by default # inline discussions are cohorted by default
ans = True ans = True
log.debug(u"is_commentable_cohorted(%s, %s) = {%s}", course_key, commentable_id, ans) log.debug(u"is_commentable_divided(%s, %s) = {%s}", course_key, commentable_id, ans)
return ans return ans
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
return subCategoryTemplate({ return subCategoryTemplate({
name: name, name: name,
id: entry.id, id: entry.id,
is_cohorted: entry.is_cohorted, is_divided: entry.is_divided,
type: 'course-wide' type: 'course-wide'
}); });
})); }));
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
htmlSnippet = entryTemplate({ htmlSnippet = entryTemplate({
name: name, name: name,
id: entry.id, id: entry.id,
is_cohorted: entry.is_cohorted, is_divided: entry.is_divided,
type: 'inline' type: 'inline'
}); });
} else { // subcategory } else { // subcategory
......
...@@ -93,12 +93,12 @@ define(['backbone', 'jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers ...@@ -93,12 +93,12 @@ define(['backbone', 'jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers
entries: { entries: {
Topic_C_1: { Topic_C_1: {
sort_key: null, sort_key: null,
is_cohorted: true, is_divided: true,
id: 'Topic_C_1' id: 'Topic_C_1'
}, },
Topic_C_2: { Topic_C_2: {
sort_key: null, sort_key: null,
is_cohorted: false, is_divided: false,
id: 'Topic_C_2' id: 'Topic_C_2'
} }
} }
...@@ -111,12 +111,12 @@ define(['backbone', 'jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers ...@@ -111,12 +111,12 @@ define(['backbone', 'jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers
entries: { entries: {
Inline_Discussion_1: { Inline_Discussion_1: {
sort_key: null, sort_key: null,
is_cohorted: true, is_divided: true,
id: 'Inline_Discussion_1' id: 'Inline_Discussion_1'
}, },
Inline_Discussion_2: { Inline_Discussion_2: {
sort_key: null, sort_key: null,
is_cohorted: allCohorted || false, is_divided: allCohorted || false,
id: 'Inline_Discussion_2' id: 'Inline_Discussion_2'
} }
} }
...@@ -1492,7 +1492,7 @@ define(['backbone', 'jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers ...@@ -1492,7 +1492,7 @@ define(['backbone', 'jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers
entries: { entries: {
Topic_C_1: { Topic_C_1: {
sort_key: null, sort_key: null,
is_cohorted: true, is_divided: true,
id: 'Topic_C_1' id: 'Topic_C_1'
} }
} }
......
...@@ -20,7 +20,7 @@ from openedx.core.djangolib.markup import HTML ...@@ -20,7 +20,7 @@ from openedx.core.djangolib.markup import HTML
class="forum-nav-browse-menu-item" class="forum-nav-browse-menu-item"
data-discussion-id='${entries[entry]["id"]}' data-discussion-id='${entries[entry]["id"]}'
id='${entries[entry]["id"]}' id='${entries[entry]["id"]}'
data-cohorted="${str(entries[entry]['is_cohorted']).lower()}" data-cohorted="${str(entries[entry]['is_divided']).lower()}"
role="option" role="option"
> >
% if entry: % if entry:
......
<li class="discussion-subcategory-item"> <li class="discussion-subcategory-item">
<div class="subcategory-item"> <div class="subcategory-item">
<label> <label>
<input data-id="<%- id %>" class="check-discussion-subcategory-<%- type %>" type="checkbox" <%- is_cohorted ? 'checked="checked"' : '' %> /> <input data-id="<%- id %>" class="check-discussion-subcategory-<%- type %>" type="checkbox" <%- is_divided ? 'checked="checked"' : '' %> />
<span class="topic-name"><%- name %></span> <span class="topic-name"><%- name %></span>
<span class="cohorted-text <%- is_cohorted ? '' : 'hidden'%>">- <%- gettext('Cohorted') %></span> <span class="cohorted-text <%- is_divided ? '' : 'hidden'%>">- <%- gettext('Cohorted') %></span>
</label> </label>
</div> </div>
</li> </li>
...@@ -1255,7 +1255,7 @@ class CourseCohortDiscussionTopicsTestCase(CohortViewsTestCase): ...@@ -1255,7 +1255,7 @@ class CourseCohortDiscussionTopicsTestCase(CohortViewsTestCase):
'entries': { 'entries': {
'Topic B': { 'Topic B': {
'sort_key': 'A', 'sort_key': 'A',
'is_cohorted': True, 'is_divided': True,
'id': topic_name_to_id(self.course, "Topic B"), 'id': topic_name_to_id(self.course, "Topic B"),
'start_date': response['course_wide_discussions']['entries']['Topic B']['start_date'] 'start_date': response['course_wide_discussions']['entries']['Topic B']['start_date']
} }
...@@ -1269,7 +1269,7 @@ class CourseCohortDiscussionTopicsTestCase(CohortViewsTestCase): ...@@ -1269,7 +1269,7 @@ class CourseCohortDiscussionTopicsTestCase(CohortViewsTestCase):
'entries': { 'entries': {
'Discussion': { 'Discussion': {
'sort_key': None, 'sort_key': None,
'is_cohorted': True, 'is_divided': True,
'id': topic_name_to_id(self.course, "Topic A"), 'id': topic_name_to_id(self.course, "Topic A"),
'start_date': start_date 'start_date': start_date
} }
......
...@@ -435,7 +435,7 @@ def cohort_discussion_topics(request, course_key_string): ...@@ -435,7 +435,7 @@ def cohort_discussion_topics(request, course_key_string):
>>> "entries": { >>> "entries": {
>>> "General": { >>> "General": {
>>> "sort_key": "General", >>> "sort_key": "General",
>>> "is_cohorted": True, >>> "is_divided": True,
>>> "id": "i4x-edx-eiorguegnru-course-foobarbaz" >>> "id": "i4x-edx-eiorguegnru-course-foobarbaz"
>>> } >>> }
>>> } >>> }
...@@ -452,12 +452,12 @@ def cohort_discussion_topics(request, course_key_string): ...@@ -452,12 +452,12 @@ def cohort_discussion_topics(request, course_key_string):
>>> "entries": { >>> "entries": {
>>> "Working with Videos": { >>> "Working with Videos": {
>>> "sort_key": None, >>> "sort_key": None,
>>> "is_cohorted": False, >>> "is_divided": False,
>>> "id": "d9f970a42067413cbb633f81cfb12604" >>> "id": "d9f970a42067413cbb633f81cfb12604"
>>> }, >>> },
>>> "Videos on edX": { >>> "Videos on edX": {
>>> "sort_key": None, >>> "sort_key": None,
>>> "is_cohorted": False, >>> "is_divided": False,
>>> "id": "98d8feb5971041a085512ae22b398613" >>> "id": "98d8feb5971041a085512ae22b398613"
>>> } >>> }
>>> } >>> }
...@@ -472,7 +472,7 @@ def cohort_discussion_topics(request, course_key_string): ...@@ -472,7 +472,7 @@ def cohort_discussion_topics(request, course_key_string):
discussion_topics = {} discussion_topics = {}
discussion_category_map = get_discussion_category_map( discussion_category_map = get_discussion_category_map(
course, request.user, cohorted_if_in_list=True, exclude_unstarted=False course, request.user, divided_only_if_explicit=True, exclude_unstarted=False
) )
# We extract the data for the course wide discussions from the category map. # We extract the data for the course wide discussions from the category map.
......
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