]> source.dussan.org Git - redmine.git/commitdiff
Add anonymous user to author list in issue/time query (#16904).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 Nov 2019 07:58:57 +0000 (07:58 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 Nov 2019 07:58:57 +0000 (07:58 +0000)
Patch by Yuichi HARADA and Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@19065 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb
test/functional/queries_controller_test.rb

index 5daf36e849d8eee2c423261203663e74284c4b5b..93c36887a1271ded41ea38fe7d06c92d11fb43e4 100644 (file)
@@ -567,6 +567,7 @@ class Query < ActiveRecord::Base
     author_values = []
     author_values << ["<< #{l(:label_me)} >>", "me"] if User.current.logged?
     author_values += users.sort_by(&:status).collect{|s| [s.name, s.id.to_s, l("status_#{User::LABEL_BY_STATUS[s.status]}")] }
+    author_values << [l(:label_user_anonymous), User.anonymous.id.to_s]
     author_values
   end
 
index 95afdbe4e808f4e3d64f029e62e32e36052abb13..335632cba457c4f7112481750458f585b342e181 100644 (file)
@@ -756,11 +756,12 @@ class QueriesControllerTest < Redmine::ControllerTest
     assert_equal 'application/json', response.content_type
     json = ActiveSupport::JSON.decode(response.body)
 
-    assert_equal 6, json.count
+    assert_equal 7, json.count
     # "me" value should not be grouped
     assert_include ["<< me >>", "me"], json
     assert_include ["Dave Lopper", "3", "active"], json
     assert_include ["Dave2 Lopper2", "5", "locked"], json
+    assert_include ["Anonymous", "#{User.anonymous.id}"], json
   end
 
   def test_user_filter_should_return_active_and_locked_users_grouped_by_status