diff options
author | Go MAEDA <maeda@farend.jp> | 2024-09-01 01:33:00 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2024-09-01 01:33:00 +0000 |
commit | eee5d73ee11328e225104efaf8bc82a100f3ff23 (patch) | |
tree | 3bcd34bcdc6ebc9247ec949671e661460a86a0f6 | |
parent | 2190a4b417dec7ff8407e92a80c78b291169334b (diff) | |
download | redmine-eee5d73ee11328e225104efaf8bc82a100f3ff23.tar.gz redmine-eee5d73ee11328e225104efaf8bc82a100f3ff23.zip |
Revert r23002 (#39887).
The change caused a test failure:
```
Failure:
UserTest#test_accessing_projects_by_role_with_no_projects_should_return_an_empty_array [test/unit/user_test.rb:1048]:
Expected: []
Actual: nil
```
git-svn-id: https://svn.redmine.org/redmine/trunk@23006 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/user.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 0bbfdfb53..2d012fa41 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -643,7 +643,7 @@ class User < Principal def projects_by_role return @projects_by_role if @projects_by_role - result = {} + result = Hash.new([]) # rubocop:disable Style/EmptyLiteral project_ids_by_role.each do |role, ids| result[role] = Project.where(:id => ids).to_a end @@ -676,7 +676,7 @@ class User < Principal hash[role_id] << project_id end - result = {} + result = Hash.new([]) # rubocop:disable Style/EmptyLiteral if hash.present? roles = Role.where(:id => hash.keys).to_a hash.each do |role_id, proj_ids| |