From 0453c56b221fb9afd07ceacbd58502999a2dec07 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 20 Dec 2016 09:05:31 +0000 Subject: Merged r16071 (#24595). git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16100 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/project.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'app/models') diff --git a/app/models/project.rb b/app/models/project.rb index ee24056ed..b2fa1893d 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 -- cgit v1.2.3