6023-show-only-assignable-users.diff

Go MAEDA, 2017-01-08 06:00

Download (1.88 KB)

View differences:

app/controllers/reports_controller.rb (working copy)
24 24
    @versions = @project.shared_versions.sort
25 25
    @priorities = IssuePriority.all.reverse
26 26
    @categories = @project.issue_categories
27
    @assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
27
    @assignees = @project.assignable_users.sort
28 28
    @authors = @project.users.sort
29 29
    @subprojects = @project.descendants.visible
30 30

  
......
63 63
      @report_title = l(:field_category)
64 64
    when "assigned_to"
65 65
      @field = "assigned_to_id"
66
      @rows = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
66
      @rows = @project.assignable_users.sort
67 67
      @data = Issue.by_assigned_to(@project)
68 68
      @report_title = l(:field_assigned_to)
69 69
    when "author"
test/functional/reports_controller_test.rb (working copy)
61 61
    get :issue_report_details, :id => 1, :detail => 'invalid'
62 62
    assert_response 404
63 63
  end
64

  
65
  def test_issue_report_show_only_assignable_users_as_assignee
66
    project = Project.find(1)
67
    get :issue_report, :id => project.id
68
    assert_select '.splitcontentleft h3:nth-of-type(3)+table.list tbody tr', project.assignable_users.count
69

  
70
    Role.all.each {|r| r.update_attribute(:assignable, false)}
71
    get :issue_report, :id => project.id
72
    assert_select '.splitcontentleft h3:nth-of-type(3)+p i', I18n.t(:label_no_data)
73

  
74
    get :issue_report_details, :id => 1, :detail => 'assigned_to'
75
    assert_select '#content h3+p i', I18n.t(:label_no_data)
76
  end
64 77
end