UI Notifications not delivered for hosts owned by usergroup
|Assigned To:||Timo Goebel|
|Found in release:||1.15.2||Pull request:||https://github.com/theforeman/foreman/pull/4758|
|Velocity based estimate||-|
When creating a ui notification where the host is the subject and the host is owned by a Usergroup, this currently fails:
subject = host
audience is set to AUDIENCE_GROUP by app/services/ui_notifications/hosts.rb
When building the recipient_ids:
For a user: initiator.id is used
For a usergroup: subject.all_users is used, but not defined as subject is host.
I've written a test to demonstrate the behavior:
UINotificationsHostsTest::deliver notification to host owner#test_0002_owner is usergroup:
NoMethodError: undefined method `all_users' for #<Host::Managed:0x007f89bdbc91e0>
test_after_commit (1.1.0) lib/test_after_commit/database_statements.rb:11:in `block in transaction'
test_after_commit (1.1.0) lib/test_after_commit/database_statements.rb:5:in `transaction'
test/unit/ui_notifications/hosts/base_test.rb:53:in `block (3 levels) in <class:UINotificationsHostsTest>'
test/unit/ui_notifications/hosts/base_test.rb:52:in `block (2 levels) in <class:UINotificationsHostsTest>'