プロジェクト

全般

プロフィール

Vote #75228

完了

Add anonymous user to users list in query filters

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Issues filter_56
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
56
version_id:
127
issue_org_id:
16904
author_id:
3866
assigned_to_id:
1
comments:
12
status_id:
5
tracker_id:
2
plus1:
1
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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


journals

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

<pre><code class="diff">
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?
</code></pre>
--------------------------------------------------------------------------------
+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.
--------------------------------------------------------------------------------

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

--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
Setting the target version to 4.1.0.
--------------------------------------------------------------------------------
Committed, thanks.
--------------------------------------------------------------------------------
A test is failling:

<pre><code>
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
</code></pre>

and a new Rubocop offense:

<pre><code>
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
</code></pre>

The attach patch fixes both issues.

--------------------------------------------------------------------------------
Committed the fix attachment:16904.patch. Thank you.
--------------------------------------------------------------------------------
Tests fail on PostgreSQL.
http://www.redmine.org/builds/logs/build_trunk_postgresql_ruby-2.6_795.html
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリIssues filter_56 にセット
  • 対象バージョン4.1.0_127 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0