From: Toshi MARUYAMA Date: Tue, 3 Nov 2020 14:55:57 +0000 (+0000) Subject: add empty line after guard clause to app/models/project.rb X-Git-Tag: 4.2.0~580 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8fa5b6051f510b0d2a34f42040a7361989e50c56;p=redmine.git add empty line after guard clause to app/models/project.rb git-svn-id: http://svn.redmine.org/redmine/trunk@20237 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/project.rb b/app/models/project.rb index 839e39a28..48d59019b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -319,6 +319,7 @@ class Project < ActiveRecord::Base if args.first && args.first.is_a?(String) && !/^\d*$/.match?(args.first) project = find_by_identifier(*args) raise ActiveRecord::RecordNotFound, "Couldn't find Project with identifier=#{args.first}" if project.nil? + project else super @@ -386,6 +387,7 @@ class Project < ActiveRecord::Base exists? return false end + Project.transaction do archive! end @@ -411,6 +413,7 @@ class Project < ActiveRecord::Base # by the current user def allowed_parents(user=User.current) return @allowed_parents if @allowed_parents + @allowed_parents = Project.allowed_to(user, :add_subprojects).to_a @allowed_parents = @allowed_parents - self_and_descendants if user.allowed_to?(:add_project, nil, :global => true) || (!new_record? && parent.nil?) @@ -701,6 +704,7 @@ class Project < ActiveRecord::Base # No write action allowed on closed projects return false end + # No action allowed on disabled modules if action.is_a? Hash allowed_actions.include? "#{action[:controller]}/#{action[:action]}" @@ -801,8 +805,8 @@ class Project < ActiveRecord::Base if attrs.respond_to?(:to_unsafe_hash) attrs = attrs.to_unsafe_hash end - return unless attrs.is_a?(Hash) + attrs = attrs.deep_dup @unallowed_parent_id = nil @@ -979,6 +983,7 @@ class Project < ActiveRecord::Base project.wiki.pages.each do |page| # Skip pages without content next if page.content.nil? + new_wiki_content = WikiContent.new(page.content.attributes.dup.except("id", "page_id", "updated_on")) new_wiki_page = WikiPage.new(page.attributes.dup.except("id", "wiki_id", "created_on", "parent_id")) new_wiki_page.content = new_wiki_content @@ -1135,6 +1140,7 @@ class Project < ActiveRecord::Base # inherited roles will be added when copying the group membership role_ids = member.member_roles.reject(&:inherited?).collect(&:role_id) next if role_ids.empty? + new_member.role_ids = role_ids new_member.project = self self.members << new_member