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-24-15.46
No related merge requests found
...@@ -367,7 +367,7 @@ To run JavaScript tests in a browser, run these commands:: ...@@ -367,7 +367,7 @@ To run JavaScript tests in a browser, run these commands::
To debug these tests on devstack in a local browser: 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 * 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 * 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 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 * you can now use the browser's developer tools to debug as you would any other JavaScript code
......
...@@ -86,23 +86,38 @@ define([ ...@@ -86,23 +86,38 @@ define([
}); });
it('does not show actions for a user already in a team', function() { 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}); verifyActions(teamsView, {showActions: false});
}); });
it('does not show actions for a student in an instructor managed topic', function() { 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}); verifyActions(teamsView, {showActions: false});
}); });
it('shows actions for a privileged user already in a team', function() { it('shows actions for a privileged user already in a team', function() {
var teamsView = createTopicTeamsView({privileged: true}); var options = {
verifyActions(teamsView); 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() { it('shows actions for a staff user already in a team', function() {
var teamsView = createTopicTeamsView({privileged: false, staff: true}); var options = {
verifyActions(teamsView); userInfo: {
privileged: false,
staff: true
},
myTeamsCollection: TeamSpecHelpers.createMockTeams()
};
var teamsView = createTopicTeamsView(options);
verifyActions(teamsView, {showActions: true});
}); });
/* /*
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
// that they create. This means that if multiple team membership is // that they create. This means that if multiple team membership is
// disabled that they cannot create a new team when they already // disabled that they cannot create a new team when they already
// belong to one. // belong to one.
return this.context.staff return this.context.userInfo.staff
|| this.context.privileged || this.context.userInfo.privileged
|| (!TeamUtils.isInstructorManagedTopic(this.model.attributes.type) || (!TeamUtils.isInstructorManagedTopic(this.model.attributes.type)
&& this.myTeamsCollection.length === 0); && 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