Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2019-01-15 00:53:37 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2019-01-31 18:52:49 +0300
commit4d7fa59af27409813cc72312b9b2a47da512b5ed (patch)
tree678c7f26b02c6375b0f470473fbffd9237c9e615 /spec/models/project_team_spec.rb
parent1658f5b62e34b6ed6c7b4c6569bc4a849096af23 (diff)
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.rb15
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)