|
|
|
@ -42,6 +42,11 @@ class Issue < ActiveRecord::Base
|
|
|
|
|
|
|
|
|
|
has_many :relations_from, :class_name => 'IssueRelation', :foreign_key => 'issue_from_id', :dependent => :delete_all
|
|
|
|
|
has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all
|
|
|
|
|
|
|
|
|
|
# added by fq
|
|
|
|
|
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
acts_as_nested_set :scope => 'root_id', :dependent => :destroy
|
|
|
|
|
acts_as_attachable :after_add => :attachment_added, :after_remove => :attachment_removed
|
|
|
|
@ -65,6 +70,11 @@ class Issue < ActiveRecord::Base
|
|
|
|
|
DONE_RATIO_OPTIONS = %w(issue_field issue_status)
|
|
|
|
|
|
|
|
|
|
attr_reader :current_journal
|
|
|
|
|
|
|
|
|
|
# fq
|
|
|
|
|
after_create :act_as_activity
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
delegate :notes, :notes=, :private_notes, :private_notes=, :to => :current_journal, :allow_nil => true
|
|
|
|
|
|
|
|
|
|
validates_presence_of :subject, :priority, :project, :tracker, :author, :status
|
|
|
|
@ -102,6 +112,15 @@ class Issue < ActiveRecord::Base
|
|
|
|
|
after_save :after_create_from_copy
|
|
|
|
|
after_destroy :update_parent_attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# fq
|
|
|
|
|
def act_as_activity
|
|
|
|
|
self.acts << Activity.new(:user_id => self.author_id)
|
|
|
|
|
end
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Returns a SQL conditions string used to find all issues visible by the specified user
|
|
|
|
|
def self.visible_condition(user, options={})
|
|
|
|
|
Project.allowed_to_condition(user, :view_issues, options) do |role, user|
|
|
|
|
|