Project

General

Profile

Actions

Feature #16904

closed

Add anonymous user to users list in query filters

Added by Felix Schäfer over 10 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Category:
Issues filter
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
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

Actions #1

Updated by Felix Schäfer over 10 years ago

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?
Actions #2

Updated by Deoren Moor about 10 years ago

+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.

Actions #3

Updated by Go MAEDA about 6 years ago

  • Category set to Issues filter
Actions #4

Updated by Yuichi HARADA about 6 years ago

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

Actions #5

Updated by Go MAEDA about 6 years ago

  • Target version set to Candidate for next major release
Actions #6

Updated by Go MAEDA almost 6 years ago

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.

Actions #7

Updated by Go MAEDA almost 5 years ago

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

Setting the target version to 4.1.0.

Actions #8

Updated by Jean-Philippe Lang almost 5 years ago

  • 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.

Actions #9

Updated by Marius BĂLTEANU almost 5 years ago

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.

Actions #10

Updated by Go MAEDA almost 5 years ago

  • Status changed from Reopened to Closed

Committed the fix 16904.patch. Thank you.

Actions #11

Updated by Toshi MARUYAMA almost 5 years ago

  • Status changed from Closed to Reopened
Actions #12

Updated by Marius BĂLTEANU almost 5 years ago

  • 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: Atom PDF