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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-03 21:08:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-03 21:08:55 +0300
commit8f9307985ea047abb5b8a7c6c56bb644e0b7c363 (patch)
tree474c91c280b903c345bd94f4842abf481c535656 /lib/gitlab/background_migration
parent3cda3d43aef1e92e2eedf7383122c6db9c61149f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/background_migration')
-rw-r--r--lib/gitlab/background_migration/sanitize_confidential_todos.rb37
1 files changed, 4 insertions, 33 deletions
diff --git a/lib/gitlab/background_migration/sanitize_confidential_todos.rb b/lib/gitlab/background_migration/sanitize_confidential_todos.rb
index 2df0b8a4d93..8215e92cbeb 100644
--- a/lib/gitlab/background_migration/sanitize_confidential_todos.rb
+++ b/lib/gitlab/background_migration/sanitize_confidential_todos.rb
@@ -10,43 +10,14 @@ module Gitlab
# to extract all related logic.
# Details in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87908#note_952459215
class SanitizeConfidentialTodos < BatchedMigrationJob
- scope_to ->(relation) { relation.where(confidential: true) }
-
operation_name :delete_invalid_todos
feature_category :database
def perform
- each_sub_batch do |sub_batch|
- delete_ids = invalid_todo_ids(sub_batch)
-
- Todo.where(id: delete_ids).delete_all if delete_ids.present?
- end
- end
-
- private
-
- def invalid_todo_ids(notes_batch)
- todos = Todo.where(note_id: notes_batch.select(:id)).includes(:note, :user)
-
- todos.each_with_object([]) do |todo, ids|
- ids << todo.id if invalid_todo?(todo)
- end
- end
-
- def invalid_todo?(todo)
- return false unless todo.note
- return false if Ability.allowed?(todo.user, :read_todo, todo)
-
- logger.info(
- message: "#{self.class.name} deleting invalid todo",
- attributes: todo.attributes
- )
-
- true
- end
-
- def logger
- @logger ||= Gitlab::BackgroundMigration::Logger.build
+ # no-op: this BG migration is left here only for compatibility reasons,
+ # but it's not scheduled from any migration anymore.
+ # It was a temporary migration which used not-isolated code.
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/382557
end
end
end