diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-12-13 20:01:57 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-12-13 20:01:57 +0000 |
commit | e0912b99f5ab1767b8c34956619d216ad7ab73b1 (patch) | |
tree | b13cc5d9f56cb9b10e16d1f3eb37ab6ca60cc631 /app/models/project.rb | |
parent | 9b08365ea58b0e4839c9c306f57970cbfe26b0b0 (diff) | |
download | redmine-e0912b99f5ab1767b8c34956619d216ad7ab73b1.tar.gz redmine-e0912b99f5ab1767b8c34956619d216ad7ab73b1.zip |
Unarchive link not working for subprojects of closed projects (#24595).
git-svn-id: http://svn.redmine.org/redmine/trunk@16071 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 2f258f3f9..3582a2c67 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -350,6 +350,10 @@ class Project < ActiveRecord::Base self.status == STATUS_ACTIVE end + def closed? + self.status == STATUS_CLOSED + end + def archived? self.status == STATUS_ARCHIVED end @@ -377,8 +381,12 @@ class Project < ActiveRecord::Base # Unarchives the project # All its ancestors must be active def unarchive - return false if ancestors.detect {|a| !a.active?} - update_attribute :status, STATUS_ACTIVE + return false if ancestors.detect {|a| a.archived?} + new_status = STATUS_ACTIVE + if parent + new_status = parent.status + end + update_attribute :status, new_status end def close |