Fix forums threads load issue in the user view.

This commit is contained in:
attiyaishaque
2018-07-27 12:51:20 +05:00
parent a54066e9e6
commit 6ada0ca76d
3 changed files with 12 additions and 1 deletions

View File

@@ -32,6 +32,9 @@
routerEvents;
// TODO: eliminate usage of global variables when possible
if (options.roles === undefined) {
options.roles = {};
}
DiscussionUtil.loadRoles(options.roles);
window.$$course_id = options.courseId;
window.courseName = options.courseName;

View File

@@ -33,6 +33,9 @@
'Community TA': []
});
if (options.roles === undefined) {
options.roles = {};
}
DiscussionUtil.loadRoles(options.roles);
window.$$course_id = options.courseId;
window.courseName = options.courseName;

View File

@@ -17,7 +17,7 @@ define(
DiscussionProfilePageFactory(_.extend(
{
courseId: testCourseId,
roles: DiscussionSpecHelper.getTestRoleInfo(),
roles: (options) ? options.roles : DiscussionSpecHelper.getTestRoleInfo(),
courseSettings: DiscussionSpecHelper.createTestCourseSettings().attributes,
el: $('.discussion-user-threads'),
discussion: new Discussion(),
@@ -40,6 +40,11 @@ define(
initializeDiscussionProfilePageFactory();
expect($('.discussion-user-threads').text()).toContain('Show');
});
it('can render itself when roles are undefined', function() {
var options = {roles: undefined};
initializeDiscussionProfilePageFactory(options);
expect($('.discussion-user-threads').text()).toContain('Show');
});
});
}
);