FIX: improve Vanilla importing (PR #10478)

Hi! I’m working on importing a reasonably large Vanilla Forum into Discourse (self-hosted) and I noticed that some information was getting lost when using script/import/vanilla_mysql.rb. I added them to my own import script, and would like to push those changes upstream.

Here’s what I changed:

I left these features as separate commits to make reviewing easier, but I can squash them if that’s better, please let me know.

GitHub

I’m seeing that the Javascript Linter task is broken on master since https://github.com/discourse/discourse/commit/dde3d63b334178be7fbdfa637f7813357e5edc07, so I’ll rebase my branch to the commit before that, to be able to see if my changes pass linting.

The JS linter is still broken, I guess I’ll wait until it’s fixed on master. Anyway this PR doesn’t have any JS changes and the other linters and checks do pass.

I rebased master with the linting fix and now all checks are passing :tada:

Thanks for all these improvements, and for adding tests. The rich parser is hard to review, so the tests are helpful.