# If I want to completely delete a post, I should just hide them?

**URL:** https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720
**Category:** Support
**Created:** [1 Fevereiro , 2017 16:30 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720 "2017-02-01T16:30:46Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![David\_Collantes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david_collantes/32/87919_2.png) [@David\_Collantes](https://meta.discourse.org/u/David_Collantes)
#### Post date: [1 Fevereiro , 2017 16:30 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/1 "2017-02-01T16:30:46Z")

</div>

My apologies, as I know this might have been discussed at length previously, but I am still trying to understand. On a reply by @codinghorror, a while back, he wrote:

[https://meta.discourse.org/t/deleted-topics-where-are-they/22312/8](https://meta.discourse.org/t/deleted-topics-where-are-they/22312/8)

Will that mean that, if I want to completely delete a post, I should just hide them? Will the `delete removed posts after` setting apply to the forum administrator, and thus, the topics/posts deleted/hidden by the administrator’s account be removed after the `n` hours set? Are `posts` and `topics` considered the same, for this setting?

How can one delete uploads, so that the `purge deleted uploads grace period days` settings become applicable (Grace period (in days) before a deleted upload is erased)?

---

<div class="post-metadata">

### Author: ![David\_Collantes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david_collantes/32/87919_2.png) [@David\_Collantes](https://meta.discourse.org/u/David_Collantes)
#### Post date: [3 Fevereiro , 2017 15:33 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/2 "2017-02-03T15:33:30Z")

</div>

So, based on the silent acceptance this topic got, am I to assume hidden posts do not get deleted after 30 days, and thus the `delete removed posts after` setting is a placebo?

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [3 Fevereiro , 2017 15:39 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/3 "2017-02-03T15:39:48Z")

</div>

Okay, I must have missed this topic earlier, but here is my understanding of how that setting works.

1. A Hidden post is still a post that can be seen by other users, it has the message of “this content is hidden due to community flagging”, or something like that, and therefore it is still “visible”
2. At 30 days (or whatever you have set), the post will be marked as “deleted”

This does not permanently destroy the post, instead it hides it from regular users to where only staff can see it. Discourse, to my knowledge, NEVER destroys a post entirely.

Uploads in that now deleted post, should eventually be cleaned up via the grace period at the next time it runs via Sidekiq.

---

<div class="post-metadata">

### Author: ![David\_Collantes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david_collantes/32/87919_2.png) [@David\_Collantes](https://meta.discourse.org/u/David_Collantes)
#### Post date: [3 Fevereiro , 2017 15:45 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/4 "2017-02-03T15:45:13Z")

</div>

Not trying to be nitpicky, but if delete doesn’t delete, then maybe that word shouldn’t be used. _Flagged_ should replace the current _Hidden_, and _Hidden_ should be made the new _deleted_.

I searched meta a lot, and found three years old developer discussions about implementing a real purge. There has been no advances on that idea, correct?

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [3 Fevereiro , 2017 15:50 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/5 "2017-02-03T15:50:13Z")

</div>

> [@David\_Collantes](#):
>
> There has been no advances on that idea, correct?

I am unaware of any plans for a real purge. The only way I know to do that is via the Rails console and calling post.destroy() on the post in question. So it technically exists, but isn’t automated in any form.

---

<div class="post-metadata">

### Author: ![David\_Collantes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david_collantes/32/87919_2.png) [@David\_Collantes](https://meta.discourse.org/u/David_Collantes)
#### Post date: [3 Fevereiro , 2017 15:55 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/6 "2017-02-03T15:55:23Z")

</div>

I tried the Rails console approach (found an old post referring to it), and it vomited errors at me, so I decided to hold that off.

The reply I referred about:

[https://meta.discourse.org/t/tools-to-permanently-remove-or-delete-spam/5289/10?u=david\_collantes](https://meta.discourse.org/t/tools-to-permanently-remove-or-delete-spam/5289/10)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [29 Abril , 2019 02:59 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/8 "2019-04-29T02:59:19Z")

</div>



---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [29 Abril , 2019 09:21 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/9 "2019-04-29T09:21:31Z")

</div>

FYI, in Discourse, we “soft-delete” topics/posts. Meaning the content is still stored in the database but it _flagged_ as being deleted and is thus not shown to standard users (admins can always seem them if they want to).

This help tremendously in dealing with spammers and/or misbehaving users.

@David_Collantes would you mind explaining why you wanted to completely erase the content of a post?

---

<div class="post-metadata">

### Author: ![icaria36](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/icaria36/32/426431_2.png) [@icaria36](https://meta.discourse.org/u/icaria36)
#### Post date: [1 Agosto , 2019 01:55 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/10 "2019-08-01T01:55:34Z")

</div>

> [@zogstrip](#):
>
> Você se importaria de explicar por que quis apagar completamente o conteúdo de uma postagem?

Imagine que um usuário publique algo extremamente sensível, como informações de cartão de crédito de alguém, número de seguro social, algo que não queremos que fique visível para ninguém, ou até mesmo algo que a equipe jurídica da sua organização peça para remover porque pode se tornar um passivo.

Um fator adicional é que postagens “excluídas logicamente” parecem ser acessíveis não apenas aos administradores, mas também aos moderadores. Se você tem um fórum onde membros da comunidade podem obter o cargo de moderador, isso apenas complica os cenários relacionados à privacidade.

Se houver uma instrução de linha de comando para excluir tais postagens em circunstâncias excepcionais, isso também funcionaria.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [1 Agosto , 2019 01:57 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/11 "2019-08-01T01:57:18Z")

</div>

> [@icaria36](#):
>
> Se houver uma instrução de linha de comando para excluir tais posts em circunstâncias excepcionais, isso também funcionaria.

Sim, existem…

```plaintext
./launcher enter app
rails c
Post.find(ID_DO_POST).destroy

```

Observe que isso é 100% irreversível, a menos que você recupere um backup, então tenha cuidado.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [14 Janeiro , 2020 21:34 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/12 "2020-01-14T21:34:15Z")

</div>

> [@sam](#):
>
> ```plaintext
> ./launcher enter app
> rails c
> Post.find(THE_POST_ID).destroy
> 
> ```
> 
> Note que isso é 100% irreversível, a menos que você tenha um backup, então tenha cuidado.

Olá,

Como o Discourse faz “soft-delete” (exclusão lógica) nas postagens, podemos considerar esse comando do Rails como a _forma recomendada_ de excluir completamente uma postagem contendo informações altamente sensíveis, como as que @icaria36 forneceu como exemplos? Se não for, qual seria a maneira recomendada de lidar com esse tipo de postagem?

Existe algum cenário que você possa imaginar em que a exclusão completa de uma postagem assim quebraria algo no Discourse?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [16 Janeiro , 2020 01:46 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/13 "2020-01-16T01:46:48Z")

</div>

> [@Canapin](#):
>
> Vem à sua mente algum caso em que apagar completamente uma postagem como essa quebraria algo no Discourse?

A exclusão definitiva de uma postagem usando `.destroy` é o método recomendado. Isso não quebrará nada no Discourse, pois há jobs que garantem a consistência.

Pode haver alguma inconsistência nas contagens por um período de 1 a 7 dias, dependendo. (Sam fez 9997 postagens, mas REALMENTE ele fez apenas 9996 postagens)

---

<div class="post-metadata">

### Author: ![j127](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j127/32/79093_2.png) [@j127](https://meta.discourse.org/u/j127)
#### Post date: [11 Maio , 2021 06:22 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/14 "2021-05-11T06:22:23Z")

</div>

Não tenho certeza se é o ideal, mas usei este código para substituir o conteúdo das postagens do usuário em tópicos excluídos por `"[deleted]""`. Dessa forma, a existência das postagens foi preservada, e pareceu mais seguro do que destruí-las completamente.

```ruby
# backup realizado primeiro
deleted_topic_id = 1234
user_id = 5678

t = Topic.unscoped.find(deleted_topic_id)
ps = t.posts.select { |p| p.user_id == user_id }

# `ps.count` para verificar

ps.each do |p|
  p.raw = '[deleted]'
  p.save
end

```

---

<div class="post-metadata">

### Author: ![Dawn](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@Dawn](https://meta.discourse.org/u/Dawn)
#### Post date: [11 Maio , 2021 18:24 UTC](https://meta.discourse.org/t/if-i-want-to-completely-delete-a-post-i-should-just-hide-them/56720/15 "2021-05-11T18:24:15Z")

</div>

Eu não percebi que ocultar uma postagem sinalizada não a tornaria invisível para outros usuários do fórum. Existe alguma maneira de reduzir o prazo de 30 dias para exclusão?
