Project

General

Profile

Actions

Feature #16904

closed

Add anonymous user to users list in query filters

Feature #16904: Add anonymous user to users list in query filters

Added by Felix Schäfer over 12 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Category:
Issues filter
Target version:
Resolution:
Fixed

Description

The author of an issue might be "Anonymous", either because issue creation is allowed for users that are not logged in, or because a user has been deleted. There's currently no way to filter by that user, the only way to achieve this is to filter for issues with an author that "is not all users".


Files

Updated by Felix Schäfer over 12 years ago Actions #1

This adds the option to search for issues with the author "Anonymous" everywhere.

diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
index bf90f56..1b9bf1e 100644
--- a/app/models/issue_query.rb
+++ b/app/models/issue_query.rb
@@ -171,6 +171,7 @@ class IssueQuery < Query
     author_values = []
     author_values << ["<< #{l(:label_me)} >>", "me"] if User.current.logged?
     author_values += users.collect{|s| [s.name, s.id.to_s] }
+    author_values << [l(:label_user_anonymous), User.anonymous.id.to_s]
     add_available_filter("author_id",
       :type => :list, :values => author_values
     ) unless author_values.empty?

Updated by Deoren Moor about 12 years ago Actions #2

+1

This would be useful to have. In addition (probably a separate issue), being able to filter on locked accounts would be nice to have as well.

Updated by Go MAEDA about 8 years ago Actions #3

  • Category set to Issues filter

Updated by Yuichi HARADA about 8 years ago Actions #4

I added an Anonymous user to the issues filter for "Author" and "Updated by" and "Last updated by".

Updated by Go MAEDA about 8 years ago Actions #5

  • Target version set to Candidate for next major release

Updated by Go MAEDA about 8 years ago Actions #6

Thank you for writing the patch.

But I think that not only IssuesQuery but also TimeEntryQuery should have an anonymous user in the author list because the User value of time entries can be an anonymous user.

Updated by Go MAEDA about 7 years ago Actions #7

  • Target version changed from Candidate for next major release to 4.1.0

Setting the target version to 4.1.0.

Updated by Jean-Philippe Lang about 7 years ago Actions #8

  • Subject changed from Add anonymous user to author list in issue query to Add anonymous user to users list in query filters
  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Committed, thanks.

Updated by Marius BĂLTEANU about 7 years ago Actions #9

A test is failling:


root@df2fd1389bf4:/work# ruby test/functional/queries_controller_test.rb -n test_user_filter_should_return_active_and_locked_users_grouped_by_status
Run options: -n test_user_filter_should_return_active_and_locked_users_grouped_by_status --seed 49890

# Running:

F

Failure:
QueriesControllerTest#test_user_filter_should_return_active_and_locked_users_grouped_by_status [test/functional/queries_controller_test.rb:778]:
Expected: 6
Actual: 7

and a new Rubocop offense:


root@df2fd1389bf4:/work# bundle exec rubocop test/functional/queries_controller_test.rb 
Inspecting 1 file
C

Offenses:

test/functional/queries_controller_test.rb:764:34: C: Style/RedundantInterpolation: Prefer to_s over string interpolation.
    assert_include ["Anonymous", "#{User.anonymous.id}"], json
                                 ^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected

The attach patch fixes both issues.

Updated by Go MAEDA about 7 years ago Actions #10

  • Status changed from Reopened to Closed

Committed the fix 16904.patch. Thank you.

Updated by Toshi MARUYAMA about 7 years ago Actions #11

  • Status changed from Closed to Reopened

Updated by Marius BĂLTEANU about 7 years ago Actions #12

  • Status changed from Reopened to Closed

Toshi MARUYAMA wrote:

Tests fail on PostgreSQL.
http://www.redmine.org/builds/logs/build_trunk_postgresql_ruby-2.6_795.html

It is a known issue, please see #32436.

Actions

Also available in: PDF Atom