fix_project_uniq_visible.diff

Diff with to trunk(r14853) - Redmine CRM, 2015-11-08 21:57

Download (1.72 KB)

View differences:

app/models/principal.rb
28 28
  has_many :memberships,
29 29
           lambda {preload(:project, :roles).
30 30
                   joins(:project).
31
                   where("#{Project.table_name}.status<>#{Project::STATUS_ARCHIVED}").
32
                   order("#{Project.table_name}.name")},
31
                   where("#{Project.table_name}.status<>#{Project::STATUS_ARCHIVED}")},
33 32
           :class_name => 'Member',
34 33
           :foreign_key => 'user_id'
35 34
  has_many :projects, :through => :memberships
test/unit/project_test.rb
991 991
    p.status = Project::STATUS_CLOSED
992 992
    assert_include 'closed', p.css_classes.split
993 993
  end
994

  
995
  def test_combination_of_visible_and_uniq_scopes_in_case_anonymous_group_has_memberships
996
    project = projects(:projects_001)
997
    user = Group.find(13)
998
    member = Member.create!(:project => project, :principal => user, :roles => [Role.generate!])
999
    project.members << member
1000
    Project.uniq.visible
1001
  end
994 1002
end
995
-