# Migração: suprimindo mensagens de fechamento/reabertura de tópico do sistema

**URL:** https://meta.discourse.org/t/migration-suppressing-system-topic-close-re-open-messages/90292
**Category:** Development
**Created:** [20 Junho , 2018 10:49 UTC](https://meta.discourse.org/t/migration-suppressing-system-topic-close-re-open-messages/90292 "2018-06-20T10:49:05Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![bletch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bletch/32/69088_2.png) [@bletch](https://meta.discourse.org/u/bletch)
#### Post date: [20 Junho , 2018 10:49 UTC](https://meta.discourse.org/t/migration-suppressing-system-topic-close-re-open-messages/90292/1 "2018-06-20T10:49:05Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![bletch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bletch/32/69088_2.png) [@bletch](https://meta.discourse.org/u/bletch)
#### Post date: [21 Junho , 2018 06:40 UTC](https://meta.discourse.org/t/migration-suppressing-system-topic-close-re-open-messages/90292/2 "2018-06-21T06:40:23Z")

</div>

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.

 ![image](https://global.discourse-cdn.com/meta/original/3X/f/0/f0f990381019bd02c8abebb03978eb8de4c2daf2.png)

Any ideas?

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [21 Junho , 2018 10:17 UTC](https://meta.discourse.org/t/migration-suppressing-system-topic-close-re-open-messages/90292/3 "2018-06-21T10:17:39Z")

</div>

I really wouldn’t import downvotes as flags. If you do want them, maybe convert them to a 👎-reaction with the [Retort plugin](https://meta.discourse.org/t/retort-a-reaction-style-plugin-for-discourse/35903)?

---

<div class="post-metadata">

### Author: ![bletch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bletch/32/69088_2.png) [@bletch](https://meta.discourse.org/u/bletch)
#### Post date: [21 Junho , 2018 16:38 UTC](https://meta.discourse.org/t/migration-suppressing-system-topic-close-re-open-messages/90292/4 "2018-06-21T16:38:08Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [21 Junho , 2018 18:31 UTC](https://meta.discourse.org/t/migration-suppressing-system-topic-close-re-open-messages/90292/5 "2018-06-21T18:31:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bletch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bletch/32/69088_2.png) [@bletch](https://meta.discourse.org/u/bletch)
#### Post date: [21 Junho , 2018 20:49 UTC](https://meta.discourse.org/t/migration-suppressing-system-topic-close-re-open-messages/90292/6 "2018-06-21T20:49:37Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [22 Junho , 2018 06:40 UTC](https://meta.discourse.org/t/migration-suppressing-system-topic-close-re-open-messages/90292/7 "2018-06-22T06:40:07Z")

</div>

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.)
