Commit f8a0a27d authored by jplang's avatar jplang

Adding a principal to 2 projects with member inheritance leads to an error (#25289).

Patch by Felix Schäfer.

git-svn-id: https://svn.redmine.org/redmine/trunk@16381 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent ae289baf
......@@ -184,9 +184,11 @@ class Member < ActiveRecord::Base
project_ids = Array.wrap(attributes[:project_ids] || attributes[:project_id])
role_ids = attributes[:role_ids]
project_ids.each do |project_id|
members << Member.new(:principal => principal, :role_ids => role_ids, :project_id => project_id)
member = Member.find_or_new(project_id, principal)
member.role_ids |= role_ids
member.save
members << member
end
principal.members << members
end
members
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment