Patch #27124 » issue.rb.patch
issue.rb (working copy) | ||
---|---|---|
104 | 104 |
end |
105 | 105 |
} |
106 | 106 | |
107 |
before_save { @in_before_save_callback = true } |
|
108 |
after_save { @in_before_save_callback = false } |
|
109 | ||
107 | 110 |
before_validation :default_assign, on: :create |
108 | 111 |
before_validation :clear_disabled_fields |
109 | 112 |
before_save :close_duplicates, :update_done_ratio_from_issue_status, |
... | ... | |
1009 | 1012 | |
1010 | 1013 |
# Returns the original tracker |
1011 | 1014 |
def tracker_was |
1012 |
Tracker.find_by_id(tracker_id_in_database)
|
|
1015 |
Tracker.find_by(:id => tracker_id_was)
|
|
1013 | 1016 |
end |
1014 | 1017 | |
1015 |
# Returns the previous assignee whenever we're before the save |
|
1016 |
# or in after_* callbacks |
|
1018 |
# Returns the previous assignee |
|
1017 | 1019 |
def previous_assignee |
1018 |
# This is how ActiveRecord::AttributeMethods::Dirty checks if we're in a after_* callback |
|
1019 |
if previous_assigned_to_id = mutation_tracker.equal?(mutations_from_database) ? assigned_to_id_in_database : assigned_to_id_before_last_save |
|
1020 |
Principal.find_by_id(previous_assigned_to_id) |
|
1021 |
end |
|
1020 |
Principal.find_by(:id => @in_before_save_callback ? assigned_to_id_before_last_save : assigned_to_id_was) |
|
1022 | 1021 |
end |
1023 | 1022 | |
1024 | 1023 |
# Returns the users that should be notified |