58401a5 Bring back `clean_updates`, have it delete updates from DB

Authored and Committed by adamwill 7 years ago
    Bring back `clean_updates`, have it delete updates from DB
    
    Summary:
    This is a modified revert of commit
    2da425e354904273793e5321030882aac98d0c39.
    
    Turns out this wasn't actually just cleaning up *deleted*
    updates, though that's what it clearly thought it was doing.
    It also marked updates for closed bugs - and other updates
    which were no longer associated with a blocker or FE update,
    for instance if the update was edited and no longer marked as
    fixing the blocker bug - as 'deleted'. This is clearly wrong,
    but did more or less the right thing sort of by accident; it
    resulted in these updates not being shown in any of the views.
    
    None of the 'update' code will actually update the status of
    updates which no longer relate to a blocker or FE bug, so after
    we removed `clean_updates`, there was a problem where updates
    for closed bugs were still listed in the database with status
    'testing', even though they're actually 'stable'. This probably
    doesn't affect the main parts of the web UI much, since they
    only actually show updates that fix bugs, but it does affect
    the new 'requests' tab - it results in it including updates that
    have already gone stable in both the 'compose request' and the
    'stable push request' texts.
    
    We could deal with this by tweaking the update code so we update
    the status for all updates in the database, I guess, but I kinda
    like this idea to trim the database by dropping updates that no
    longer relate to blocker bugs from it entirely. If for whatever
    reason an update pongs *back* to being relevant, it'll just get
    re-added to the database at the next sync.
    
    Test Plan:
    Bit tricky, as you need to get an update into the
    database that subsequently becomes 'irrelevant' to see the
    behaviour. If you just build a database while we're in an active
    cycle then wait a few days, till after some of the bugs get
    closed, that should work. Without this patch, the update will
    likely remain in the database with state 'testing', and show
    up in the 'requests' tab.
    
    Reviewers: tflink, mkrizek
    
    Reviewed By: mkrizek
    
    Differential Revision: https://phab.qa.fedoraproject.org/D1179