summaryrefslogtreecommitdiffstats
path: root/app/models/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index a8dd05816..85d9cb43f 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -393,15 +393,11 @@ class Project < ActiveRecord::Base
true
end
- # Unarchives the project
- # All its ancestors must be active
+ # Unarchives the project and its archived ancestors
def unarchive
- return false if ancestors.detect {|a| a.archived?}
- new_status = STATUS_ACTIVE
- if parent
- new_status = parent.status
- end
- update_attribute :status, new_status
+ new_status = ancestors.any?(&:closed?) ? STATUS_CLOSED : STATUS_ACTIVE
+ self_and_ancestors.status(STATUS_ARCHIVED).update_all :status => new_status
+ reload
end
def close