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/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] ||= {}} diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb index 21552dfd6..7c1027ad3 100644 --- a/app/models/issue_query.rb +++ b/app/models/issue_query.rb @@ -328,7 +328,7 @@ class IssueQuery < Query :sortable => "#{Issue.table_name}.is_private", :groupable => true) end - disabled_fields = Tracker.disabled_core_fields(trackers).map {|field| field.sub(/_id$/, '')} + disabled_fields = Tracker.disabled_core_fields(trackers).map {|field| field.delete_suffix('_id')} disabled_fields << "total_estimated_hours" if disabled_fields.include?("estimated_hours") @available_columns.reject! do |column| disabled_fields.include?(column.name.to_s) @@ -479,7 +479,7 @@ class IssueQuery < Query def sql_for_notes_field(field, operator, value) subquery = "SELECT 1 FROM #{Journal.table_name}" + " WHERE #{Journal.table_name}.journalized_type='Issue' AND #{Journal.table_name}.journalized_id=#{Issue.table_name}.id" + - " AND (#{sql_for_field field, operator.sub(/^!/, ''), value, Journal.table_name, 'notes'})" + + " AND (#{sql_for_field field, operator.delete_prefix('!'), value, Journal.table_name, 'notes'})" + " AND (#{Journal.visible_notes_condition(User.current, :skip_pre_condition => true)})" "#{/^!/.match?(operator) ? "NOT EXISTS" : "EXISTS"} (#{subquery})" end diff --git a/app/views/trackers/_form.html.erb b/app/views/trackers/_form.html.erb index 2ccd225e6..7e3929d3f 100644 --- a/app/views/trackers/_form.html.erb +++ b/app/views/trackers/_form.html.erb @@ -17,7 +17,7 @@ <% Tracker::CORE_FIELDS.each do |field| %> <% end %>
diff --git a/app/views/trackers/fields.html.erb b/app/views/trackers/fields.html.erb index a9fe49351..c4de3ab45 100644 --- a/app/views/trackers/fields.html.erb +++ b/app/views/trackers/fields.html.erb @@ -26,7 +26,7 @@ <% Tracker::CORE_FIELDS.each do |field| %>