Project

General

Profile

Feature #16904 » 16904-issuequery-filters-add-anonymous-user.patch

Yuichi HARADA, 2018-10-04 05:02

View differences:

app/models/issue_query.rb
181 181
    }
182 182
  end
183 183

  
184
  def author_values
185
    super << [l(:label_user_anonymous), "#{User.anonymous.id}"]
186
  end
187

  
184 188
  def available_columns
185 189
    return @available_columns if @available_columns
186 190
    @available_columns = self.class.available_columns.dup
test/functional/queries_controller_test.rb
25 25
           :issues, :custom_fields, :custom_values,
26 26
           :queries
27 27

  
28
  include Redmine::I18n
29

  
28 30
  def setup
29 31
    User.current = nil
30 32
  end
......
660 662
    assert_include ["Dave2 Lopper2", "5", "locked"], json
661 663
  end
662 664

  
663
  def test_author_filter_should_return_active_and_locked_users_grouped_by_status
665
  def test_author_filter_should_return_active_and_locked_users_grouped_by_status_with_anonymous_user
664 666
    @request.session[:user_id] = 1
665 667
    get :filter, :params => {
666 668
        :project_id => 1,
......
671 673
    assert_equal 'application/json', response.content_type
672 674
    json = ActiveSupport::JSON.decode(response.body)
673 675

  
674
    assert_equal 6, json.count
676
    assert_equal 7, json.count
675 677
    # "me" value should not be grouped
676 678
    assert_include ["<< me >>", "me"], json
677 679
    assert_include ["Dave Lopper", "3", "active"], json
678 680
    assert_include ["Dave2 Lopper2", "5", "locked"], json
681
    assert_include [l(:label_user_anonymous), "#{User.anonymous.id}"], json
679 682
  end
680 683

  
681 684
  def test_user_filter_should_return_active_and_locked_users_grouped_by_status
(1-1/3)