insights: Remove series from view before deleting insight
Created by: CristinaBirkel
Closes https://github.com/sourcegraph/sourcegraph/issues/29050, https://github.com/sourcegraph/sourcegraph/issues/35882
Description
When an insight was deleted, the corresponding series were not being marked as deleted. This made it so that our background cleanup job never cleaned those series up. Explicitly removing the series from the view makes use of the logic to mark series as deleted when they are no longer attached to any view.
Test plan
- Before this fix: I created a new insight with several series, deleted it, and verified that its series were not marked as deleted.
- After this fix: Same, but verified that the series are now being marked as deleted. Upon restarting the service they are cleaned up by the background job as expected.