Commit f525eb85 authored by Sean McGivern's avatar Sean McGivern

Rename RelativeLinkFilter -> RepositoryLinkFilter

The end goal of this change is to split the RelativeLinkFilter into two
filters:

1. UploadLinkFilter (must run first)
2. RepositoryLinkFilter

This means that each filter will be easier to understand, and we'll also
be able to apply Gitaly-specific optimisations to the
RepositoryLinkFilter without having to worry about upload links. By
putting the UploadLinkFilter first, we'll also effectively short-circuit
any Gitaly calls when a document's only relative links are upload links.

This is a standalone commit because it's a rename and those can be hard
to follow when mixed with other changes.
parent 3e91ba27
......@@ -280,7 +280,7 @@ module MarkupHelper
context.reverse_merge!(
current_user: (current_user if defined?(current_user)),
# RelativeLinkFilter
# RepositoryLinkFilter
commit: @commit,
project_wiki: @project_wiki,
ref: @ref,
......
......@@ -4,7 +4,7 @@ require 'uri'
module Banzai
module Filter
# HTML filter that "fixes" relative links to uploads or files in a repository.
# HTML filter that "fixes" relative links to files in a repository.
#
# Context options:
# :commit
......@@ -14,7 +14,7 @@ module Banzai
# :project_wiki
# :ref
# :requested_path
class RelativeLinkFilter < HTML::Pipeline::Filter
class RepositoryLinkFilter < HTML::Pipeline::Filter
include Gitlab::Utils::StrongMemoize
def call
......
......@@ -16,7 +16,7 @@ module Banzai
[
Filter::ReferenceRedactorFilter,
Filter::InlineMetricsRedactorFilter,
Filter::RelativeLinkFilter,
Filter::RepositoryLinkFilter,
Filter::IssuableStateFilter,
Filter::SuggestionFilter
]
......
......@@ -216,8 +216,8 @@ describe 'GitLab Markdown', :aggregate_failures do
it_behaves_like 'all pipelines'
it 'includes custom filters' do
aggregate_failures 'RelativeLinkFilter' do
expect(doc).to parse_relative_links
aggregate_failures 'RepositoryLinkFilter' do
expect(doc).to parse_repository_links
end
aggregate_failures 'EmojiFilter' do
......@@ -277,8 +277,8 @@ describe 'GitLab Markdown', :aggregate_failures do
it_behaves_like 'all pipelines'
it 'includes custom filters' do
aggregate_failures 'RelativeLinkFilter' do
expect(doc).not_to parse_relative_links
aggregate_failures 'RepositoryLinkFilter' do
expect(doc).not_to parse_repository_links
end
aggregate_failures 'EmojiFilter' do
......
......@@ -111,7 +111,7 @@ Markdown should be usable inside a link. Let's try!
- [**text**](#link-strong)
- [`text`](#link-code)
### RelativeLinkFilter
### RepositoryLinkFilter
Linking to a file relative to this project's repository should work.
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe Banzai::Filter::RelativeLinkFilter do
describe Banzai::Filter::RepositoryLinkFilter do
include GitHelpers
include RepoHelpers
......
......@@ -10,8 +10,8 @@ module MarkdownMatchers
extend RSpec::Matchers::DSL
include Capybara::Node::Matchers
# RelativeLinkFilter
matcher :parse_relative_links do
# RepositoryLinkFilter
matcher :parse_repository_links do
set_default_markdown_messages
match do |actual|
......
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