diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-25 06:11:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-25 06:11:41 +0300 |
commit | 48a0a54a619b86f9b8664c76a9776068507b7d0e (patch) | |
tree | 887e314dcb24703431589bb27f992671bdc60e0f /app | |
parent | 9453027136630bf0bfcde55dafdcdd6830877649 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/page_bundles/merge_requests.scss | 4 | ||||
-rw-r--r-- | app/finders/environments/environments_finder.rb | 2 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 1 | ||||
-rw-r--r-- | app/models/environment.rb | 1 | ||||
-rw-r--r-- | app/services/environments/schedule_to_delete_review_apps_service.rb | 2 | ||||
-rw-r--r-- | app/services/members/destroy_service.rb | 4 | ||||
-rw-r--r-- | app/uploaders/object_storage.rb | 15 | ||||
-rw-r--r-- | app/workers/all_queues.yml | 9 | ||||
-rw-r--r-- | app/workers/object_storage/background_move_worker.rb | 48 |
9 files changed, 10 insertions, 76 deletions
diff --git a/app/assets/stylesheets/page_bundles/merge_requests.scss b/app/assets/stylesheets/page_bundles/merge_requests.scss index 03b28f28c8d..b4ede515a7c 100644 --- a/app/assets/stylesheets/page_bundles/merge_requests.scss +++ b/app/assets/stylesheets/page_bundles/merge_requests.scss @@ -1080,6 +1080,10 @@ $tabs-holder-z-index: 250; } .merge-request-notification-toggle { + .gl-toggle { + @include gl-ml-auto; + } + .gl-toggle-label { @include gl-font-weight-normal; } diff --git a/app/finders/environments/environments_finder.rb b/app/finders/environments/environments_finder.rb index 011a317a349..85cd37c267e 100644 --- a/app/finders/environments/environments_finder.rb +++ b/app/finders/environments/environments_finder.rb @@ -63,7 +63,7 @@ module Environments def by_ids(environments) if params[:environment_ids].present? - environments.for_id(params[:environment_ids]) + environments.id_in(params[:environment_ids]) else environments end diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 020f5cf9d8e..1f147266fee 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -350,7 +350,6 @@ module Ci scope :for_sha_or_source_sha, -> (sha) { for_sha(sha).or(for_source_sha(sha)) } scope :for_ref, -> (ref) { where(ref: ref) } scope :for_branch, -> (branch) { for_ref(branch).where(tag: false) } - scope :for_id, -> (id) { where(id: id) } scope :for_iid, -> (iid) { where(iid: iid) } scope :for_project, -> (project_id) { where(project_id: project_id) } scope :created_after, -> (time) { where(arel_table[:created_at].gt(time)) } diff --git a/app/models/environment.rb b/app/models/environment.rb index b4586bfbca8..10e0bc91566 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -117,7 +117,6 @@ class Environment < ApplicationRecord scope :with_rank, -> do select('environments.*, rank() OVER (PARTITION BY project_id ORDER BY id DESC)') end - scope :for_id, -> (id) { where(id: id) } scope :with_deployment, -> (sha, status: nil) do deployments = Deployment.select(1).where('deployments.environment_id = environments.id').where(sha: sha) diff --git a/app/services/environments/schedule_to_delete_review_apps_service.rb b/app/services/environments/schedule_to_delete_review_apps_service.rb index 041b834f11b..8e9fe3300c4 100644 --- a/app/services/environments/schedule_to_delete_review_apps_service.rb +++ b/app/services/environments/schedule_to_delete_review_apps_service.rb @@ -68,7 +68,7 @@ module Environments end def mark_for_deletion(deletable_environments) - Environment.for_id(deletable_environments).schedule_to_delete + Environment.id_in(deletable_environments).schedule_to_delete end class Result diff --git a/app/services/members/destroy_service.rb b/app/services/members/destroy_service.rb index f18269454e3..5afc13701e0 100644 --- a/app/services/members/destroy_service.rb +++ b/app/services/members/destroy_service.rb @@ -15,15 +15,15 @@ module Members @skip_auth = skip_authorization last_owner = true - in_lock("delete_members:#{member.source.class}:#{member.source.id}") do + in_lock("delete_members:#{member.source.class}:#{member.source.id}", sleep_sec: 0.1.seconds) do break if member.is_a?(GroupMember) && member.source.last_owner?(member.user) last_owner = false member.destroy - member.user&.invalidate_cache_counts end unless last_owner + member.user&.invalidate_cache_counts delete_member_associations(member, skip_subresources, unassign_issuables) end diff --git a/app/uploaders/object_storage.rb b/app/uploaders/object_storage.rb index 063aca7937c..ac764b219b1 100644 --- a/app/uploaders/object_storage.rb +++ b/app/uploaders/object_storage.rb @@ -68,13 +68,7 @@ module ObjectStorage end def schedule_background_upload(*args) - return unless schedule_background_upload? - return unless upload - - ObjectStorage::BackgroundMoveWorker.perform_async(self.class.name, - upload.class.to_s, - mounted_as, - upload.id) + # TODO remove this method https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/1690 end def exclusive_lease_key @@ -312,12 +306,7 @@ module ObjectStorage end def schedule_background_upload(*args) - return unless schedule_background_upload? - - ObjectStorage::BackgroundMoveWorker.perform_async(self.class.name, - model.class.name, - mounted_as, - model.id) + # TODO remove this method https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/1690 end def fog_directory diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index b9168a65764..1b1b68320bc 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -1560,15 +1560,6 @@ :weight: 1 :idempotent: false :tags: [] -- :name: object_storage:object_storage_background_move - :worker_name: ObjectStorage::BackgroundMoveWorker - :feature_category: :not_owned - :has_external_dependencies: false - :urgency: :low - :resource_boundary: :unknown - :weight: 1 - :idempotent: false - :tags: [] - :name: object_storage:object_storage_migrate_uploads :worker_name: ObjectStorage::MigrateUploadsWorker :feature_category: :not_owned diff --git a/app/workers/object_storage/background_move_worker.rb b/app/workers/object_storage/background_move_worker.rb deleted file mode 100644 index 8b4c97e9a06..00000000000 --- a/app/workers/object_storage/background_move_worker.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -module ObjectStorage - class BackgroundMoveWorker # rubocop:disable Scalability/IdempotentWorker - include ApplicationWorker - - data_consistency :always - include ObjectStorageQueue - - sidekiq_options retry: 5 - feature_category :not_owned # rubocop:todo Gitlab/AvoidFeatureCategoryNotOwned - loggable_arguments 0, 1, 2, 3 - - def perform(uploader_class_name, subject_class_name, file_field, subject_id) - uploader_class = uploader_class_name.constantize - subject_class = subject_class_name.constantize - mount_point = file_field&.to_sym - - return unless uploader_class < ObjectStorage::Concern - return unless uploader_class.object_store_enabled? - return unless uploader_class.background_upload_enabled? - - unless valid_mount_point?(subject_class, uploader_class, mount_point) - raise(ArgumentError, "#{mount_point} not allowed for #{subject_class} in #{self.class.name}") - end - - subject = subject_class.find(subject_id) - uploader = build_uploader(subject, mount_point) - uploader.migrate!(ObjectStorage::Store::REMOTE) - end - - def build_uploader(subject, mount_point) - case subject - when Upload then subject.retrieve_uploader(mount_point) - else - # This is safe because: - # 1. We don't pass any arguments to the method. - # 2. valid_mount_point? checks that this is in fact an uploader of the correct class. - # - subject.public_send(mount_point) # rubocop:disable GitlabSecurity/PublicSend - end - end - - def valid_mount_point?(subject_class, uploader_class, mount_point) - subject_class == Upload || subject_class.uploaders[mount_point] == uploader_class - end - end -end |