Commit 4fc2ae7c by Christina Roberts

Merge pull request #9312 from edx/diana/remove-invite-link

Remove invite link functionality from teams.
parents ec916a31 afa587cc
......@@ -290,11 +290,6 @@ class TeamPage(CoursePage, PaginatedUIMixin):
self.wait_for_ajax()
@property
def team_invite_section_present(self):
"""Verifies that invite section is present"""
return self.q(css='.page-content-secondary .invite-team').present
@property
def team_members(self):
"""Returns the number of team members in this team"""
return len(self.q(css='.page-content-secondary .team-member'))
......@@ -308,16 +303,6 @@ class TeamPage(CoursePage, PaginatedUIMixin):
"""Returns the username of team member"""
return self.q(css='.page-content-secondary .tooltip-custom').text[0]
@property
def team_invite_help_text(self):
"""Returns the team invite help text"""
return self.q(css='.page-content-secondary .invite-text').text[0]
@property
def team_invite_url(self):
"""Returns the url of invite link box"""
return self.q(css='.page-content-secondary .invite-link-input').attrs('value')[0]
def click_join_team_button(self):
""" Click on Join Team button"""
self.q(css='.join-team .action-primary').first.click()
......
......@@ -871,7 +871,7 @@ class TeamPageTest(TeamsTabBase):
self.setup_discussion_user(role=role)
self.verify_teams_discussion_permissions(True)
def assert_team_details(self, num_members, is_member=True, max_size=10, invite_text=''):
def assert_team_details(self, num_members, is_member=True, max_size=10):
"""
Verifies that user can see all the information, present on detail page according to their membership status.
......@@ -879,7 +879,6 @@ class TeamPageTest(TeamsTabBase):
num_members (int): number of users in a team
is_member (bool) default True: True if request user is member else False
max_size (int): number of users a team can have
invite_text (str): help text for invite link.
"""
self.assertEqual(
self.team_page.team_capacity_text,
......@@ -901,13 +900,10 @@ class TeamPageTest(TeamsTabBase):
if is_member:
self.assertEqual(self.team_page.team_user_membership_text, 'You are a member of this team.')
self.assertTrue(self.team_page.team_leave_link_present)
self.assertTrue(self.team_page.team_invite_section_present)
self.assertEqual(self.team_page.team_invite_help_text, invite_text)
self.assertTrue(self.team_page.new_post_button_present)
else:
self.assertEqual(self.team_page.team_user_membership_text, '')
self.assertFalse(self.team_page.team_leave_link_present)
self.assertFalse(self.team_page.team_invite_section_present)
self.assertFalse(self.team_page.new_post_button_present)
def test_team_member_can_see_full_team_details(self):
......@@ -927,7 +923,6 @@ class TeamPageTest(TeamsTabBase):
self.assert_team_details(
num_members=1,
invite_text=self.SEND_INVITE_TEXT
)
def test_other_users_can_see_limited_team_details(self):
......@@ -967,42 +962,6 @@ class TeamPageTest(TeamsTabBase):
learner_profile_page.wait_for_field('username')
self.assertTrue(learner_profile_page.field_is_visible('username'))
def test_team_member_cannot_see_invite_link_if_team_full(self):
"""
Scenario: Team members should not see the invite link if the team is full.
Given I am enrolled in a course with a team configuration, a topic,
and a team belonging to that topic of which I am a member
When I visit the Team page for that team
Then I should see the "team is full" message
And I should not see the invite link
"""
self._set_team_configuration_and_membership(max_team_size=1)
self.team_page.visit()
self.assert_team_details(
num_members=1,
max_size=1,
invite_text='No invitations are available. This team is full.'
)
def test_team_member_can_see_invite_link(self):
"""
Scenario: Team members should see the invite link if the team has capacity.
Given I am enrolled in a course with a team configuration, a topic,
and a team belonging to that topic of which I am a member
When I visit the Team page for that team
Then I should see the invite link help message
And I should see the invite link that can be selected
"""
self._set_team_configuration_and_membership()
self.team_page.visit()
self.assert_team_details(
num_members=1,
invite_text=self.SEND_INVITE_TEXT
)
self.assertEqual(self.team_page.team_invite_url, '{0}?invite=true'.format(self.team_page.url))
def test_join_team(self):
"""
Scenario: User can join a Team if not a member already..
......@@ -1023,7 +982,7 @@ class TeamPageTest(TeamsTabBase):
self.team_page.click_join_team_button()
self.assertFalse(self.team_page.join_team_button_present)
self.assertFalse(self.team_page.join_team_message_present)
self.assert_team_details(num_members=1, is_member=True, invite_text=self.SEND_INVITE_TEXT)
self.assert_team_details(num_members=1, is_member=True)
def test_already_member_message(self):
"""
......@@ -1082,7 +1041,7 @@ class TeamPageTest(TeamsTabBase):
self._set_team_configuration_and_membership()
self.team_page.visit()
self.assertFalse(self.team_page.join_team_button_present)
self.assert_team_details(num_members=1, invite_text=self.SEND_INVITE_TEXT)
self.assert_team_details(num_members=1)
self.team_page.click_leave_team_link()
self.assert_team_details(num_members=0, is_member=False)
self.assertTrue(self.team_page.join_team_button_present)
......@@ -119,10 +119,6 @@ define([
assertTeamDetails(view, 0, false);
expect(view.$('.team-user-membership-status').length).toBe(0);
// Verify that invite and leave team sections are not present.
expect(view.$('.leave-team').length).toBe(0);
expect(view.$('.invite-team').length).toBe(0);
});
it('cannot see the country & language if empty', function() {
var requests = AjaxHelpers.requests(this);
......@@ -149,65 +145,6 @@ define([
// assert user profile page url.
expect(view.$('.member-profile').attr('href')).toBe('/u/bilbo');
//Verify that invite and leave team sections are present
expect(view.$('.leave-team-link').text()).toContain('Leave Team');
expect(view.$('.invite-header').text()).toContain('Invite Others');
expect(view.$('.invite-text').text()).toContain('Send this link to friends so that they can join too.');
expect(view.$('.invite-link-input').length).toBe(1);
});
it('cannot see invite url box if team is full', function() {
var requests = AjaxHelpers.requests(this);
var view = createTeamProfileView(requests , {
country: 'US',
language: 'en',
membership: [{
'user': {
'username': 'bilbo',
'profile_image': {
'has_image': true,
'image_url_medium': '/image-url'
}
}
},
{
'user': {
'username': 'bilbo1',
'profile_image': {
'has_image': true,
'image_url_medium': '/image-url'
}
}
},
{
'user': {
'username': 'bilbo2',
'profile_image': {
'has_image': true,
'image_url_medium': '/image-url'
}
}
}]
});
assertTeamDetails(view, 3, true);
expect(view.$('.invite-header').text()).toContain('Invite Others');
expect(view.$('.invite-text').text()).toContain('No invitations are available. This team is full.');
expect(view.$('.invite-link-input').length).toBe(0);
});
it('can see & select invite url if team has capacity', function() {
var requests = AjaxHelpers.requests(this);
spyOn(TeamProfileView.prototype, 'selectText');
var view = createTeamProfileView(
requests, {country: 'US', language: 'en', membership: DEFAULT_MEMBERSHIP}
);
assertTeamDetails(view, 1, true);
expect(view.$('.invite-link-input').length).toBe(1);
view.$('.invite-link-input').click();
expect(view.selectText).toHaveBeenCalled();
});
it('can leave team successfully', function() {
var requests = AjaxHelpers.requests(this);
......
......@@ -13,7 +13,6 @@
errorMessage: gettext("An error occurred. Try again."),
events: {
'click .invite-link-input': 'selectText',
'click .leave-team-link': 'leaveTeam'
},
initialize: function (options) {
......@@ -22,7 +21,6 @@
this.maxTeamSize = options.maxTeamSize;
this.requestUsername = options.requestUsername;
this.isPrivileged = options.isPrivileged;
this.teamInviteUrl = options.teamInviteUrl;
this.teamMembershipDetailUrl = options.teamMembershipDetailUrl;
this.countries = TeamUtils.selectorOptionsArrayToHashWithBlank(options.countries);
......@@ -44,7 +42,6 @@
membershipText: TeamUtils.teamCapacityText(memberships.length, this.maxTeamSize),
isMember: isMember,
hasCapacity: memberships.length < this.maxTeamSize,
inviteLink: this.teamInviteUrl
}));
this.discussionView = new TeamDiscussionView({
......
......@@ -285,7 +285,6 @@
requestUsername: self.userInfo.username,
countries: self.countries,
languages: self.languages,
teamInviteUrl: self.teamsBaseUrl + '#teams/' + topicID + '/' + teamID + '?invite=true',
teamMembershipDetailUrl: self.teamMembershipDetailUrl
});
var teamJoinView = new TeamJoinView(
......
......@@ -53,19 +53,6 @@
<div class="divider-lv1"></div>
<div class="invite-team">
<h4 class="invite-header"><%- gettext("Invite Others") %></h4>
<% if (hasCapacity) { %>
<input type="text" class="invite-link-input" value="<%= inviteLink %>" aria-describedby="invite-text" readonly >
<span class="invite-text" id="invite-text">
<%- gettext("Send this link to friends so that they can join too.") %>
</span>
<% } else { %>
<span class="invite-text">
<%- gettext("No invitations are available. This team is full.") %>
</span>
<% } %>
</div>
<% } %>
</div>
</div>
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