Delete Post
There are two kinds of post deletion:
  1. 1.
    Soft delete
    The post is only marked as deleted. This means that the post still exists in the database but the isDeleted flag is set to true.
  2. 2.
    Hard delete
    The post data, along with its reactions, comments, children posts, and children of children posts data are removed from the database. Thus, all data related to the post will be lost and irretrievable. Hard deleting children post will not delete the parent post.
    Hard deleting posts, as well as comments, is only supported via SDK. UIKit and Console support may be considered in the future.
AmityPostRepository provides another convenient method to delete post. To delete the post, you just need the post id. If you are deleting child post, you need to pass the parent id too. If it is the parent post, just pass nil.
You also need to pass a boolean parameter which is set to true for hard delete and false for soft delete. Below is the sample code for both hard delete and soft delete.
Delete a post
Only the post owner or an admin can update and/or delete a post.
Export as PDF
Copy link