diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-01-14 22:53:37 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2019-01-31 16:52:49 +0100 |
commit | 4d7fa59af27409813cc72312b9b2a47da512b5ed (patch) | |
tree | 678c7f26b02c6375b0f470473fbffd9237c9e615 /spec/models/project_team_spec.rb | |
parent | 1658f5b62e34b6ed6c7b4c6569bc4a849096af23 (diff) | |
download | gitlab-ce-4d7fa59af27409813cc72312b9b2a47da512b5ed.tar.gz |
Sent notification only to authorized users
When moving a project, it's possible that some users who had
access to the project in old path can not access the project
in the new path.
Because `project_authorizations` records are updated asynchronously,
when we send the notification about moved project the list of project
team members contains old project members, we want to notify all these
members except the old users who can not access the new location.
Diffstat (limited to 'spec/models/project_team_spec.rb')
-rw-r--r-- | spec/models/project_team_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/project_team_spec.rb b/spec/models/project_team_spec.rb index c4af17f4726..3537dead5d1 100644 --- a/spec/models/project_team_spec.rb +++ b/spec/models/project_team_spec.rb @@ -178,6 +178,21 @@ describe ProjectTeam do end end + describe '#members_in_project_and_ancestors' do + context 'group project' do + it 'filters out users who are not members of the project' do + group = create(:group) + project = create(:project, group: group) + group_member = create(:group_member, group: group) + old_user = create(:user) + + ProjectAuthorization.create!(project: project, user: old_user, access_level: Gitlab::Access::GUEST) + + expect(project.team.members_in_project_and_ancestors).to contain_exactly(group_member.user) + end + end + end + describe "#human_max_access" do it 'returns Maintainer role' do user = create(:user) |