# שחזור הודעות שנמחקו?

**URL:** https://meta.discourse.org/t/restoring-deleted-messages/173647
**Category:** Support
**Created:** [17 בדצמבר,‏ 2020,‏ 8:35pm UTC](https://meta.discourse.org/t/restoring-deleted-messages/173647 "2020-12-17T20:35:44Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![SJack](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sjack/32/191258_2.png) [@SJack](https://meta.discourse.org/u/SJack)
#### Post date: [17 בדצמבר,‏ 2020,‏ 8:35pm UTC](https://meta.discourse.org/t/restoring-deleted-messages/173647/1 "2020-12-17T20:35:44Z")

</div>

Hi everyone,

I am an auditor at a site with Discourse engine. One of the members deleted about 1300 messages. The system automatically puts the responses to this message at the end of the topic. Do we have a batch restore facility?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [17 בדצמבר,‏ 2020,‏ 10:55pm UTC](https://meta.discourse.org/t/restoring-deleted-messages/173647/2 "2020-12-17T22:55:45Z")

</div>

If you’re self-hosted you can do it from the rails console. If you’re hosted, you can ask support.

There might be some hints over in [Administrative Bulk Operations](https://meta.discourse.org/t/administrative-bulk-operations/118349).

Something like

```plaintext
t=Topic.all.with_deleted.where("deleted_at is not null").where(user_id: 123)
t.update_all(deleted_at: nil, deleted_by_id: nil)

```

But I think you will then need to run something else to update some other tables.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [19 בדצמבר,‏ 2020,‏ 2:30am UTC](https://meta.discourse.org/t/restoring-deleted-messages/173647/3 "2020-12-19T02:30:48Z")

</div>

> [@SJack](#):
>
> One of the members deleted about 1300 messages

Can you describe how they did that, exactly? In a default Discourse install, a regular user is rate limited in how much they can delete and deletions take 24 hours to take effect.

---

<div class="post-metadata">

### Author: ![SJack](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sjack/32/191258_2.png) [@SJack](https://meta.discourse.org/u/SJack)
#### Post date: [19 בדצמבר,‏ 2020,‏ 4:41pm UTC](https://meta.discourse.org/t/restoring-deleted-messages/173647/4 "2020-12-19T16:41:48Z")

</div>

I think he deleted five posts every day.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [19 בדצמבר,‏ 2020,‏ 8:42pm UTC](https://meta.discourse.org/t/restoring-deleted-messages/173647/5 "2020-12-19T20:42:16Z")

</div>

I see. These are soft-deletes so you should be able to undo them, either via the UI, or at the command line if you SSH into the server.

You can turn down the number of allowed deletions per day in your admin site settings to prevent this from happening in the future; there’s some discussion about allowing a zero in that setting so all deletions are prevented.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [30 בדצמבר,‏ 2020,‏ 8:40pm UTC](https://meta.discourse.org/t/restoring-deleted-messages/173647/6 "2020-12-30T20:40:55Z")

</div>

> [@codinghorror](#):
>
> there’s some discussion about allowing a zero in that setting so all deletions are prevented.

Can we make sure that zero setting gets supported next week @sam? And update the copy around the setting so people know it is there.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [8 בינואר,‏ 2021,‏ 3:08pm UTC](https://meta.discourse.org/t/restoring-deleted-messages/173647/8 "2021-01-08T15:08:34Z")

</div>

Done via:

[https://github.com/discourse/discourse/commit/25b4e82601abae40b2a82ac592f9a8153364fdf8](https://github.com/discourse/discourse/commit/25b4e82601abae40b2a82ac592f9a8153364fdf8)

Setting either `max_post_deletions_per_minute` or `max_post_deletions_per_day` to `0` will disable self deletion of posts.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [11 בינואר,‏ 2021,‏ 9:27am UTC](https://meta.discourse.org/t/restoring-deleted-messages/173647/9 "2021-01-11T09:27:54Z")

</div>


