Commit 0ce2e9bb authored by Manoj M J's avatar Manoj M J

Use ProjectRecalculateWorker to refresh authorization on project create

Replace `ProjectCreateWorker ` with
`ProjectRecalculateWorker ` to refresh
authorizations upon project creation
parent c1ef75cb
...@@ -136,7 +136,7 @@ module Projects ...@@ -136,7 +136,7 @@ module Projects
access_level: group_access_level) access_level: group_access_level)
end end
AuthorizedProjectUpdate::ProjectCreateWorker.perform_async(@project.id) AuthorizedProjectUpdate::ProjectRecalculateWorker.perform_async(@project.id)
# AuthorizedProjectsWorker uses an exclusive lease per user but # AuthorizedProjectsWorker uses an exclusive lease per user but
# specialized workers might have synchronization issues. Until we # specialized workers might have synchronization issues. Until we
# compare the inconsistency rates of both approaches, we still run # compare the inconsistency rates of both approaches, we still run
......
...@@ -810,11 +810,11 @@ RSpec.describe Projects::CreateService, '#execute' do ...@@ -810,11 +810,11 @@ RSpec.describe Projects::CreateService, '#execute' do
).to be_truthy ).to be_truthy
end end
it 'schedules authorization update for users with access to group' do it 'schedules authorization update for users with access to group', :sidekiq_inline do
expect(AuthorizedProjectsWorker).not_to( expect(AuthorizedProjectsWorker).not_to(
receive(:bulk_perform_async) receive(:bulk_perform_async)
) )
expect(AuthorizedProjectUpdate::ProjectCreateWorker).to( expect(AuthorizedProjectUpdate::ProjectRecalculateWorker).to(
receive(:perform_async).and_call_original receive(:perform_async).and_call_original
) )
expect(AuthorizedProjectUpdate::UserRefreshFromReplicaWorker).to( expect(AuthorizedProjectUpdate::UserRefreshFromReplicaWorker).to(
...@@ -825,7 +825,11 @@ RSpec.describe Projects::CreateService, '#execute' do ...@@ -825,7 +825,11 @@ RSpec.describe Projects::CreateService, '#execute' do
.and_call_original .and_call_original
) )
create_project(user, opts) project = create_project(user, opts)
expect(
Ability.allowed?(other_user, :developer_access, project)
).to be_truthy
end end
end end
......
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