summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-01-08 01:04:37 +0000
committerGo MAEDA <maeda@farend.jp>2024-01-08 01:04:37 +0000
commit52a55f407b74815c13675f4176570b8a952d7b75 (patch)
tree0ec4550df5a3e31b70432a99b29228fb05b130e0 /app/controllers
parent4d3fc7f89ec7f3d121b64ccb7d7b45dcf5827363 (diff)
downloadredmine-52a55f407b74815c13675f4176570b8a952d7b75.tar.gz
redmine-52a55f407b74815c13675f4176570b8a952d7b75.zip
Replace String#sub with delete_prefix / delete_suffix (#40008).
Patch by Go MAEDA (@maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@22596 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/repositories_controller.rb2
-rw-r--r--app/controllers/settings_controller.rb2
-rw-r--r--app/controllers/workflows_controller.rb4
3 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 07829c58d..5b18f14a6 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -230,7 +230,7 @@ class RepositoriesController < ApplicationController
# Adds a related issue to a changeset
# POST /projects/:project_id/repository/(:repository_id/)revisions/:rev/issues
def add_related_issue
- issue_id = params[:issue_id].to_s.sub(/^#/, '')
+ issue_id = params[:issue_id].to_s.delete_prefix('#')
@issue = @changeset.find_referenced_issue_by_id(issue_id)
if @issue && (!@issue.visible? || @changeset.issues.include?(@issue))
@issue = nil
diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb
index 9fb08d651..4662950c1 100644
--- a/app/controllers/settings_controller.rb
+++ b/app/controllers/settings_controller.rb
@@ -53,7 +53,7 @@ class SettingsController < ApplicationController
@deliveries = ActionMailer::Base.perform_deliveries
@guessed_host_and_path = request.host_with_port.dup
- @guessed_host_and_path << ('/'+ Redmine::Utils.relative_url_root.gsub(%r{^\/}, '')) unless Redmine::Utils.relative_url_root.blank?
+ @guessed_host_and_path << ("/#{Redmine::Utils.relative_url_root.delete_prefix('/')}") unless Redmine::Utils.relative_url_root.blank?
@commit_update_keywords = Setting.commit_update_keywords.dup
@commit_update_keywords = [{}] unless @commit_update_keywords.is_a?(Array) && @commit_update_keywords.any?
diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb
index 3bb46ad14..abad0f710 100644
--- a/app/controllers/workflows_controller.rb
+++ b/app/controllers/workflows_controller.rb
@@ -58,7 +58,9 @@ class WorkflowsController < ApplicationController
def permissions
if @roles && @trackers
- @fields = (Tracker::CORE_FIELDS_ALL - @trackers.map(&:disabled_core_fields).reduce(:&)).map {|field| [field, l("field_"+field.sub(/_id$/, ''))]}
+ @fields = (Tracker::CORE_FIELDS_ALL - @trackers.map(&:disabled_core_fields).reduce(:&)).map do |field|
+ [field, l("field_#{field.delete_suffix('_id')}")]
+ end
@custom_fields = @trackers.map(&:custom_fields).flatten.uniq.sort
@permissions = WorkflowPermission.rules_by_status_id(@trackers, @roles)
@statuses.each {|status| @permissions[status.id] ||= {}}