FIX: Delete internal links when moderator deletes a post (PR #13233)

See Topic replies referencing other topics, are still visible in the gutter of the referenced topic after the referring topic reply is deleted - #6 by codinghorror - bug - Discourse Meta for repro steps.

It looks like this has been a longstanding issue. In PostDestroyer we have two separate methods when deleting depending on whether the action is taken by the post owner or by a moderator. There was no cleanup taking place in the case of moderators deleting posts. (And even after adding the cleanup, we need to ensure that TopicLink.extract_from does not wrongly extract links from deleted posts.)

GitHub

This pull request has been mentioned on Discourse Meta. There might be relevant details there: