Skip to content

Commit

Permalink
Move autolinking before relative link filter and fix link to agenda i…
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Apr 17, 2024
1 parent cc0c6f2 commit 07e1337
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def call
autolink_context = default_autolink_options.merge context.fetch(:autolink, {})
return doc if autolink_context[:enabled] == false

::Rinku.auto_link(html, :all, "class=\"#{autolink_context[:classes]}\"")
::Rinku.auto_link(html, :all, "class=\"#{autolink_context[:classes]}\" rel=\"noopener noreferrer\"", nil, Rinku::AUTOLINK_SHORT_DOMAINS)
end

def default_autolink_options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ def filters
OpenProject::TextFormatting::Filters::PatternMatcherFilter,
OpenProject::TextFormatting::Filters::SyntaxHighlightFilter,
OpenProject::TextFormatting::Filters::AttachmentFilter,
OpenProject::TextFormatting::Filters::AutolinkFilter,
OpenProject::TextFormatting::Filters::RelativeLinkFilter,
OpenProject::TextFormatting::Filters::LinkAttributeFilter,
OpenProject::TextFormatting::Filters::FigureWrappedFilter,
OpenProject::TextFormatting::Filters::BemCssFilter,
OpenProject::TextFormatting::Filters::AutolinkFilter
OpenProject::TextFormatting::Filters::BemCssFilter
]
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def add_note_action_item(menu)
end

def copy_action_item(menu)
url = url_for(anchor: "item-#{@meeting_agenda_item.id}", only_path: false)
url = meeting_url(@meeting, anchor: "item-#{@meeting_agenda_item.id}")
menu.with_item(label: t("button_copy_link_to_clipboard"),
tag: :"clipboard-copy",
content_arguments: { value: url }) do |item|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
let(:expected) do
<<~EXPECTED
<p class="op-uc-p">
Link to user:"<a class="op-uc-link" href="mailto:foo@bar.com">foo@bar.com</a>"
Link to user:"<a class="op-uc-link" rel="noopener noreferrer" target="_top" href="mailto:foo@bar.com">foo@bar.com</a>"
</p>
EXPECTED
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
Inline reference to variable setting: #{OpenProject::StaticRouting::UrlHelpers.host}
</p>
<p class="op-uc-p">
Inline reference to base_url variable: #{Rails.application.root_url}
Inline reference to base_url variable: <a href="#{Rails.application.root_url}" target="_top" rel="noopener noreferrer"
class="op-uc-link">#{Rails.application.root_url}</a>
</p>
<p class="op-uc-p">
<a href="#{Rails.application.root_url}/foo/bar" target="_top" rel="noopener noreferrer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
let(:expected) do
<<~EXPECTED
<p class="op-uc-p">
Autolink to <a href="http://www.google.com" class="op-uc-link">http://www.google.com</a>
Autolink to <a href="http://www.google.com" rel="noopener noreferrer" target="_top" class="op-uc-link">http://www.google.com</a>
</p>
EXPECTED
end
Expand All @@ -81,7 +81,7 @@
let(:expected) do
<<~EXPECTED
<p class="op-uc-p">
Mailto link to <a href="mailto:foo@bar.com" class="op-uc-link">foo@bar.com</a>
Mailto link to <a href="mailto:foo@bar.com" rel="noopener noreferrer" target="_top" class="op-uc-link">foo@bar.com</a>
</p>
EXPECTED
end
Expand Down

0 comments on commit 07e1337

Please sign in to comment.