Better handling of issue update conflicts (#8691).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8774 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-02-04 17:36:15 +00:00
parent b9c26d6ddc
commit fb3b904b8f
53 changed files with 384 additions and 12 deletions
+10 -2
View File
@@ -436,6 +436,15 @@ class Issue < ActiveRecord::Base
@current_journal
end
# Returns the id of the last journal or nil
def last_journal_id
if new_record?
nil
else
journals.first(:order => "#{Journal.table_name}.id DESC").try(:id)
end
end
# Return true if the issue is closed, otherwise false
def closed?
self.status.is_closed?
@@ -692,8 +701,7 @@ class Issue < ActiveRecord::Base
end
rescue ActiveRecord::StaleObjectError
attachments[:files].each(&:destroy)
errors.add :base, l(:notice_locking_conflict)
raise ActiveRecord::Rollback
raise ActiveRecord::StaleObjectError
end
end
end