diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-23 15:08:41 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-23 15:08:41 +0000 |
commit | 5eeb39104356356bec81abe19479bca591e6f299 (patch) | |
tree | 7534ccf94fb8100ce39b78278d275b2061773f95 /app/workers | |
parent | b7e512c8970dcce6feabc096885c7a1ea91e4694 (diff) | |
download | gitlab-ce-5eeb39104356356bec81abe19479bca591e6f299.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/all_queues.yml | 8 | ||||
-rw-r--r-- | app/workers/members_destroyer/unassign_issuables_worker.rb | 32 |
2 files changed, 40 insertions, 0 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 8750223e2bf..2053a60fc23 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -1115,6 +1115,14 @@ :weight: 1 :idempotent: :tags: [] +- :name: unassign_issuables:members_destroyer_unassign_issuables + :feature_category: :authentication_and_authorization + :has_external_dependencies: + :urgency: :low + :resource_boundary: :unknown + :weight: 1 + :idempotent: true + :tags: [] - :name: update_namespace_statistics:namespaces_root_statistics :feature_category: :source_code_management :has_external_dependencies: diff --git a/app/workers/members_destroyer/unassign_issuables_worker.rb b/app/workers/members_destroyer/unassign_issuables_worker.rb new file mode 100644 index 00000000000..2c17120bf48 --- /dev/null +++ b/app/workers/members_destroyer/unassign_issuables_worker.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module MembersDestroyer + class UnassignIssuablesWorker + include ApplicationWorker + + ENTITY_TYPES = %w(Group Project).freeze + + queue_namespace :unassign_issuables + feature_category :authentication_and_authorization + + idempotent! + + def perform(user_id, entity_id, entity_type) + unless ENTITY_TYPES.include?(entity_type) + logger.error( + message: "#{entity_type} is not a supported entity.", + entity_type: entity_type, + entity_id: entity_id, + user_id: user_id + ) + + return + end + + user = User.find(user_id) + entity = entity_type.constantize.find(entity_id) + + ::Members::UnassignIssuablesService.new(user, entity).execute + end + end +end |