Skip to content
Snippets Groups Projects
Commit 31498cc4 authored by Alex Dusenbery's avatar Alex Dusenbery Committed by Alex Dusenbery
Browse files

In canUserCreateTeam(), look in this.context.userInfo for staff/priveleged attributes.

parent 6fbfc328
No related branches found
Tags release-2020-01-27-15.46
No related merge requests found
......@@ -367,7 +367,7 @@ To run JavaScript tests in a browser, run these commands::
To debug these tests on devstack in a local browser:
* first run the appropriate test_js_dev command from above which will open a browser using XQuartz
* open http://edx.devstack.lms:19876/debug.html in your host system's browser of choice
* open http://localhost:19876/debug.html in your host system's browser of choice
* this will run all the tests and show you the results including details of any failures
* you can click on an individually failing test and/or suite to re-run it by itself
* you can now use the browser's developer tools to debug as you would any other JavaScript code
......
......@@ -86,23 +86,38 @@ define([
});
it('does not show actions for a user already in a team', function() {
var teamsView = createTopicTeamsView({myTeamsCollection: TeamSpecHelpers.createMockTeams()});
var options = {myTeamsCollection: TeamSpecHelpers.createMockTeams()};
var teamsView = createTopicTeamsView(options);
verifyActions(teamsView, {showActions: false});
});
it('does not show actions for a student in an instructor managed topic', function() {
var teamsView = createTopicTeamsView({privileged: false}, true);
var teamsView = createTopicTeamsView({}, true);
verifyActions(teamsView, {showActions: false});
});
it('shows actions for a privileged user already in a team', function() {
var teamsView = createTopicTeamsView({privileged: true});
verifyActions(teamsView);
var options = {
userInfo: {
privileged: true,
staff: false
},
myTeamsCollection: TeamSpecHelpers.createMockTeams()
};
var teamsView = createTopicTeamsView(options);
verifyActions(teamsView, {showActions: true});
});
it('shows actions for a staff user already in a team', function() {
var teamsView = createTopicTeamsView({privileged: false, staff: true});
verifyActions(teamsView);
var options = {
userInfo: {
privileged: false,
staff: true
},
myTeamsCollection: TeamSpecHelpers.createMockTeams()
};
var teamsView = createTopicTeamsView(options);
verifyActions(teamsView, {showActions: true});
});
/*
......
......@@ -30,8 +30,8 @@
// that they create. This means that if multiple team membership is
// disabled that they cannot create a new team when they already
// belong to one.
return this.context.staff
|| this.context.privileged
return this.context.userInfo.staff
|| this.context.userInfo.privileged
|| (!TeamUtils.isInstructorManagedTopic(this.model.attributes.type)
&& this.myTeamsCollection.length === 0);
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment