issue_performance.diff

Ondřej Ezr, 2014-11-06 10:16

Download (1.17 KB)

View differences:

app/models/issue.rb
403 403
  safe_attributes 'is_private',
404 404
    :if => lambda {|issue, user|
405 405
      user.allowed_to?(:set_issues_private, issue.project) ||
406
        (issue.author == user && user.allowed_to?(:set_own_issues_private, issue.project))
406
        (issue.author_id == user.id && user.allowed_to?(:set_own_issues_private, issue.project))
407 407
    }
408 408

  
409 409
  safe_attributes 'parent_issue_id',
......
673 673
  # Returns the initial status of the issue
674 674
  # Returns nil for a new issue
675 675
  def status_was
676
    if status_id_was && status_id_was.to_i > 0
676
    if status_id_changed? && status_id_was.to_i > 0
677 677
      @status_was ||= IssueStatus.find_by_id(status_id_was)
678 678
    end
679 679
  end
......
762 762
      initial_status = nil
763 763
      if new_record?
764 764
        initial_status = IssueStatus.default
765
      elsif status_id_was
765
      elsif status_id_changed?
766 766
        initial_status = IssueStatus.find_by_id(status_id_was)
767 767
      end
768 768
      initial_status ||= status