Commit 04d3cb98 by Daniel Friedman

Merge pull request #9303 from edx/usman/tnl3053-fetch-memberships

Also pass course_id when fetching memberships for user in team profile view.
parents 7d0c9459 08498bc2
define([
'underscore', 'common/js/spec_helpers/ajax_helpers', 'teams/js/models/team',
'teams/js/spec_helpers/team_spec_helpers',
'teams/js/views/team_join'
], function (_, AjaxHelpers, TeamModel, TeamJoinView) {
], function (_, AjaxHelpers, TeamModel, TeamSpecHelpers, TeamJoinView) {
'use strict';
describe('TeamJoinView', function () {
var createTeamsUrl,
......@@ -61,6 +62,7 @@ define([
var teamJoinView = new TeamJoinView(
{
courseID: TeamSpecHelpers.testCourseID,
model: model,
teamsUrl: createTeamsUrl(teamId),
maxTeamSize: maxTeamSize,
......@@ -91,7 +93,9 @@ define([
AjaxHelpers.expectRequest(
requests,
'GET',
TEAMS_MEMBERSHIP_URL + '?' + $.param({"username": currentUsername})
TEAMS_MEMBERSHIP_URL + '?' + $.param({
'username': currentUsername, 'course_id': TeamSpecHelpers.testCourseID
})
);
// current user is not a member of any team so we should see the Join Team button
......@@ -134,7 +138,9 @@ define([
AjaxHelpers.expectRequest(
requests,
'GET',
TEAMS_MEMBERSHIP_URL + '?' + $.param({"username": currentUsername})
TEAMS_MEMBERSHIP_URL + '?' + $.param({
'username': currentUsername, 'course_id': TeamSpecHelpers.testCourseID
})
);
// current user is a member of another team so we should see the correct message
......
......@@ -19,6 +19,7 @@ define(['backbone',
initialize: function(options) {
this.template = _.template(teamJoinTemplate);
this.courseID = options.courseID;
this.maxTeamSize = options.maxTeamSize;
this.currentUsername = options.currentUsername;
this.teamMembershipsUrl = options.teamMembershipsUrl;
......@@ -85,7 +86,7 @@ define(['backbone',
$.ajax({
type: 'GET',
url: view.teamMembershipsUrl,
data: {'username': username}
data: {'username': username, 'course_id': view.courseID}
}).done(function (data) {
info.alreadyMember = (data.count > 0);
info.memberOfCurrentTeam = false;
......
......@@ -289,6 +289,7 @@
});
var teamJoinView = new TeamJoinView(
{
courseID: courseID,
model: team,
teamsUrl: self.teamsUrl,
maxTeamSize: self.maxTeamSize,
......
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