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
This commit is contained in:
Go MAEDA
2024-09-01 01:33:00 +00:00
parent 2190a4b417
commit eee5d73ee1

View File

@@ -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|