Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

add rel="nofollow" to table sort links

ulferts5dddb5932c12
diff --git a/app/helpers/sort_helper.rb b/app/helpers/sort_helper.rb
index cbbda73fd75..b578490095d 100644
--- a/app/helpers/sort_helper.rb
+++ b/app/helpers/sort_helper.rb
@@ -286,7 +286,7 @@ module SortHelper
allowed_params ||= %w[filters per_page expand columns]
# Don't lose other params.
- link_to_content_update(h(caption), safe_query_params(allowed_params).merge(sort_options), html_options)
+ link_to_content_update(h(caption), safe_query_params(allowed_params).merge(sort_options), html_options.merge(rel: :nofollow))
end
# Returns a table header <th> tag with a sort link for the named column
diff --git a/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.html b/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.html
index 6ebe2dce1a3..3be2f295f23 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.html
+++ b/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.html
@@ -17,7 +17,8 @@
[ngClass]="[directionClass && 'sort', directionClass]"
lang-attribute
lang="{{locale}}"
- id="{{ headerColumn.id }}">{{headerColumn.name}}</a>
+ id="{{ headerColumn.id }}"
+ rel="nofollow">{{headerColumn.name}}</a>
<a *ngIf="!sortable">{{headerColumn.name}}</a>
<op-icon icon-classes="dropdown-indicator icon-small icon-pulldown"
@@ -47,7 +48,8 @@
[ngClass]="[directionClass && 'sort', directionClass]"
lang-attribute
lang="{{locale}}"
- id="{{ headerColumn.id }}">{{headerColumn.name}}</a>
+ id="{{ headerColumn.id }}"
+ rel="nofollow">{{headerColumn.name}}</a>
<a *ngIf="!sortable">{{headerColumn.name}}</a>
diff --git a/spec/helpers/sort_helper_spec.rb b/spec/helpers/sort_helper_spec.rb
index 768f5253ec7..29d1ed8ff6d 100644
--- a/spec/helpers/sort_helper_spec.rb
+++ b/spec/helpers/sort_helper_spec.rb
@@ -148,6 +148,7 @@ RSpec.describe SortHelper do
<div class="generic-table--sort-header">
<span>
<a href="/work_packages?sort=sort_criteria_params"
+ rel="nofollow"
title="Sort by &quot;Id&quot;">Id</a>
</span>
</div>
@@ -166,6 +167,7 @@ RSpec.describe SortHelper do
<div class="generic-table--sort-header">
<span class="sort asc">
<a href="/work_packages?sort=sort_criteria_params"
+ rel="nofollow"
title="Ascending sorted by &quot;Id&quot;">Id</a>
</span>
</div>
@@ -186,6 +188,7 @@ RSpec.describe SortHelper do
<div class="generic-table--sort-header">
<span class="sort desc">
<a href="/work_packages?sort=sort_criteria_params"
+ rel="nofollow"
title="Descending sorted by &quot;Id&quot;">Id</a>
</span>
</div>
@@ -216,6 +219,7 @@ RSpec.describe SortHelper do
<div class="generic-table--sort-header">
<span>
<a href="/work_packages?columns=a%2Cb%2Cc&amp;expand=nope&amp;filters=xyz&amp;per_page=42&amp;sort=sort_criteria_params"
+ rel="nofollow"
title="Sort by &quot;Id&quot;">Id</a>
</span>
</div>
@@ -235,6 +239,7 @@ RSpec.describe SortHelper do
<div class="generic-table--sort-header">
<span>
<a href="/work_packages?baz=foo&amp;foo=bar&amp;sort=sort_criteria_params"
+ rel="nofollow"
title="Sort by &quot;Id&quot;">Id</a>
</span>
</div>