Migration: suppressing system topic close/re-open messages

tl;dr can I suppress the system response to community flags during a migration?

Hi, I’ve written a migrator for MVC Forum which has community flags (up and downvote). I wanted to maintain our downvotes as well as our upvotes but in migrating the downvotes (as inappropriate in Discourse), the system user will post “Topic automatically closed/reopened” messages.

This isn’t a problem per se but it has meant that all of the system reopened posts appear as the latest posts which messes the chronological order.

Any ideas how I can suppress the system interventions? Or can I write a script to reset the latest post date to ignore system messages?

Thanks!

Here’s a migration I did overnight. You can see that the latest poster in all of these is the system user. This is due to topics being reopened after they had been closed due to community flags. These posts (which are not the latest chronologically) have therefore been pulled to the top of the latest posts list.

Any ideas?

I really wouldn’t import downvotes as flags. If you do want them, maybe convert them to a :-1:-reaction with the Retort plugin?

3 Likes

Thanks for the suggestion, @fefrei, but in the current forum we actually use the down-vote as a “report to mods” flag. So for consistent moderation into the future I’d like to maintain the community flags. That said, I will take a look at the Retort plugin as it looks interesting.

Messing around in the DB, it looks like what I need to do is look for topics where the last post was carried out by the system user and then set the bumped_at row of the topics table to be the datetime of the last post but one (i.e. the last post genuine by a non-system user).

I’ll try that and report back.

If you really want to import them as flags: Are you making them look like handled flags? If not, that’s explain the system reaction.

That sounds like what I need, @fefrei.

Can you expand on how to import them as handled flags?

At the moment I’m simply using:

PostActionCreator.new(user, post).perform(action)

Is there something I can add to this to handle the flag?

Thanks again.

Good question – I guess the best answer is to look at the code that backs the moderator queue and call the appropriate action (probably defer)?

(I still think you’re fighting an uphill battle here because importing these flags as real flags simply is a bad idea.)

2 Likes