Bug #12712
No searchable link for "Owner" in host properties in non-english languages
Description
If the language isnt english the link in host properties doenst work. This comes from hosts_helper.rb in line 263. Is there any reason for the if-else? It filters for the word "User" which obviously only works for english.
I've attached a screenshot of the code and my workaround.
Associated revisions
History
#1
Updated by Dominic Cleal over 7 years ago
- Category set to Web Interface
- Difficulty set to trivial
The owner_type will only ever be in English, so it should actually check for if host.owner_type == "User"
as it's a DB column.
The second part of the conditional is used when a host is owned by a user group rather than a user, so it doesn't link to the individual user (it could actually link to a search for the group).
If you'd like to get this fixed, please do send the fix via a pull request (see http://theforeman.org/contribute.html).
#2
Updated by René Kaak over 7 years ago
The problem with my workaround is that it leads to a 500 error if the Owner is actually a usergroup. Need to find a way to fix this behaviour.. What is the search-context for usergroup? Trying to figure something out and will report back as soon as I understood some of the helpers better..
#3
Updated by Dominic Cleal over 7 years ago
Yeah, that's why I think the conditional needs fixing instead, because a usergroup object won't have the ".login" that a user does.
It looks like you could use a search like this for hosts owned by a user group: owner_type = Usergroup and owner_id = #{host.owner.id}
(instead of user.login = ...).
#4
Updated by The Foreman Bot over 7 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2963 added
#5
Updated by The Foreman Bot over 7 years ago
- Pull request https://github.com/theforeman/foreman/pull/2965 added
#6
Updated by Dominic Cleal almost 7 years ago
- Status changed from Ready For Testing to New
#7
Updated by The Foreman Bot about 3 years ago
- Assignee set to Tomer Brisker
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/7315 added
#8
Updated by The Foreman Bot about 3 years ago
- Fixed in Releases 2.0.0 added
#9
Updated by Tomer Brisker about 3 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 9fdf33b8c6da1f320b2f856106eed8ddd065bf15.
#10
Updated by Tomer Brisker about 3 years ago
- Category changed from Web Interface to Inventory
- Fixed in Releases 1.24.1 added
Fixes #12712 - Fix owner link from host info page
The link only displays if the locale is set to English.