1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-03-03 07:51:54 +00:00

Merged rails-5.1 branch (#23630).

git-svn-id: http://svn.redmine.org/redmine/trunk@16859 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2017-07-23 11:26:04 +00:00
parent 41bb302594
commit d74f0bfd5c
381 changed files with 598 additions and 640 deletions

11
Gemfile
View File

@ -4,18 +4,16 @@ if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.5.0')
abort "Redmine requires Bundler 1.5.0 or higher (you're using #{Bundler::VERSION}).\nPlease update with 'gem update bundler'."
end
gem "rails", "4.2.8"
gem "jquery-rails", "~> 3.1.4"
gem "rails", "5.1.2"
gem "coderay", "~> 1.1.1"
gem "request_store", "1.0.5"
gem "mime-types", "~> 3.0"
gem "protected_attributes"
gem "actionpack-xml_parser"
gem "roadie-rails", "~> 1.1.1"
gem "roadie-rails"
gem "roadie", "~> 3.2.1"
gem "mimemagic"
gem "nokogiri", (RUBY_VERSION >= "2.1" ? "~> 1.7.2" : "~> 1.6.8")
gem "nokogiri", "~> 1.7.2"
gem "i18n", "~> 0.7.0"
# Request at least rails-html-sanitizer 1.0.3 because of security advisories
@ -85,12 +83,9 @@ group :development do
end
group :test do
gem "minitest"
gem "rails-dom-testing"
gem "mocha"
gem "simplecov", "~> 0.14.1", :require => false
# TODO: remove this after upgrading to Rails 5
gem "test_after_commit", "~> 0.4.2"
# For running UI tests
gem "capybara"
gem "selenium-webdriver", "~> 2.53.4"

View File

@ -109,9 +109,9 @@ class ImportsController < ApplicationController
end
def update_from_params
if params[:import_settings].is_a?(Hash)
if params[:import_settings].present?
@import.settings ||= {}
@import.settings.merge!(params[:import_settings])
@import.settings.merge!(params[:import_settings].to_unsafe_hash)
@import.save!
end
end

View File

@ -138,7 +138,7 @@ class MyController < ApplicationController
block_settings = params[:settings] || {}
block_settings.each do |block, settings|
@user.pref.update_block_settings(block, settings)
@user.pref.update_block_settings(block, settings.to_unsafe_hash)
end
@user.pref.save
@updated_blocks = block_settings.keys

View File

@ -20,15 +20,8 @@ class ProjectEnumerationsController < ApplicationController
before_action :authorize
def update
if params[:enumerations]
saved = Project.transaction do
params[:enumerations].each do |id, activity|
@project.update_or_create_time_entry_activity(id, activity)
end
end
if saved
flash[:notice] = l(:notice_successful_update)
end
if @project.update_or_create_time_entry_activities(update_params)
flash[:notice] = l(:notice_successful_update)
end
redirect_to settings_project_path(@project, :tab => 'activities')
@ -41,4 +34,12 @@ class ProjectEnumerationsController < ApplicationController
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'activities')
end
private
def update_params
params.
permit(:enumerations => [:parent_id, :active, {:custom_field_values => {}}]).
require(:enumerations)
end
end

View File

@ -68,7 +68,7 @@ class SearchController < ApplicationController
fetcher = Redmine::Search::Fetcher.new(
@question, User.current, @scope, projects_to_search,
:all_words => @all_words, :titles_only => @titles_only, :attachments => @search_attachments, :open_issues => @open_issues,
:cache => params[:page].present?, :params => params
:cache => params[:page].present?, :params => params.to_unsafe_hash
)
if fetcher.tokens.present?

View File

@ -34,7 +34,7 @@ class SettingsController < ApplicationController
def edit
@notifiables = Redmine::Notifiable.all
if request.post?
errors = Setting.set_all_from_params(params[:settings])
errors = Setting.set_all_from_params(params[:settings].to_unsafe_hash)
if errors.blank?
flash[:notice] = l(:notice_successful_update)
redirect_to settings_path(:tab => params[:tab])

View File

@ -101,7 +101,7 @@ class UsersController < ApplicationController
format.html {
flash[:notice] = l(:notice_user_successful_create, :id => view_context.link_to(@user.login, user_path(@user)))
if params[:continue]
attrs = params[:user].slice(:generate_password)
attrs = {:generate_password => @user.generate_password }
redirect_to new_user_path(:user => attrs)
else
redirect_to edit_user_path(@user)

View File

@ -1440,7 +1440,7 @@ module ApplicationHelper
# Returns the javascript tags that are included in the html layout head
def javascript_heads
tags = javascript_include_tag('jquery-1.11.1-ui-1.11.0-ujs-3.1.4', 'application', 'responsive')
tags = javascript_include_tag('jquery-1.11.1-ui-1.11.0-ujs-5.1.2', 'application', 'responsive')
unless User.current.pref.warn_on_leaving_unsaved == '0'
tags << "\n".html_safe + javascript_tag("$(window).load(function(){ warnLeavingUnsaved('#{escape_javascript l(:text_warn_on_leaving_unsaved)}'); });")
end

View File

@ -28,7 +28,6 @@ class Attachment < ActiveRecord::Base
validates_length_of :disk_filename, :maximum => 255
validates_length_of :description, :maximum => 255
validate :validate_max_file_size, :validate_file_extension
attr_protected :id
acts_as_event :title => :filename,
:url => Proc.new {|o| {:controller => 'attachments', :action => 'show', :id => o.id, :filename => o.filename}}

View File

@ -30,7 +30,6 @@ class AuthSource < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
validates_length_of :name, :maximum => 60
attr_protected :id
safe_attributes 'name',
'host',

View File

@ -28,7 +28,6 @@ class Board < ActiveRecord::Base
validates_length_of :name, :maximum => 30
validates_length_of :description, :maximum => 255
validate :validate_board
attr_protected :id
scope :visible, lambda {|*args|
joins(:project).

View File

@ -21,7 +21,6 @@ class Change < ActiveRecord::Base
validates_presence_of :changeset_id, :action, :path
before_save :init_path
before_validation :replace_invalid_utf8_of_path
attr_protected :id
def replace_invalid_utf8_of_path
self.path = Redmine::CodesetUtil.replace_invalid_utf8(self.path)

View File

@ -46,7 +46,6 @@ class Changeset < ActiveRecord::Base
validates_presence_of :repository_id, :revision, :committed_on, :commit_date
validates_uniqueness_of :revision, :scope => :repository_id
validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true
attr_protected :id
scope :visible, lambda {|*args|
joins(:repository => :project).

View File

@ -21,7 +21,6 @@ class Comment < ActiveRecord::Base
belongs_to :author, :class_name => 'User'
validates_presence_of :commented, :author, :comments
attr_protected :id
after_create :send_notification

View File

@ -35,7 +35,6 @@ class CustomField < ActiveRecord::Base
validates_length_of :regexp, maximum: 255
validates_inclusion_of :field_format, :in => Proc.new { Redmine::FieldFormat.available_formats }
validate :validate_custom_field
attr_protected :id
before_validation :set_searchable
before_save do |field|
@ -43,7 +42,7 @@ class CustomField < ActiveRecord::Base
end
after_save :handle_multiplicity_change
after_save do |field|
if field.visible_changed? && field.visible
if field.saved_change_to_visible? && field.visible
field.roles.clear
end
end
@ -316,7 +315,7 @@ class CustomField < ActiveRecord::Base
# Removes multiple values for the custom field after setting the multiple attribute to false
# We kepp the value with the highest id for each customized object
def handle_multiplicity_change
if !new_record? && multiple_was && !multiple
if !new_record? && multiple_before_last_save && !multiple
ids = custom_values.
where("EXISTS(SELECT 1 FROM #{CustomValue.table_name} cve WHERE cve.custom_field_id = #{CustomValue.table_name}.custom_field_id" +
" AND cve.customized_type = #{CustomValue.table_name}.customized_type AND cve.customized_id = #{CustomValue.table_name}.customized_id" +

View File

@ -18,7 +18,6 @@
class CustomValue < ActiveRecord::Base
belongs_to :custom_field
belongs_to :customized, :polymorphic => true
attr_protected :id
after_save :custom_field_after_save_custom_value

View File

@ -31,7 +31,6 @@ class Document < ActiveRecord::Base
validates_presence_of :project, :title, :category
validates_length_of :title, :maximum => 255
attr_protected :id
after_create :send_notification

View File

@ -19,7 +19,6 @@ class EmailAddress < ActiveRecord::Base
include Redmine::SafeAttributes
belongs_to :user
attr_protected :id
after_create :deliver_security_notification_create
after_update :destroy_tokens, :deliver_security_notification_update
@ -63,17 +62,17 @@ class EmailAddress < ActiveRecord::Base
# send a security notification to user that an email has been changed (notified/not notified)
def deliver_security_notification_update
if address_changed?
recipients = [user, address_was]
if saved_change_to_address?
recipients = [user, address_before_last_save]
options = {
message: :mail_body_security_notification_change_to,
field: :field_mail,
value: address
}
elsif notify_changed?
elsif saved_change_to_notify?
recipients = [user, address]
options = {
message: notify_was ? :mail_body_security_notification_notify_disabled : :mail_body_security_notification_notify_enabled,
message: notify_before_last_save ? :mail_body_security_notification_notify_disabled : :mail_body_security_notification_notify_enabled,
value: address
}
end
@ -103,7 +102,7 @@ class EmailAddress < ActiveRecord::Base
# This helps to keep the account secure in case the associated email account
# was compromised.
def destroy_tokens
if address_changed? || destroyed?
if saved_change_to_address? || destroyed?
tokens = ['recovery']
Token.where(:user_id => user_id, :action => tokens).delete_all
end

View File

@ -21,7 +21,6 @@ class EnabledModule < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name, :scope => :project_id
attr_protected :id
after_create :module_enabled

View File

@ -29,8 +29,6 @@ class Enumeration < ActiveRecord::Base
before_destroy :check_integrity
before_save :check_default
attr_protected :type
validates_presence_of :name
validates_uniqueness_of :name, :scope => [:type, :project_id]
validates_length_of :name, :maximum => 30
@ -148,7 +146,7 @@ class Enumeration < ActiveRecord::Base
# position as the overridden enumeration
def update_position
super
if position_changed?
if saved_change_to_position?
self.class.where.not(:parent_id => nil).update_all(
"position = coalesce((
select position

View File

@ -28,7 +28,6 @@ class Group < Principal
validates_presence_of :lastname
validates_uniqueness_of :lastname, :case_sensitive => false
validates_length_of :lastname, :maximum => 255
attr_protected :id
self.valid_statuses = [STATUS_ACTIVE]

View File

@ -69,7 +69,6 @@ class Issue < ActiveRecord::Base
validates :start_date, :date => true
validates :due_date, :date => true
validate :validate_issue, :validate_required_fields, :validate_permissions
attr_protected :id
scope :visible, lambda {|*args|
joins(:project).
@ -108,16 +107,14 @@ class Issue < ActiveRecord::Base
before_validation :default_assign, on: :create
before_validation :clear_disabled_fields
before_save :close_duplicates, :update_done_ratio_from_issue_status,
:force_updated_on_change, :update_closed_on, :set_assigned_to_was
after_save {|issue| issue.send :after_project_change if !issue.id_changed? && issue.project_id_changed?}
:force_updated_on_change, :update_closed_on
after_save {|issue| issue.send :after_project_change if !issue.saved_change_to_id? && issue.saved_change_to_project_id?}
after_save :reschedule_following_issues, :update_nested_set_attributes,
:update_parent_attributes, :delete_selected_attachments, :create_journal
# Should be after_create but would be called before previous after_save callbacks
after_save :after_create_from_copy
after_destroy :update_parent_attributes
after_create :send_notification
# Keep it at the end of after_save callbacks
after_save :clear_assigned_to_was
# Returns a SQL conditions string used to find all issues visible by the specified user
def self.visible_condition(user, options={})
@ -208,7 +205,7 @@ class Issue < ActiveRecord::Base
end
end
def create_or_update
def create_or_update(*args)
super
ensure
@status_was = nil
@ -512,6 +509,10 @@ class Issue < ActiveRecord::Base
# attr_accessible is too rough because we still want things like
# Issue.new(:project => foo) to work
def safe_attributes=(attrs, user=User.current)
if attrs.respond_to?(:to_unsafe_hash)
attrs = attrs.to_unsafe_hash
end
@attributes_set_by = user
return unless attrs.is_a?(Hash)
@ -586,8 +587,7 @@ class Issue < ActiveRecord::Base
attrs['custom_fields'].select! {|c| editable_custom_field_ids.include?(c['id'].to_s)}
end
# mass-assignment security bypass
assign_attributes attrs, :without_protection => true
assign_attributes attrs
end
def disabled_core_fields
@ -1007,32 +1007,27 @@ class Issue < ActiveRecord::Base
statuses
end
# Returns the previous assignee (user or group) if changed
def assigned_to_was
# assigned_to_id_was is reset before after_save callbacks
user_id = @previous_assigned_to_id || assigned_to_id_was
if user_id && user_id != assigned_to_id
@assigned_to_was ||= Principal.find_by_id(user_id)
end
end
# Returns the original tracker
def tracker_was
Tracker.find_by_id(tracker_id_was)
Tracker.find_by_id(tracker_id_in_database)
end
# Returns the previous assignee whenever we're before the save
# or in after_* callbacks
def previous_assignee
# This is how ActiveRecord::AttributeMethods::Dirty checks if we're in a after_* callback
if previous_assigned_to_id = mutation_tracker.equal?(mutations_from_database) ? assigned_to_id_in_database : assigned_to_id_before_last_save
Principal.find_by_id(previous_assigned_to_id)
end
end
# Returns the users that should be notified
def notified_users
notified = []
# Author and assignee are always notified unless they have been
# locked or don't want to be notified
notified << author if author
if assigned_to
notified += (assigned_to.is_a?(Group) ? assigned_to.users : [assigned_to])
end
if assigned_to_was
notified += (assigned_to_was.is_a?(Group) ? assigned_to_was.users : [assigned_to_was])
end
notified = [author, assigned_to, previous_assignee].compact.uniq
notified = notified.map {|n| n.is_a?(Group) ? n.users : n}.flatten
notified.uniq!
notified = notified.select {|u| u.active? && u.notify_about?(self)}
notified += project.notified_users
@ -1587,7 +1582,7 @@ class Issue < ActiveRecord::Base
# Move subtasks that were in the same project
children.each do |child|
next unless child.project_id == project_id_was
next unless child.project_id == project_id_before_last_save
# Change project and keep project
child.send :project=, project, true
unless child.save
@ -1644,7 +1639,7 @@ class Issue < ActiveRecord::Base
end
def update_nested_set_attributes
if parent_id_changed?
if saved_change_to_parent_id?
update_nested_set_attributes_on_parent_change
end
remove_instance_variable(:@parent_issue) if instance_variable_defined?(:@parent_issue)
@ -1652,7 +1647,7 @@ class Issue < ActiveRecord::Base
# Updates the nested set for when an existing issue is moved
def update_nested_set_attributes_on_parent_change
former_parent_id = parent_id_was
former_parent_id = parent_id_before_last_save
# delete invalid relations of all descendants
self_and_descendants.each do |issue|
issue.relations.each do |relation|
@ -1789,7 +1784,7 @@ class Issue < ActiveRecord::Base
# Updates start/due dates of following issues
def reschedule_following_issues
if start_date_changed? || due_date_changed?
if saved_change_to_start_date? || saved_change_to_due_date?
relations_from.each do |relation|
relation.set_issue_to_dates
end
@ -1848,18 +1843,6 @@ class Issue < ActiveRecord::Base
end
end
# Stores the previous assignee so we can still have access
# to it during after_save callbacks (assigned_to_id_was is reset)
def set_assigned_to_was
@previous_assigned_to_id = assigned_to_id_was
end
# Clears the previous assignee at the end of after_save callbacks
def clear_assigned_to_was
@assigned_to_was = nil
@previous_assigned_to_id = nil
end
def clear_disabled_fields
if tracker
tracker.disabled_core_fields.each do |attribute|

View File

@ -24,7 +24,6 @@ class IssueCategory < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name, :scope => [:project_id]
validates_length_of :name, :maximum => 60
attr_protected :id
safe_attributes 'name', 'assigned_to_id'

View File

@ -16,8 +16,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class IssueCustomField < CustomField
has_and_belongs_to_many :projects, :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :foreign_key => "custom_field_id"
has_and_belongs_to_many :trackers, :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :foreign_key => "custom_field_id"
has_and_belongs_to_many :projects, :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :foreign_key => "custom_field_id", :autosave => true
has_and_belongs_to_many :trackers, :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :foreign_key => "custom_field_id", :autosave => true
has_many :issues, :through => :issue_custom_values
safe_attributes 'project_ids',

View File

@ -19,7 +19,7 @@ class IssuePriority < Enumeration
has_many :issues, :foreign_key => 'priority_id'
after_destroy {|priority| priority.class.compute_position_names}
after_save {|priority| priority.class.compute_position_names if (priority.position_changed? && priority.position) || priority.active_changed?}
after_save {|priority| priority.class.compute_position_names if (priority.saved_change_to_position? && priority.position) || priority.saved_change_to_active?}
OptionName = :enumeration_issue_priorities

View File

@ -72,7 +72,6 @@ class IssueRelation < ActiveRecord::Base
validates_uniqueness_of :issue_to_id, :scope => :issue_from_id
validate :validate_issue_relation
attr_protected :issue_from_id, :issue_to_id
before_save :handle_issue_order
after_create :call_issues_relation_added_callback
after_destroy :call_issues_relation_removed_callback
@ -82,6 +81,10 @@ class IssueRelation < ActiveRecord::Base
'issue_to_id'
def safe_attributes=(attrs, user=User.current)
if attrs.respond_to?(:to_unsafe_hash)
attrs = attrs.to_unsafe_hash
end
return unless attrs.is_a?(Hash)
attrs = attrs.deep_dup

View File

@ -30,7 +30,6 @@ class IssueStatus < ActiveRecord::Base
validates_uniqueness_of :name
validates_length_of :name, :maximum => 30
validates_inclusion_of :default_done_ratio, :in => 0..100, :allow_nil => true
attr_protected :id
scope :sorted, lambda { order(:position) }
scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
@ -89,7 +88,7 @@ class IssueStatus < ActiveRecord::Base
# Updates issues closed_on attribute when an existing status is set as closed.
def handle_is_closed_change
if is_closed_changed? && is_closed == true
if saved_change_to_is_closed? && is_closed == true
# First we update issues that have a journal for when the current status was set,
# a subselect is used to update all issues with a single query
subquery = Journal.joins(:details).

View File

@ -26,7 +26,6 @@ class Journal < ActiveRecord::Base
belongs_to :user
has_many :details, :class_name => "JournalDetail", :dependent => :delete_all, :inverse_of => :journal
attr_accessor :indice
attr_protected :id
acts_as_event :title => Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.id}#{status}: #{o.issue.subject}" },
:description => :notes,

View File

@ -17,7 +17,6 @@
class JournalDetail < ActiveRecord::Base
belongs_to :journal
attr_protected :id
def custom_field
if property == 'cf'

View File

@ -25,7 +25,6 @@ class Member < ActiveRecord::Base
validates_presence_of :principal, :project
validates_uniqueness_of :user_id, :scope => :project_id
validate :validate_role
attr_protected :id
before_destroy :set_issue_category_nil, :remove_from_project_default_assigned_to

View File

@ -26,7 +26,6 @@ class MemberRole < ActiveRecord::Base
validates_presence_of :role
validate :validate_role_member
attr_protected :id
def validate_role_member
errors.add :role_id, :invalid if role && !role.member?

View File

@ -22,7 +22,6 @@ class Message < ActiveRecord::Base
acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC"
acts_as_attachable
belongs_to :last_reply, :class_name => 'Message'
attr_protected :id
acts_as_searchable :columns => ['subject', 'content'],
:preload => {:board => :project},
@ -69,9 +68,9 @@ class Message < ActiveRecord::Base
end
def update_messages_board
if board_id_changed?
if saved_change_to_board_id?
Message.where(["id = ? OR parent_id = ?", root.id, root.id]).update_all({:board_id => board_id})
Board.reset_counters!(board_id_was)
Board.reset_counters!(board_id_before_last_save)
Board.reset_counters!(board_id)
end
end

View File

@ -24,7 +24,6 @@ class News < ActiveRecord::Base
validates_presence_of :title, :description
validates_length_of :title, :maximum => 60
validates_length_of :summary, :maximum => 255
attr_protected :id
acts_as_attachable :edit_permission => :manage_news,
:delete_permission => :manage_news

View File

@ -67,8 +67,6 @@ class Project < ActiveRecord::Base
:url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o}},
:author => nil
attr_protected :status
validates_presence_of :name, :identifier
validates_uniqueness_of :identifier, :if => Proc.new {|p| p.identifier_changed?}
validates_length_of :name, :maximum => 255
@ -80,9 +78,9 @@ class Project < ActiveRecord::Base
validates_exclusion_of :identifier, :in => %w( new )
validate :validate_parent
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
after_save :remove_inherited_member_roles, :add_inherited_member_roles, :if => Proc.new {|project| project.parent_id_changed?}
after_update :update_versions_from_hierarchy_change, :if => Proc.new {|project| project.parent_id_changed?}
after_save :update_inherited_members, :if => Proc.new {|project| project.saved_change_to_inherit_members?}
after_save :remove_inherited_member_roles, :add_inherited_member_roles, :if => Proc.new {|project| project.saved_change_to_parent_id?}
after_update :update_versions_from_hierarchy_change, :if => Proc.new {|project| project.saved_change_to_parent_id?}
before_destroy :delete_all_members
scope :has_module, lambda {|mod|
@ -257,6 +255,15 @@ class Project < ActiveRecord::Base
scope
end
# Creates or updates project time entry activities
def update_or_create_time_entry_activities(activities)
transaction do
activities.each do |id, activity|
update_or_create_time_entry_activity(id, activity)
end
end
end
# Will create a new Project specific Activity or update an existing one
#
# This will raise a ActiveRecord::Rollback if the TimeEntryActivity
@ -776,6 +783,10 @@ class Project < ActiveRecord::Base
:if => lambda {|project, user| project.parent.nil? || project.parent.visible?(user)}
def safe_attributes=(attrs, user=User.current)
if attrs.respond_to?(:to_unsafe_hash)
attrs = attrs.to_unsafe_hash
end
return unless attrs.is_a?(Hash)
attrs = attrs.deep_dup
@ -872,10 +883,10 @@ class Project < ActiveRecord::Base
def update_inherited_members
if parent
if inherit_members? && !inherit_members_was
if inherit_members? && !inherit_members_before_last_save
remove_inherited_member_roles
add_inherited_member_roles
elsif !inherit_members? && inherit_members_was
elsif !inherit_members? && inherit_members_before_last_save
remove_inherited_member_roles
end
end

View File

@ -212,8 +212,6 @@ class Query < ActiveRecord::Base
serialize :sort_criteria, Array
serialize :options, Hash
attr_protected :project_id, :user_id
validates_presence_of :name
validates_length_of :name, :maximum => 255
validates :visibility, :inclusion => { :in => [VISIBILITY_PUBLIC, VISIBILITY_ROLES, VISIBILITY_PRIVATE] }
@ -223,7 +221,7 @@ class Query < ActiveRecord::Base
end
after_save do |query|
if query.visibility_changed? && query.visibility != VISIBILITY_ROLES
if query.saved_change_to_visibility? && query.visibility != VISIBILITY_ROLES
query.roles.clear
end
end
@ -623,7 +621,7 @@ class Query < ActiveRecord::Base
# Add multiple filters using +add_filter+
def add_filters(fields, operators, values)
if fields.is_a?(Array) && operators.is_a?(Hash) && (values.nil? || values.is_a?(Hash))
if fields.present? && operators.present?
fields.each do |field|
add_filter(field, operators[field], values && values[field])
end

View File

@ -48,7 +48,6 @@ class Repository < ActiveRecord::Base
# Checks if the SCM is enabled when creating a repository
validate :repo_create_validation, :on => :create
validate :validate_repository_path
attr_protected :id
safe_attributes 'identifier',
'login',

View File

@ -18,7 +18,6 @@
require 'redmine/scm/adapters/bazaar_adapter'
class Repository::Bazaar < Repository
attr_protected :root_url
validates_presence_of :url, :log_encoding
def self.human_attribute_name(attribute_key_name, *args)

View File

@ -21,7 +21,6 @@
require 'redmine/scm/adapters/filesystem_adapter'
class Repository::Filesystem < Repository
attr_protected :root_url
validates_presence_of :url
def self.human_attribute_name(attribute_key_name, *args)

View File

@ -19,7 +19,6 @@
require 'redmine/scm/adapters/git_adapter'
class Repository::Git < Repository
attr_protected :root_url
validates_presence_of :url
safe_attributes 'report_last_commit'

View File

@ -23,7 +23,6 @@ class Repository::Mercurial < Repository
lambda {order("#{Changeset.table_name}.id DESC")},
:foreign_key => 'repository_id'
attr_protected :root_url
validates_presence_of :url
# number of changesets to fetch at once

View File

@ -18,7 +18,6 @@
require 'redmine/scm/adapters/subversion_adapter'
class Repository::Subversion < Repository
attr_protected :root_url
validates_presence_of :url
validates_format_of :url, :with => %r{\A(http|https|svn(\+[^\s:\/\\]+)?|file):\/\/.+}i

View File

@ -77,7 +77,6 @@ class Role < ActiveRecord::Base
serialize :permissions, ::Role::PermissionsAttributeCoder
store :settings, :accessors => [:permissions_all_trackers, :permissions_tracker_ids]
attr_protected :builtin
validates_presence_of :name
validates_uniqueness_of :name

View File

@ -82,7 +82,6 @@ class Setting < ActiveRecord::Base
validates_numericality_of :value, :only_integer => true, :if => Proc.new { |setting|
(s = available_settings[setting.name]) && s['format'] == 'int'
}
attr_protected :id
# Hash used to cache setting values
@cached_settings = {}

View File

@ -24,8 +24,6 @@ class TimeEntry < ActiveRecord::Base
belongs_to :user
belongs_to :activity, :class_name => 'TimeEntryActivity'
attr_protected :user_id, :tyear, :tmonth, :tweek
acts_as_customizable
acts_as_event :title => Proc.new { |o|
related = o.issue if o.issue && o.issue.visible?

View File

@ -18,7 +18,6 @@
class Token < ActiveRecord::Base
belongs_to :user
validates_uniqueness_of :value
attr_protected :id
before_create :delete_previous_tokens, :generate_new_token

View File

@ -37,8 +37,6 @@ class Tracker < ActiveRecord::Base
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
acts_as_positioned
attr_protected :fields_bits
validates_presence_of :default_status
validates_presence_of :name
validates_uniqueness_of :name

View File

@ -99,9 +99,6 @@ class User < Principal
attr_accessor :last_before_login_on
attr_accessor :remote_ip
# Prevents unauthorized assignments
attr_protected :password, :password_confirmation, :hashed_password
LOGIN_LENGTH_LIMIT = 60
MAIL_LENGTH_LIMIT = 60
@ -771,9 +768,9 @@ class User < Principal
case mail_notification
when 'selected', 'only_my_events'
# user receives notifications for created/assigned issues on unselected projects
object.author == self || is_or_belongs_to?(object.assigned_to) || is_or_belongs_to?(object.assigned_to_was)
object.author == self || is_or_belongs_to?(object.assigned_to) || is_or_belongs_to?(object.previous_assignee)
when 'only_assigned'
is_or_belongs_to?(object.assigned_to) || is_or_belongs_to?(object.assigned_to_was)
is_or_belongs_to?(object.assigned_to) || is_or_belongs_to?(object.previous_assignee)
when 'only_owner'
object.author == self
end
@ -845,7 +842,7 @@ class User < Principal
# This helps to keep the account secure in case the associated email account
# was compromised.
def destroy_tokens
if hashed_password_changed? || (status_changed? && !active?)
if saved_change_to_hashed_password? || (saved_change_to_status? && !active?)
tokens = ['recovery', 'autologin', 'session']
Token.where(:user_id => id, :action => tokens).delete_all
end
@ -900,16 +897,16 @@ class User < Principal
}
deliver = false
if (admin? && id_changed? && active?) || # newly created admin
(admin? && admin_changed? && active?) || # regular user became admin
(admin? && status_changed? && active?) # locked admin became active again
if (admin? && saved_change_to_id? && active?) || # newly created admin
(admin? && saved_change_to_admin? && active?) || # regular user became admin
(admin? && saved_change_to_status? && active?) # locked admin became active again
deliver = true
options[:message] = :mail_body_security_notification_add
elsif (admin? && destroyed? && active?) || # active admin user was deleted
(!admin? && admin_changed? && active?) || # admin is no longer admin
(admin? && status_changed? && !active?) # admin was locked
(!admin? && saved_change_to_admin? && active?) || # admin is no longer admin
(admin? && saved_change_to_status? && !active?) # admin was locked
deliver = true
options[:message] = :mail_body_security_notification_remove

View File

@ -21,8 +21,6 @@ class UserPreference < ActiveRecord::Base
belongs_to :user
serialize :others
attr_protected :others, :user_id
before_save :set_others_hash, :clear_unused_block_settings
safe_attributes 'hide_mail',

View File

@ -39,7 +39,6 @@ class Version < ActiveRecord::Base
validates :effective_date, :date => true
validates_inclusion_of :status, :in => VERSION_STATUSES
validates_inclusion_of :sharing, :in => VERSION_SHARINGS
attr_protected :id
scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
scope :like, lambda {|arg|
@ -302,10 +301,10 @@ class Version < ActiveRecord::Base
# Update the issue's fixed versions. Used if a version's sharing changes.
def update_issues_from_sharing_change
if sharing_changed?
if VERSION_SHARINGS.index(sharing_was).nil? ||
if saved_change_to_sharing?
if VERSION_SHARINGS.index(sharing_before_last_save).nil? ||
VERSION_SHARINGS.index(sharing).nil? ||
VERSION_SHARINGS.index(sharing_was) > VERSION_SHARINGS.index(sharing)
VERSION_SHARINGS.index(sharing_before_last_save) > VERSION_SHARINGS.index(sharing)
Issue.update_versions_from_sharing_change self
end
end

View File

@ -22,7 +22,6 @@ class Watcher < ActiveRecord::Base
validates_presence_of :user
validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id]
validate :validate_user
attr_protected :id
# Returns true if at least one object among objects is watched by user
def self.any_watched?(objects, user)

View File

@ -26,7 +26,6 @@ class Wiki < ActiveRecord::Base
validates_presence_of :start_page
validates_format_of :start_page, :with => /\A[^,\.\/\?\;\|\:]*\z/
validates_length_of :start_page, maximum: 255
attr_protected :id
before_destroy :delete_redirects

View File

@ -23,7 +23,6 @@ class WikiContent < ActiveRecord::Base
belongs_to :author, :class_name => 'User'
validates_presence_of :text
validates_length_of :comments, :maximum => 1024, :allow_nil => true
attr_protected :id
acts_as_versioned
@ -60,7 +59,6 @@ class WikiContent < ActiveRecord::Base
class Version
belongs_to :page, :class_name => '::WikiPage'
belongs_to :author, :class_name => '::User'
attr_protected :data
acts_as_event :title => Proc.new {|o| "#{l(:label_wiki_edit)}: #{o.page.title} (##{o.version})"},
:description => :comments,
@ -161,11 +159,11 @@ class WikiContent < ActiveRecord::Base
def send_notification
# new_record? returns false in after_save callbacks
if id_changed?
if saved_change_to_id?
if Setting.notified_events.include?('wiki_content_added')
Mailer.wiki_content_added(self).deliver
end
elsif text_changed?
elsif saved_change_to_text?
if Setting.notified_events.include?('wiki_content_updated')
Mailer.wiki_content_updated(self).deliver
end

View File

@ -47,7 +47,6 @@ class WikiPage < ActiveRecord::Base
validates_uniqueness_of :title, :scope => :wiki_id, :case_sensitive => false
validates_length_of :title, maximum: 255
validates_associated :content
attr_protected :id
validate :validate_parent_title
before_destroy :delete_redirects
@ -80,6 +79,10 @@ class WikiPage < ActiveRecord::Base
end
def safe_attributes=(attrs, user=User.current)
if attrs.respond_to?(:to_unsafe_hash)
attrs = attrs.to_unsafe_hash
end
return unless attrs.is_a?(Hash)
attrs = attrs.deep_dup
@ -122,7 +125,7 @@ class WikiPage < ActiveRecord::Base
# Moves child pages if page was moved
def handle_children_move
if !new_record? && wiki_id_changed?
if !new_record? && saved_change_to_wiki_id?
children.each do |child|
child.wiki_id = wiki_id
child.redirect_existing_links = redirect_existing_links

View File

@ -20,7 +20,6 @@ class WikiRedirect < ActiveRecord::Base
validates_presence_of :wiki_id, :title, :redirects_to
validates_length_of :title, :redirects_to, :maximum => 255
attr_protected :id
before_save :set_redirects_to_wiki_id

View File

@ -24,7 +24,6 @@ class WorkflowRule < ActiveRecord::Base
belongs_to :new_status, :class_name => 'IssueStatus'
validates_presence_of :role, :tracker
attr_protected :id
# Copies workflows from source to targets
def self.copy(source_tracker, source_role, target_trackers, target_roles)

View File

@ -47,13 +47,6 @@ module RedmineApp
# Do not include all helpers
config.action_controller.include_all_helpers = false
# Do not suppress errors in after_rollback and after_commit callbacks
config.active_record.raise_in_transactional_callbacks = true
# XML parameter parser removed from core in Rails 4.0
# and extracted to actionpack-xml_parser gem
config.middleware.insert_after ActionDispatch::ParamsParser, ActionDispatch::XmlParamsParser
# Sets the Content-Length header on responses with fixed-length bodies
config.middleware.insert_after Rack::Sendfile, Rack::ContentLength

View File

@ -27,6 +27,30 @@ module ActiveRecord
end
end
class Relation ; undef open ; end
# Workaround for a Rails 5.1 regression that breaks queries with a condition
# on a table that has a column with the same name as the table
# (eg. comments.comments). It breaks has_many associations to these tables as well.
# https://github.com/rails/rails/commit/c6a62dc327c54baec87306f5c381e13cacc00a19
#
# Examples (without the following workaround applied):
# Comment.where(:comments => {:id => 1})
# TypeError: can't cast Hash
#
# News.first.comments.count
# TypeError: can't cast Hash
class PredicateBuilder
protected
alias :create_binds_for_hash_without_comments_fix :create_binds_for_hash
def create_binds_for_hash(attributes)
if attributes["comments"].is_a?(Hash)
return create_binds_for_hash_without_comments_fix attributes["comments"]
else
create_binds_for_hash_without_comments_fix attributes
end
end
end
end
module ActionView
@ -201,7 +225,7 @@ module ActionView
unless asset_id.blank?
source += "?#{asset_id}"
end
asset_path(source, options)
asset_path(source, options.merge(skip_pipeline: true))
end
alias :path_to_asset :asset_path_with_asset_id
@ -218,7 +242,7 @@ module ActionView
if File.exist? path
exist = true
else
path = File.join(Rails.public_path, compute_asset_path("#{source}#{extname}", options))
path = File.join(Rails.public_path, public_compute_asset_path("#{source}#{extname}", options))
if File.exist? path
exist = true
end

View File

@ -1,4 +1 @@
# Add new mime types for use in respond_to blocks:
Mime::SET << Mime::CSV unless Mime::SET.include?(Mime::CSV)

View File

@ -242,10 +242,6 @@ Rails.application.routes.draw do
get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats'
get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
get 'projects/:id/repository/:repository_id/changes(/*path)',
:to => 'repositories#changes',
:format => false
get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision'
get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision'
post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue'
@ -255,17 +251,13 @@ Rails.application.routes.draw do
get "projects/:id/repository/:repository_id/revisions/:rev/#{action}(/*path)",
:controller => 'repositories',
:action => action,
:format => false,
:constraints => {:rev => /[a-z0-9\.\-_]+/}
:format => 'html',
:constraints => {:rev => /[a-z0-9\.\-_]+/, :path => /.*/}
end
get 'projects/:id/repository/statistics', :to => 'repositories#stats'
get 'projects/:id/repository/graph', :to => 'repositories#graph'
get 'projects/:id/repository/changes(/*path)',
:to => 'repositories#changes',
:format => false
get 'projects/:id/repository/revisions', :to => 'repositories#revisions'
get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision'
get 'projects/:id/repository/revision', :to => 'repositories#revision'
@ -275,30 +267,32 @@ Rails.application.routes.draw do
get "projects/:id/repository/revisions/:rev/#{action}(/*path)",
:controller => 'repositories',
:action => action,
:format => false,
:constraints => {:rev => /[a-z0-9\.\-_]+/}
:format => 'html',
:constraints => {:rev => /[a-z0-9\.\-_]+/, :path => /.*/}
end
%w(browse entry raw changes annotate diff).each do |action|
get "projects/:id/repository/:repository_id/#{action}(/*path)",
:controller => 'repositories',
:action => action,
:format => false
:format => 'html',
:constraints => {:path => /.*/}
end
%w(browse entry raw changes annotate diff).each do |action|
get "projects/:id/repository/#{action}(/*path)",
:controller => 'repositories',
:action => action,
:format => false
:format => 'html',
:constraints => {:path => /.*/}
end
get 'projects/:id/repository/:repository_id/show/*path', :to => 'repositories#show', :format => false
get 'projects/:id/repository/show/*path', :to => 'repositories#show', :format => false
get 'projects/:id/repository/:repository_id/show/*path', :to => 'repositories#show', :format => 'html', :constraints => {:path => /.*/}
get 'projects/:id/repository/show/*path', :to => 'repositories#show', :format => 'html', :constraints => {:path => /.*/}
get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil
get 'projects/:id/repository', :to => 'repositories#show', :path => nil
# additional routes for having the file name at the end of url
get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment'
get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment', :format => 'html'
get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment'
get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/
get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail'
@ -376,7 +370,7 @@ Rails.application.routes.draw do
match 'uploads', :to => 'attachments#upload', :via => :post
get 'robots.txt', :to => 'welcome#robots'
get 'robots', :to => 'welcome#robots'
Dir.glob File.expand_path("#{Redmine::Plugin.directory}/*") do |plugin_dir|
file = File.join(plugin_dir, "config/routes.rb")

View File

@ -15,10 +15,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Setup < ActiveRecord::Migration
class Setup < ActiveRecord::Migration[4.2]
class User < ActiveRecord::Base
attr_protected :id
end
# model removed

View File

@ -1,4 +1,4 @@
class IssueMove < ActiveRecord::Migration
class IssueMove < ActiveRecord::Migration[4.2]
# model removed
class Permission < ActiveRecord::Base; end

View File

@ -1,4 +1,4 @@
class IssueAddNote < ActiveRecord::Migration
class IssueAddNote < ActiveRecord::Migration[4.2]
# model removed
class Permission < ActiveRecord::Base; end

View File

@ -1,4 +1,4 @@
class ExportPdf < ActiveRecord::Migration
class ExportPdf < ActiveRecord::Migration[4.2]
# model removed
class Permission < ActiveRecord::Base; end

View File

@ -1,4 +1,4 @@
class IssueStartDate < ActiveRecord::Migration
class IssueStartDate < ActiveRecord::Migration[4.2]
def self.up
add_column :issues, :start_date, :date
add_column :issues, :done_ratio, :integer, :default => 0, :null => false

View File

@ -1,4 +1,4 @@
class CalendarAndActivity < ActiveRecord::Migration
class CalendarAndActivity < ActiveRecord::Migration[4.2]
# model removed
class Permission < ActiveRecord::Base; end

View File

@ -1,4 +1,4 @@
class CreateJournals < ActiveRecord::Migration
class CreateJournals < ActiveRecord::Migration[4.2]
# model removed, but needed for data migration
class IssueHistory < ActiveRecord::Base; belongs_to :issue; end

View File

@ -1,4 +1,4 @@
class CreateUserPreferences < ActiveRecord::Migration
class CreateUserPreferences < ActiveRecord::Migration[4.2]
def self.up
create_table :user_preferences do |t|
t.column "user_id", :integer, :default => 0, :null => false

View File

@ -1,4 +1,4 @@
class AddHideMailPref < ActiveRecord::Migration
class AddHideMailPref < ActiveRecord::Migration[4.2]
def self.up
add_column :user_preferences, :hide_mail, :boolean, :default => false
end

View File

@ -1,4 +1,4 @@
class CreateComments < ActiveRecord::Migration
class CreateComments < ActiveRecord::Migration[4.2]
def self.up
create_table :comments do |t|
t.column :commented_type, :string, :limit => 30, :default => "", :null => false

View File

@ -1,4 +1,4 @@
class AddNewsCommentsCount < ActiveRecord::Migration
class AddNewsCommentsCount < ActiveRecord::Migration[4.2]
def self.up
add_column :news, :comments_count, :integer, :default => 0, :null => false
end

View File

@ -1,4 +1,4 @@
class AddCommentsPermissions < ActiveRecord::Migration
class AddCommentsPermissions < ActiveRecord::Migration[4.2]
# model removed
class Permission < ActiveRecord::Base; end

View File

@ -1,4 +1,4 @@
class CreateQueries < ActiveRecord::Migration
class CreateQueries < ActiveRecord::Migration[4.2]
def self.up
create_table :queries, :force => true do |t|
t.column "project_id", :integer

View File

@ -1,4 +1,4 @@
class AddQueriesPermissions < ActiveRecord::Migration
class AddQueriesPermissions < ActiveRecord::Migration[4.2]
# model removed
class Permission < ActiveRecord::Base; end

View File

@ -1,4 +1,4 @@
class CreateRepositories < ActiveRecord::Migration
class CreateRepositories < ActiveRecord::Migration[4.2]
def self.up
create_table :repositories, :force => true do |t|
t.column "project_id", :integer, :default => 0, :null => false

View File

@ -1,4 +1,4 @@
class AddRepositoriesPermissions < ActiveRecord::Migration
class AddRepositoriesPermissions < ActiveRecord::Migration[4.2]
# model removed
class Permission < ActiveRecord::Base; end

View File

@ -1,4 +1,4 @@
class CreateSettings < ActiveRecord::Migration
class CreateSettings < ActiveRecord::Migration[4.2]
def self.up
create_table :settings, :force => true do |t|
t.column "name", :string, :limit => 30, :default => "", :null => false

View File

@ -1,4 +1,4 @@
class SetDocAndFilesNotifications < ActiveRecord::Migration
class SetDocAndFilesNotifications < ActiveRecord::Migration[4.2]
# model removed
class Permission < ActiveRecord::Base; end

View File

@ -1,4 +1,4 @@
class AddIssueStatusPosition < ActiveRecord::Migration
class AddIssueStatusPosition < ActiveRecord::Migration[4.2]
def self.up
add_column :issue_statuses, :position, :integer, :default => 1
IssueStatus.all.each_with_index {|status, i| status.update_attribute(:position, i+1)}

View File

@ -1,4 +1,4 @@
class AddRolePosition < ActiveRecord::Migration
class AddRolePosition < ActiveRecord::Migration[4.2]
def self.up
add_column :roles, :position, :integer, :default => 1
Role.all.each_with_index {|role, i| role.update_attribute(:position, i+1)}

View File

@ -1,4 +1,4 @@
class AddTrackerPosition < ActiveRecord::Migration
class AddTrackerPosition < ActiveRecord::Migration[4.2]
def self.up
add_column :trackers, :position, :integer, :default => 1
Tracker.all.each_with_index {|tracker, i| tracker.update_attribute(:position, i+1)}

View File

@ -1,4 +1,4 @@
class SerializePossiblesValues < ActiveRecord::Migration
class SerializePossiblesValues < ActiveRecord::Migration[4.2]
def self.up
CustomField.all.each do |field|
if field.possible_values and field.possible_values.is_a? String

View File

@ -1,4 +1,4 @@
class AddTrackerIsInRoadmap < ActiveRecord::Migration
class AddTrackerIsInRoadmap < ActiveRecord::Migration[4.2]
def self.up
add_column :trackers, :is_in_roadmap, :boolean, :default => true, :null => false
end

View File

@ -1,4 +1,4 @@
class AddRoadmapPermission < ActiveRecord::Migration
class AddRoadmapPermission < ActiveRecord::Migration[4.2]
# model removed
class Permission < ActiveRecord::Base; end

View File

@ -1,4 +1,4 @@
class AddSearchPermission < ActiveRecord::Migration
class AddSearchPermission < ActiveRecord::Migration[4.2]
# model removed
class Permission < ActiveRecord::Base; end

View File

@ -1,4 +1,4 @@
class AddRepositoryLoginAndPassword < ActiveRecord::Migration
class AddRepositoryLoginAndPassword < ActiveRecord::Migration[4.2]
def self.up
add_column :repositories, :login, :string, :limit => 60, :default => ""
add_column :repositories, :password, :string, :limit => 60, :default => ""

View File

@ -1,4 +1,4 @@
class CreateWikis < ActiveRecord::Migration
class CreateWikis < ActiveRecord::Migration[4.2]
def self.up
create_table :wikis do |t|
t.column :project_id, :integer, :null => false

View File

@ -1,4 +1,4 @@
class CreateWikiPages < ActiveRecord::Migration
class CreateWikiPages < ActiveRecord::Migration[4.2]
def self.up
create_table :wiki_pages do |t|
t.column :wiki_id, :integer, :null => false

View File

@ -1,4 +1,4 @@
class CreateWikiContents < ActiveRecord::Migration
class CreateWikiContents < ActiveRecord::Migration[4.2]
def self.up
create_table :wiki_contents do |t|
t.column :page_id, :integer, :null => false

View File

@ -1,4 +1,4 @@
class AddProjectsFeedsPermissions < ActiveRecord::Migration
class AddProjectsFeedsPermissions < ActiveRecord::Migration[4.2]
# model removed
class Permission < ActiveRecord::Base; end

View File

@ -1,4 +1,4 @@
class AddRepositoryRootUrl < ActiveRecord::Migration
class AddRepositoryRootUrl < ActiveRecord::Migration[4.2]
def self.up
add_column :repositories, :root_url, :string, :limit => 255, :default => ""
end

View File

@ -1,4 +1,4 @@
class CreateTimeEntries < ActiveRecord::Migration
class CreateTimeEntries < ActiveRecord::Migration[4.2]
def self.up
create_table :time_entries do |t|
t.column :project_id, :integer, :null => false

View File

@ -1,4 +1,4 @@
class AddTimelogPermissions < ActiveRecord::Migration
class AddTimelogPermissions < ActiveRecord::Migration[4.2]
# model removed
class Permission < ActiveRecord::Base; end

View File

@ -1,4 +1,4 @@
class CreateChangesets < ActiveRecord::Migration
class CreateChangesets < ActiveRecord::Migration[4.2]
def self.up
create_table :changesets do |t|
t.column :repository_id, :integer, :null => false

View File

@ -1,4 +1,4 @@
class CreateChanges < ActiveRecord::Migration
class CreateChanges < ActiveRecord::Migration[4.2]
def self.up
create_table :changes do |t|
t.column :changeset_id, :integer, :null => false

View File

@ -1,4 +1,4 @@
class AddChangesetCommitDate < ActiveRecord::Migration
class AddChangesetCommitDate < ActiveRecord::Migration[4.2]
def self.up
add_column :changesets, :commit_date, :date
Changeset.update_all "commit_date = committed_on"

View File

@ -1,4 +1,4 @@
class AddProjectIdentifier < ActiveRecord::Migration
class AddProjectIdentifier < ActiveRecord::Migration[4.2]
def self.up
add_column :projects, :identifier, :string, :limit => 20
end

View File

@ -1,4 +1,4 @@
class AddCustomFieldIsFilter < ActiveRecord::Migration
class AddCustomFieldIsFilter < ActiveRecord::Migration[4.2]
def self.up
add_column :custom_fields, :is_filter, :boolean, :null => false, :default => false
end

View File

@ -1,4 +1,4 @@
class CreateWatchers < ActiveRecord::Migration
class CreateWatchers < ActiveRecord::Migration[4.2]
def self.up
create_table :watchers do |t|
t.column :watchable_type, :string, :default => "", :null => false

View File

@ -1,4 +1,4 @@
class CreateChangesetsIssues < ActiveRecord::Migration
class CreateChangesetsIssues < ActiveRecord::Migration[4.2]
def self.up
create_table :changesets_issues, :id => false do |t|
t.column :changeset_id, :integer, :null => false

Some files were not shown because too many files have changed in this diff Show More