feat: added user messages and backed now uses discussion_enabled flag (#31716)
* refactor: simplified tasks.py for discussions * fix: do not create a topic for the unpublished unit * feat: added user messages and backed now uses discussion_enabled flag * fix: update default for discussion_enabled flag * feat: removed redundant tests and fixes
This commit is contained in:
@@ -2422,26 +2422,6 @@ describe('CourseOutlinePage', function() {
|
||||
expect($('.modal-section .edit-discussion')).not.toExist();
|
||||
});
|
||||
|
||||
it('shows discussion settings if unit level discussions are enabled', function() {
|
||||
getUnitStatus({}, {unit_level_discussions: true});
|
||||
outlinePage.$('.outline-unit .configure-button').click();
|
||||
expect($('.modal-section .edit-discussion')).toExist();
|
||||
});
|
||||
|
||||
it('marks checkbox as disabled', function() {
|
||||
getUnitStatus({}, {unit_level_discussions: true});
|
||||
outlinePage.$('.outline-unit .configure-button').click();
|
||||
|
||||
var discussionCheckbox = $('#discussion_enabled');
|
||||
expect(discussionCheckbox).toExist();
|
||||
expect(discussionCheckbox.is(':checked')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('marks checkbox as enabled', function() {
|
||||
getUnitStatus({discussion_enabled: true}, {unit_level_discussions: true});
|
||||
outlinePage.$('.outline-unit .configure-button').click();
|
||||
expect($('#discussion_enabled').is(':checked')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
verifyTypePublishable('unit', function(options) {
|
||||
|
||||
@@ -941,6 +941,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
|
||||
afterRender: function() {
|
||||
AbstractEditor.prototype.afterRender.call(this);
|
||||
this.setStatus(this.currentValue());
|
||||
this.showTipText();
|
||||
},
|
||||
|
||||
currentValue: function() {
|
||||
@@ -948,6 +949,21 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
|
||||
return discussionEnabled === true || discussionEnabled === 'enabled';
|
||||
},
|
||||
|
||||
showTipText: function() {
|
||||
if (this.model.get('published')) {
|
||||
$('.un-published-tip').hide()
|
||||
} else {
|
||||
$('.un-published-tip').show()
|
||||
}
|
||||
let enabledForGraded = course.get('discussions_settings').enable_graded_units
|
||||
if (this.model.get('graded') && !enabledForGraded) {
|
||||
$('#discussion_enabled').prop('disabled', true);
|
||||
$('.graded-tip').show()
|
||||
} else {
|
||||
$('.graded-tip').hide()
|
||||
}
|
||||
},
|
||||
|
||||
setStatus: function(value) {
|
||||
this.$('#discussion_enabled').prop('checked', value);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user