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

Make "search" related code frozen string compatible

Jan Sandbrink67637e3446cf
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index eae22730680..eeded83c887 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
@@ -53,8 +55,7 @@ class SearchController < ApplicationController
private
def prepare_tokens
- @question = search_params[:q] || ""
- @question.strip!
+ @question = (search_params[:q] || "").strip
@tokens = scan_query_tokens(@question).uniq
unless @tokens.any?
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index a0507e3c7ba..e833fe92e78 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
@@ -32,7 +34,7 @@ module SearchHelper
return nil unless split_text.length > 1 || text_on_not_found
- result = ""
+ result = +""
split_text.each_with_index do |words, i|
if result.length > 1200
# maximum length of the preview reached