Commit 7ecc247a authored by Brett Walker's avatar Brett Walker

Adjust class names to new references dir

for reference filters
parent dceae94f
......@@ -3,6 +3,7 @@
module EE
module Banzai
module Filter
module References
module AbstractReferenceFilter
extend ::Gitlab::Utils::Override
......@@ -13,4 +14,5 @@ module EE
end
end
end
end
end
......@@ -3,6 +3,7 @@
module EE
module Banzai
module Filter
module References
# HTML filter that replaces epic references with links. References to
# epics that do not exist are ignored.
#
......@@ -52,4 +53,5 @@ module EE
end
end
end
end
end
......@@ -3,6 +3,7 @@
module EE
module Banzai
module Filter
module References
# HTML filter that replaces iteration references with links.
module IterationReferenceFilter
include ::Gitlab::Utils::StrongMemoize
......@@ -41,7 +42,7 @@ module EE
if iteration
iterations[iteration.id] = yield match, iteration.id, $~[:project], $~[:namespace], $~
"#{::Banzai::Filter::AbstractReferenceFilter::REFERENCE_PLACEHOLDER}#{iteration.id}"
"#{::Banzai::Filter::References::AbstractReferenceFilter::REFERENCE_PLACEHOLDER}#{iteration.id}"
else
match
end
......@@ -114,4 +115,5 @@ module EE
end
end
end
end
end
......@@ -3,6 +3,7 @@
module EE
module Banzai
module Filter
module References
module LabelReferenceFilter
extend ::Gitlab::Utils::Override
......@@ -25,4 +26,5 @@ module EE
end
end
end
end
end
......@@ -3,6 +3,7 @@
module EE
module Banzai
module Filter
module References
# HTML filter that replaces vulnerability references with links. References to
# vulnerabilities that do not exist are ignored.
#
......@@ -62,4 +63,5 @@ module EE
end
end
end
end
end
......@@ -16,9 +16,9 @@ module EE
def reference_filters
[
::Banzai::Filter::EpicReferenceFilter,
::Banzai::Filter::IterationReferenceFilter,
::Banzai::Filter::VulnerabilityReferenceFilter,
::Banzai::Filter::References::EpicReferenceFilter,
::Banzai::Filter::References::IterationReferenceFilter,
::Banzai::Filter::References::VulnerabilityReferenceFilter,
*super
]
end
......
......@@ -9,9 +9,9 @@ module EE
class_methods do
def reference_filters
[
::Banzai::Filter::EpicReferenceFilter,
::Banzai::Filter::IterationReferenceFilter,
::Banzai::Filter::VulnerabilityReferenceFilter,
::Banzai::Filter::References::EpicReferenceFilter,
::Banzai::Filter::References::IterationReferenceFilter,
::Banzai::Filter::References::VulnerabilityReferenceFilter,
*super
]
end
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::EpicReferenceFilter do
RSpec.describe Banzai::Filter::References::EpicReferenceFilter do
include FilterSpecHelper
let(:urls) { Gitlab::Routing.url_helpers }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::IterationReferenceFilter do
RSpec.describe Banzai::Filter::References::IterationReferenceFilter do
include FilterSpecHelper
let(:parent_group) { create(:group, :public) }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::LabelReferenceFilter do
RSpec.describe Banzai::Filter::References::LabelReferenceFilter do
include FilterSpecHelper
let(:project) { create(:project, :public, name: 'sample-project') }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::VulnerabilityReferenceFilter do
RSpec.describe Banzai::Filter::References::VulnerabilityReferenceFilter do
include FilterSpecHelper
let(:urls) { Gitlab::Routing.url_helpers }
......
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# Issues, merge requests, Snippets, Commits and Commit Ranges share
# similar functionality in reference filtering.
class AbstractReferenceFilter < ReferenceFilter
......@@ -441,6 +442,7 @@ module Banzai
end
end
end
end
end
Banzai::Filter::AbstractReferenceFilter.prepend_if_ee('EE::Banzai::Filter::AbstractReferenceFilter')
Banzai::Filter::References::AbstractReferenceFilter.prepend_if_ee('EE::Banzai::Filter::References::AbstractReferenceFilter')
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
class AlertReferenceFilter < IssuableReferenceFilter
self.reference_type = :alert
......@@ -26,4 +27,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# HTML filter that replaces commit range references with links.
#
# This filter supports cross-project references.
......@@ -43,4 +44,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# HTML filter that replaces commit references with links.
#
# This filter supports cross-project references.
......@@ -83,4 +84,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
class DesignReferenceFilter < AbstractReferenceFilter
class Identifier
include Comparable
......@@ -104,4 +105,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# The actual filter is implemented in the EE mixin
class EpicReferenceFilter < IssuableReferenceFilter
self.reference_type = :epic
......@@ -17,6 +18,7 @@ module Banzai
end
end
end
end
end
Banzai::Filter::EpicReferenceFilter.prepend_if_ee('EE::Banzai::Filter::EpicReferenceFilter')
Banzai::Filter::References::EpicReferenceFilter.prepend_if_ee('EE::Banzai::Filter::References::EpicReferenceFilter')
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# HTML filter that replaces external issue tracker references with links.
# References are ignored if the project doesn't use an external issue
# tracker.
......@@ -115,4 +116,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
class FeatureFlagReferenceFilter < IssuableReferenceFilter
self.reference_type = :feature_flag
......@@ -30,4 +31,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
class IssuableReferenceFilter < AbstractReferenceFilter
def record_identifier(record)
record.iid.to_i
......@@ -16,4 +17,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# HTML filter that replaces issue references with links. References to
# issues that do not exist are ignored.
#
......@@ -54,4 +55,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# The actual filter is implemented in the EE mixin
class IterationReferenceFilter < AbstractReferenceFilter
self.reference_type = :iteration
......@@ -11,6 +12,7 @@ module Banzai
end
end
end
end
end
Banzai::Filter::IterationReferenceFilter.prepend_if_ee('EE::Banzai::Filter::IterationReferenceFilter')
Banzai::Filter::References::IterationReferenceFilter.prepend_if_ee('EE::Banzai::Filter::References::IterationReferenceFilter')
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# HTML filter that replaces label references with links.
class LabelReferenceFilter < AbstractReferenceFilter
self.reference_type = :label
......@@ -124,6 +125,7 @@ module Banzai
end
end
end
end
end
Banzai::Filter::LabelReferenceFilter.prepend_if_ee('EE::Banzai::Filter::LabelReferenceFilter')
Banzai::Filter::References::LabelReferenceFilter.prepend_if_ee('EE::Banzai::Filter::References::LabelReferenceFilter')
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# HTML filter that replaces merge request references with links. References
# to merge requests that do not exist are ignored.
#
......@@ -94,4 +95,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# HTML filter that replaces milestone references with links.
class MilestoneReferenceFilter < AbstractReferenceFilter
include Gitlab::Utils::StrongMemoize
......@@ -135,4 +136,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# HTML filter that replaces project references with links.
class ProjectReferenceFilter < ReferenceFilter
self.reference_type = :project
......@@ -114,4 +115,5 @@ module Banzai
end
end
end
end
end
......@@ -3,6 +3,7 @@
# Generated HTML is transformed back to GFM by app/assets/javascripts/behaviors/markdown/nodes/reference.js
module Banzai
module Filter
module References
# Base class for GitLab Flavored Markdown reference filters.
#
# References within <pre>, <code>, <a>, and <style> elements are ignored.
......@@ -212,4 +213,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# HTML filter that replaces snippet references with links. References to
# snippets that do not exist are ignored.
#
......@@ -26,4 +27,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# HTML filter that replaces user or group references with links.
#
# A special `@all` reference is also supported.
......@@ -177,4 +178,5 @@ module Banzai
end
end
end
end
end
......@@ -2,6 +2,7 @@
module Banzai
module Filter
module References
# The actual filter is implemented in the EE mixin
class VulnerabilityReferenceFilter < IssuableReferenceFilter
self.reference_type = :vulnerability
......@@ -17,6 +18,7 @@ module Banzai
end
end
end
end
end
Banzai::Filter::VulnerabilityReferenceFilter.prepend_if_ee('EE::Banzai::Filter::VulnerabilityReferenceFilter')
Banzai::Filter::References::VulnerabilityReferenceFilter.prepend_if_ee('EE::Banzai::Filter::References::VulnerabilityReferenceFilter')
......@@ -51,19 +51,19 @@ module Banzai
def self.reference_filters
[
Filter::UserReferenceFilter,
Filter::ProjectReferenceFilter,
Filter::DesignReferenceFilter,
Filter::IssueReferenceFilter,
Filter::ExternalIssueReferenceFilter,
Filter::MergeRequestReferenceFilter,
Filter::SnippetReferenceFilter,
Filter::CommitRangeReferenceFilter,
Filter::CommitReferenceFilter,
Filter::LabelReferenceFilter,
Filter::MilestoneReferenceFilter,
Filter::AlertReferenceFilter,
Filter::FeatureFlagReferenceFilter
Filter::References::UserReferenceFilter,
Filter::References::ProjectReferenceFilter,
Filter::References::DesignReferenceFilter,
Filter::References::IssueReferenceFilter,
Filter::References::ExternalIssueReferenceFilter,
Filter::References::MergeRequestReferenceFilter,
Filter::References::SnippetReferenceFilter,
Filter::References::CommitRangeReferenceFilter,
Filter::References::CommitReferenceFilter,
Filter::References::LabelReferenceFilter,
Filter::References::MilestoneReferenceFilter,
Filter::References::AlertReferenceFilter,
Filter::References::FeatureFlagReferenceFilter
]
end
......
......@@ -6,7 +6,7 @@ module Banzai
def self.filters
@filters ||= FilterArray[
Filter::SanitizationFilter,
Filter::LabelReferenceFilter
Filter::References::LabelReferenceFilter
]
end
end
......
......@@ -17,15 +17,15 @@ module Banzai
def self.reference_filters
[
Filter::UserReferenceFilter,
Filter::IssueReferenceFilter,
Filter::ExternalIssueReferenceFilter,
Filter::MergeRequestReferenceFilter,
Filter::SnippetReferenceFilter,
Filter::CommitRangeReferenceFilter,
Filter::CommitReferenceFilter,
Filter::AlertReferenceFilter,
Filter::FeatureFlagReferenceFilter
Filter::References::UserReferenceFilter,
Filter::References::IssueReferenceFilter,
Filter::References::ExternalIssueReferenceFilter,
Filter::References::MergeRequestReferenceFilter,
Filter::References::SnippetReferenceFilter,
Filter::References::CommitRangeReferenceFilter,
Filter::References::CommitReferenceFilter,
Filter::References::AlertReferenceFilter,
Filter::References::FeatureFlagReferenceFilter
]
end
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::AbstractReferenceFilter do
RSpec.describe Banzai::Filter::References::AbstractReferenceFilter do
let_it_be(:project) { create(:project) }
let(:doc) { Nokogiri::HTML.fragment('') }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::AlertReferenceFilter do
RSpec.describe Banzai::Filter::References::AlertReferenceFilter do
include FilterSpecHelper
let_it_be(:project) { create(:project, :public) }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::CommitRangeReferenceFilter do
RSpec.describe Banzai::Filter::References::CommitRangeReferenceFilter do
include FilterSpecHelper
let(:project) { create(:project, :public, :repository) }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::CommitReferenceFilter do
RSpec.describe Banzai::Filter::References::CommitReferenceFilter do
include FilterSpecHelper
let(:project) { create(:project, :public, :repository) }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::DesignReferenceFilter do
RSpec.describe Banzai::Filter::References::DesignReferenceFilter do
include FilterSpecHelper
include DesignManagementTestHelpers
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::ExternalIssueReferenceFilter do
RSpec.describe Banzai::Filter::References::ExternalIssueReferenceFilter do
include FilterSpecHelper
let_it_be_with_refind(:project) { create(:project) }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::FeatureFlagReferenceFilter do
RSpec.describe Banzai::Filter::References::FeatureFlagReferenceFilter do
include FilterSpecHelper
let_it_be(:project) { create(:project, :public) }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::IssueReferenceFilter do
RSpec.describe Banzai::Filter::References::IssueReferenceFilter do
include FilterSpecHelper
include DesignManagementTestHelpers
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
require 'html/pipeline'
RSpec.describe Banzai::Filter::LabelReferenceFilter do
RSpec.describe Banzai::Filter::References::LabelReferenceFilter do
include FilterSpecHelper
let(:project) { create(:project, :public, name: 'sample-project') }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::MergeRequestReferenceFilter do
RSpec.describe Banzai::Filter::References::MergeRequestReferenceFilter do
include FilterSpecHelper
let(:project) { create(:project, :public) }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::MilestoneReferenceFilter do
RSpec.describe Banzai::Filter::References::MilestoneReferenceFilter do
include FilterSpecHelper
let_it_be(:parent_group) { create(:group, :public) }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::ProjectReferenceFilter do
RSpec.describe Banzai::Filter::References::ProjectReferenceFilter do
include FilterSpecHelper
def invalidate_reference(reference)
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::ReferenceFilter do
RSpec.describe Banzai::Filter::References::ReferenceFilter do
let(:project) { build_stubbed(:project) }
describe '#each_node' do
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::SnippetReferenceFilter do
RSpec.describe Banzai::Filter::References::SnippetReferenceFilter do
include FilterSpecHelper
let(:project) { create(:project, :public) }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::UserReferenceFilter do
RSpec.describe Banzai::Filter::References::UserReferenceFilter do
include FilterSpecHelper
def get_reference(user)
......
......@@ -25,7 +25,7 @@ RSpec.describe Banzai::Pipeline::GfmPipeline do
issue = create(:issue, project: project)
markdown = "text #{issue.to_reference(project, full: true)}"
expect_any_instance_of(Banzai::Filter::ReferenceFilter).to receive(:each_node).once
expect_any_instance_of(Banzai::Filter::References::ReferenceFilter).to receive(:each_node).once
described_class.call(markdown, project: project)
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