summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Mathiesen <marius@shortcut.no>2010-02-18 14:10:02 +0100
committerMarius Mathiesen <marius@shortcut.no>2010-02-18 14:10:02 +0100
commit0ed4bc3c9a088eb66f1776f5c5211c91dbaef619 (patch)
tree3e59500b32f6be6a225f756cc371ef28af198f67
parent9b1e862350c8c21fa9d9a7b08f63fab0a30a2a60 (diff)
downloadgitorious-mainline-outdated-origin/HEAD.zip
gitorious-mainline-outdated-origin/HEAD.tar.gz
gitorious-mainline-outdated-origin/HEAD.tar.bz2
Bugfix: when changing project ownership to a group, give admin rights to all mainline repositoriesHEADorigin/masterorigin/HEADmaster
Until now, committerships created for these repositories would have a nil permissions mask.
-rw-r--r--app/models/project.rb4
-rw-r--r--test/unit/project_test.rb10
2 files changed, 11 insertions, 3 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 4824271..16d4a39 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -289,7 +289,9 @@ class Project < ActiveRecord::Base
self.wiki_repository.owner = another_owner
repositories.mainlines.each {|repo|
- repo.committerships.create!(:committer => another_owner, :creator_id => self.owner_id_was)
+ c = repo.committerships.create!(:committer => another_owner,:creator_id => self.owner_id_was)
+ c.build_permissions(:review, :commit, :admin)
+ c.save!
}
end
end
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index 9114a06..e61fe31 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -213,10 +213,16 @@ class ProjectTest < ActiveSupport::TestCase
assert_equal groups(:team_thunderbird), p.owner
end
- should "add group as committer to mainline repositories when changing ownership" do
+ should "add group as admin to mainline repositories when changing ownership" do
p = projects(:johans)
assert_difference("Committership.count") { p.change_owner_to(groups(:team_thunderbird)) }
- assert p.repositories.mainlines.first.committerships.any? {|c| c.committer == groups(:team_thunderbird) }
+ committership = p.repositories.mainlines.first.committerships.detect { |c|
+ c.committer == groups(:team_thunderbird)
+ }
+ assert_not_nil committership
+ assert_equal(
+ Committership::CAN_REVIEW | Committership::CAN_COMMIT | Committership::CAN_ADMIN,
+ committership.permissions)
end
should "delegate wiki permissions to the wiki repository" do