Skip to main content
social.plus’s social SDK provides two types of post deletion: soft delete and hard delete. This flexibility allows developers to choose the appropriate deletion method based on their specific use case and data retention requirements.

Soft Delete

Mark posts as deleted while preserving data for potential recovery

Hard Delete

Permanently remove posts and all associated data from the database

Permission Control

Only post owners and admins can delete posts

Data Management

Choose the right deletion type for your data policies

Deletion Types Overview

How it works: The post is marked as deleted with the isDeleted flag set to true in the database.Data Preservation:
  • Post content remains in the database
  • Associated reactions and comments are preserved
  • Child posts (media attachments) are maintained
  • Post becomes invisible to users but can be recovered
Use Cases:
  • Content moderation with historical data retention
  • Data analysis and audit trails
  • Compliance with data retention policies
How it works: All associated data is permanently removed from the database.Data Removal:
  • Post content is completely deleted
  • All reactions are permanently removed
  • All comments are permanently deleted
  • Child posts and media attachments are removed
  • Irreversible: Data cannot be recovered after hard deletion
Use Cases:
  • GDPR compliance and “right to be forgotten”
  • Permanent removal of harmful content
  • Platform cleanup and storage optimization
  • User privacy protection

Implementation

// Hard Delete a post
do {
    let result = try await postRepository.hardDeletePost(
        withId: "<post-id>", 
        parentId: "<parent-post-id>"
    )
    print("Post hard deleted successfully")
} catch {
    // Handle error here
    print("Failed to hard delete post: \(error)")
}
Default Behavior: If no deletion type is specified in older SDK versions (v5 and below), the default behavior is soft deletion.

Access Levels

  • Own Posts: Can soft delete or hard delete their own posts
  • Content Control: Full control over their published content
  • Data Privacy: Can choose the level of data removal
  • Any Post: Can delete any post on the platform
  • Moderation Authority: Can remove policy-violating content
  • Data Management: Can perform bulk deletion operations
  • Community Posts: Can delete posts within their moderated communities
  • Local Authority: Limited to specific community boundaries
  • Escalation Path: Can escalate to admins for platform-level actions
  • Guidelines Enforcement: Remove content violating community rules

Platform Availability

SDK Only: Hard deletion is only supported via the SDK and API at this time and is not yet available in the UIKit or Console. Use the PostRepository to specify the post ID and desired deletion type.
  • SDK: Full support for both soft and hard deletion
  • API: Direct API access supports both deletion types
  • Custom Implementation: Developers can build custom deletion interfaces
  • UIKit: Currently limited to soft deletion only
  • Console: Admin console has limited deletion options
  • Third-party Tools: May not support hard deletion features

Important Considerations

File Handling: Please note that files attached to posts will not be automatically deleted when the post is deleted. You may need to implement separate file cleanup processes if required.

Best Practices

  • Default to Soft: Use soft deletion as default for content moderation
  • Hard Delete for Privacy: Use hard deletion for privacy and legal compliance
  • Clear Policies: Establish clear guidelines for when to use each type
  • User Communication: Inform users about deletion policies and options
  • Permission Validation: Always verify user permissions before deletion
  • Confirmation Dialogs: Require explicit confirmation for hard deletions
  • Error Handling: Implement robust error handling for deletion failures
  • Regular Cleanup: Implement scheduled cleanup of soft-deleted content
  • File Management: Create processes for handling orphaned files
  • Backup Strategy: Maintain appropriate backups before hard deletions
  • Compliance Monitoring: Track deletion activities for regulatory compliance

Common Use Cases

Content Moderation

Remove inappropriate or policy-violating posts

User Privacy

Allow users to remove their own content

GDPR Compliance

Permanently delete user data upon request

Platform Cleanup

Remove spam or test content