Merge branch 'feature/MeetingPluginIssue1565' into dev

whitespace cleanup
pull/6827/head
Markus Kahl 11 years ago
commit 64429bbb07
  1. 9
      app/models/meeting.rb
  2. 2
      app/views/meetings/_form.html.erb
  3. 16
      spec/models/meeting_spec.rb

@ -103,8 +103,13 @@ class Meeting < ActiveRecord::Base
(user || User.current).allowed_to?(:view_meetings, self.project) (user || User.current).allowed_to?(:view_meetings, self.project)
end end
def all_possible_participants def all_changeable_participants
self.project.users.all(:include => { :memberships => [:roles, :project] } ).select{ |u| self.visible?(u) } changeable_participants = self.participants.select(&:invited).collect{|p| p.user}
changeable_participants = changeable_participants + self.participants.select(&:attended).collect{|p| p.user}
changeable_participants = changeable_participants + \
self.project.users.all(:include => { :memberships => [:roles, :project] } ).select{|u| self.visible?(u) }
changeable_participants.uniq{|user| user.id}
end end
def copy(attrs) def copy(attrs)

@ -34,7 +34,7 @@ See doc/COPYRIGHT.md for more details.
<th><%=Meeting.human_attribute_name(:participants_attended) %></th> <th><%=Meeting.human_attribute_name(:participants_attended) %></th>
</tr></thead> </tr></thead>
<tbody> <tbody>
<% @meeting.all_possible_participants.sort.each do |user| -%> <% @meeting.all_changeable_participants.sort.each do |user| -%>
<%= hidden_field_tag "meeting[participants_attributes][][user_id]", user.id %> <%= hidden_field_tag "meeting[participants_attributes][][user_id]", user.id %>
<tr class="<%= cycle("odd", "even")%>"> <tr class="<%= cycle("odd", "even")%>">
<td><%=h user %></td> <td><%=h user %></td>

@ -82,7 +82,7 @@ describe Meeting do
end end
end end
describe "all_possible_participants" do describe "all_changeable_participants" do
describe "WITH a user having the view_meetings permission" do describe "WITH a user having the view_meetings permission" do
before do before do
project.add_member user1, [role] project.add_member user1, [role]
@ -90,7 +90,7 @@ describe Meeting do
end end
it "should contain the user" do it "should contain the user" do
meeting.all_possible_participants.should == [user1] meeting.all_changeable_participants.should == [user1]
end end
end end
@ -106,10 +106,20 @@ describe Meeting do
end end
it "should not contain the user" do it "should not contain the user" do
meeting.all_possible_participants.include?(user2).should be_false meeting.all_changeable_participants.include?(user2).should be_false
end end
end end
describe "WITH a user being locked but invited" do
let(:locked_user) { FactoryGirl.create(:locked_user) }
before do
meeting.participants_attributes = [{"user_id" => locked_user.id, "invited" => 1}]
end
it "should contain the user" do
meeting.all_changeable_participants.include?(locked_user).should be_true
end
end
end end
describe "participants and author as watchers" do describe "participants and author as watchers" do

Loading…
Cancel
Save