Notification not cleared when there is no other discovered host
|Assigned To:||Sebastian Gräßl|
|Found in release:||Pull request:||https://github.com/theforeman/foreman/pull/4861|
|Velocity based estimate||-|
Description of problem:
No notification regarding Discovery Host should be visible when there is no one available (see screenshot).
Steps to Reproduce:
1. Create a Discovery Host
2. Delete the Discovery Host
There is a notifications regarding discovery host even in its absence.
No notifications regarding discovery host.
Fixes #21026 - Clear cached notifications properly
Using `delete_all` for has_many does not trigger callbacks
on the associated objects, `dependent: :destroy` does.
Clearing the cache needs to happen anytime a notification
gets created, modified and destroyed, `after_commit`
will be triggered on all o these occasions.