What be happen to post or topic when we delete it?

As far as I know, when we delete a post or a topic, the deletion is soft-removal first, and after the defined time has elapsed, the deletion is complete.

Given that the removal process takes place in several stages, the following questions are posed to me, and since I did not find a comprehensive topic in my search, I wrote my questions here:

  1. Will site statistics decrease after deleting the posts?
    For example, likes counts or the number of posts.

  2. Is the number of deleted posts and topics owned by a user recorded somewhere? Or do these numbers change after deletion and after a while?
    We want to define a badge for the users who make the most requests to delete their topics. for example, every time, 10 topics/month are removed from the user, a badge is given to him.

  3. Will all messages in the topic be deleted after the topic removal? How do other users see this in their profile activity? (during soft-removal and after that)

  4. If a badge is assigned to a user because of activity in a topic, what happens to the badge if the topic is deleted? What happens to the given badges to other users who replied to the topic?

  5. What effects does deleting the topic and post have on the user’s trust level? (especially for tl3)

  6. Does deleting low-value topics with a large number of posts help overall performance improvements?

  7. When the administrator enters a user’s profile, the number of deleted posts of that user is listed above the profile. Will this number increase if the posts are deleted due to the deletion of another user’s topic?

If anyone knows the exact answer to these questions, please write here for me and others who will be looking for their questions later. Also, if anyone has a question about the effects of deleting a topic or post, please ask here.

:warning: For more clarity, please answer all the questions in different stages. Soft delete, revision and meta deletion, complete deletion from the database :pray: :blush:

Yes, almost all statistics are based on non-deleted topics and posts. One exception to this is for queries that are run in the Data Explorer plugin. For those queries, you need to explicitly set a WHERE deleted_at is NULL condition to avoid pulling in data from deleted topics and posts.

Yes, a user’s deleted post count is recorded. The only place that I know of where it’s displayed in the user interface is when a user’s summary page is viewed by a staff user. In that case, they will see something like this:

No, when a topic is deleted, only the first post in the topic is deleted. Unless the topic is restored, there is no way to see the remaining posts.

Most of the Discourse badges run a daily revocation query to see if the badge should be removed from the user. If the topic or post that they were granted the badge for has been deleted, the badge will be revoked.

Having deleted posts has no effect on a users trust level. Deleting posts can be very useful for keeping topics readable. A good example of that is how we deal with documentation topics. If anything in a documentation topic is unclear, readers can reply to the topic to ask for clarification. Replies to these questions can be incorporated into the topic’s first post. When that has been done, it’s best to delete the replies to prevent the topic from becoming unreadable.

The number that you see is is the actual number of deleted posts. Since deleting a topic does not delete replies to the topic, the number will not increase.

One other thing that’s useful for site staff is knowing how to search for deleted topics. That can be done by adding the ?status=deleted query parameter to the URL for a Discourse topic list.

Complete deletion from the database is possible, but it is not recommended. Unless it’s done correctly you risk causing problems with site stats.

5 Likes

Thanks for your comprehensive answer

According to your explanation, if I understood correctly, the topic information will never be deleted from the database (except manually) and can always be recovered. But if posts are deleted, they will be deleted from the database and only their statistics will remain. The text of the posts is no longer available after complete deletion.

As long as a topic is not manually deleted from the database, we can have the statistics of a user’s deleted posts and topics and write the queries we need.

And in answer to question 6th, it can be said that deleting large topics has no effect on improving the speed and performance of the system. Unless they are removed from the database manually by accepting the risk.

Does the same thing happen with private messages?

1 Like