Feature #16904
Add anonymous user to users list in query filters
Status: | Closed | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | Issues filter | |||
Target version: | 4.1.0 | |||
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".
Associated revisions
Add anonymous user to author list in issue/time query (#16904).
Patch by Yuichi HARADA and Go MAEDA.
History
#1
Updated by Felix Schäfer about 8 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?
#2
Updated by Deoren Moor almost 8 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.
#3
Updated by Go MAEDA almost 4 years ago
- Category set to Issues filter
#4
Updated by Yuichi HARADA almost 4 years ago
I added an Anonymous user to the issues filter for "Author" and "Updated by" and "Last updated by".
#5
Updated by Go MAEDA almost 4 years ago
- Target version set to Candidate for next major release
#6
Updated by Go MAEDA almost 4 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.
#7
Updated by Go MAEDA almost 3 years ago
- Target version changed from Candidate for next major release to 4.1.0
Setting the target version to 4.1.0.
#8
Updated by Jean-Philippe Lang almost 3 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.
#9
Updated by Marius BALTEANU almost 3 years ago
- File 16904.patch
added
- Status changed from Closed to Reopened
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.
#10
Updated by Go MAEDA over 2 years ago
- Status changed from Reopened to Closed
Committed the fix 16904.patch. Thank you.
#11
Updated by Toshi MARUYAMA over 2 years ago
- Status changed from Closed to Reopened
Tests fail on PostgreSQL.
http://www.redmine.org/builds/logs/build_trunk_postgresql_ruby-2.6_795.html
#12
Updated by Marius BALTEANU over 2 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.