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:
Diffstat (limited to 'lib/gitlab/background_migration/user_mentions/lib')
-rw-r--r--lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser.rb25
-rw-r--r--lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser/isolated_mentioned_group_parser.rb25
-rw-r--r--lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser/isolated_mentioned_project_parser.rb25
-rw-r--r--lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser/isolated_mentioned_user_parser.rb25
-rw-r--r--lib/gitlab/background_migration/user_mentions/lib/gitlab/isolated_reference_extractor.rb30
-rw-r--r--lib/gitlab/background_migration/user_mentions/lib/gitlab/isolated_visibility_level.rb60
6 files changed, 0 insertions, 190 deletions
diff --git a/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser.rb b/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser.rb
deleted file mode 100644
index 3def5eb3369..00000000000
--- a/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module BackgroundMigration
- module UserMentions
- module Lib
- module Banzai
- # isolated Banzai::ReferenceParser
- module ReferenceParser
- # Returns the reference parser class for the given type
- #
- # Example:
- #
- # Banzai::ReferenceParser['isolated_mentioned_group']
- #
- # This would return the `::Gitlab::BackgroundMigration::UserMentions::Lib::Banzai::ReferenceParser::IsolatedMentionedGroupParser` class.
- def self.[](name)
- const_get("::Gitlab::BackgroundMigration::UserMentions::Lib::Banzai::ReferenceParser::#{name.to_s.camelize}Parser", false)
- end
- end
- end
- end
- end
- end
-end
diff --git a/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser/isolated_mentioned_group_parser.rb b/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser/isolated_mentioned_group_parser.rb
deleted file mode 100644
index d3d032ba433..00000000000
--- a/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser/isolated_mentioned_group_parser.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module BackgroundMigration
- module UserMentions
- module Lib
- module Banzai
- module ReferenceParser
- # isolated Banzai::ReferenceParser::MentionedGroupParser
- class IsolatedMentionedGroupParser < ::Banzai::ReferenceParser::MentionedGroupParser
- extend ::Gitlab::Utils::Override
-
- self.reference_type = :user
-
- override :references_relation
- def references_relation
- ::Gitlab::BackgroundMigration::UserMentions::Models::Group
- end
- end
- end
- end
- end
- end
- end
-end
diff --git a/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser/isolated_mentioned_project_parser.rb b/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser/isolated_mentioned_project_parser.rb
deleted file mode 100644
index 5930d65bc2c..00000000000
--- a/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser/isolated_mentioned_project_parser.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module BackgroundMigration
- module UserMentions
- module Lib
- module Banzai
- module ReferenceParser
- # isolated Banzai::ReferenceParser::MentionedGroupParser
- class IsolatedMentionedProjectParser < ::Banzai::ReferenceParser::MentionedProjectParser
- extend ::Gitlab::Utils::Override
-
- self.reference_type = :user
-
- override :references_relation
- def references_relation
- ::Gitlab::BackgroundMigration::UserMentions::Models::Project
- end
- end
- end
- end
- end
- end
- end
-end
diff --git a/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser/isolated_mentioned_user_parser.rb b/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser/isolated_mentioned_user_parser.rb
deleted file mode 100644
index f5f98517433..00000000000
--- a/lib/gitlab/background_migration/user_mentions/lib/banzai/reference_parser/isolated_mentioned_user_parser.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module BackgroundMigration
- module UserMentions
- module Lib
- module Banzai
- module ReferenceParser
- # isolated Banzai::ReferenceParser::MentionedGroupParser
- class IsolatedMentionedUserParser < ::Banzai::ReferenceParser::MentionedUserParser
- extend ::Gitlab::Utils::Override
-
- self.reference_type = :user
-
- override :references_relation
- def references_relation
- ::Gitlab::BackgroundMigration::UserMentions::Models::User
- end
- end
- end
- end
- end
- end
- end
-end
diff --git a/lib/gitlab/background_migration/user_mentions/lib/gitlab/isolated_reference_extractor.rb b/lib/gitlab/background_migration/user_mentions/lib/gitlab/isolated_reference_extractor.rb
deleted file mode 100644
index 8610129533d..00000000000
--- a/lib/gitlab/background_migration/user_mentions/lib/gitlab/isolated_reference_extractor.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module BackgroundMigration
- module UserMentions
- module Lib
- module Gitlab
- # Extract possible GFM references from an arbitrary String for further processing.
- class IsolatedReferenceExtractor < ::Gitlab::ReferenceExtractor
- REFERABLES = %i(isolated_mentioned_group isolated_mentioned_user isolated_mentioned_project).freeze
-
- REFERABLES.each do |type|
- define_method("#{type}s") do
- @references[type] ||= isolated_references(type)
- end
- end
-
- def isolated_references(type)
- context = ::Banzai::RenderContext.new(project, current_user)
- processor = ::Gitlab::BackgroundMigration::UserMentions::Lib::Banzai::ReferenceParser[type].new(context)
-
- refs = processor.process(html_documents)
- refs[:visible]
- end
- end
- end
- end
- end
- end
-end
diff --git a/lib/gitlab/background_migration/user_mentions/lib/gitlab/isolated_visibility_level.rb b/lib/gitlab/background_migration/user_mentions/lib/gitlab/isolated_visibility_level.rb
deleted file mode 100644
index 0334ea1dd08..00000000000
--- a/lib/gitlab/background_migration/user_mentions/lib/gitlab/isolated_visibility_level.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module BackgroundMigration
- module UserMentions
- module Lib
- module Gitlab
- # Gitlab::IsolatedVisibilityLevel module
- #
- # Define allowed public modes that can be used for
- # GitLab projects to determine project public mode
- #
- module IsolatedVisibilityLevel
- extend ::ActiveSupport::Concern
-
- included do
- scope :public_to_user, -> (user = nil) do
- where(visibility_level: IsolatedVisibilityLevel.levels_for_user(user))
- end
- end
-
- PRIVATE = 0 unless const_defined?(:PRIVATE)
- INTERNAL = 10 unless const_defined?(:INTERNAL)
- PUBLIC = 20 unless const_defined?(:PUBLIC)
-
- class << self
- def levels_for_user(user = nil)
- return [PUBLIC] unless user
-
- if user.can_read_all_resources?
- [PRIVATE, INTERNAL, PUBLIC]
- elsif user.external?
- [PUBLIC]
- else
- [INTERNAL, PUBLIC]
- end
- end
- end
-
- def private?
- visibility_level_value == PRIVATE
- end
-
- def internal?
- visibility_level_value == INTERNAL
- end
-
- def public?
- visibility_level_value == PUBLIC
- end
-
- def visibility_level_value
- self[visibility_level_field]
- end
- end
- end
- end
- end
- end
-end