social.plus SDK provides comprehensive comment deletion functionality to help you maintain community standards and data management. Choose between soft delete for moderation workflows or hard delete for permanent data removal based on your application’s needs.

Soft Delete

Hide comments while preserving data for moderation workflows and audit trails

Hard Delete

Permanently remove comment data, reactions, and replies from the system

Moderation Control

Manage flagged content with appropriate deletion methods

Permission Rules

Users can delete their own comments, moderators can delete any comment
Hard delete permanently removes all comment data including reactions and replies. This action cannot be undone.

Deletion Types

Understanding when to use soft delete versus hard delete is crucial for effective content moderation and data management.
Deletion TypeUse CaseData RetentionReversibleBest For
Soft DeleteContent moderation, policy violationsData preserved with isDeleted: trueYesFlagged content, temporary removal
Hard DeleteInappropriate content, GDPR complianceData permanently removedNoSpam, severe violations, data purging
Soft delete is the default behavior when the hardDelete parameter is not specified or set to false.

Parameters

ParameterTypeRequiredDescription
commentIdStringYesUnique identifier of the comment to delete
hardDeleteBooleanNotrue for permanent removal, false for soft delete (default)
Soft deleted comments can maintain their position in a collection and preserve all metadata for audit purposes.
// Hard Delete a comment
do {
    let success = try await commentRepository.hardDeleteComment(withId: "<comment-id>")
} catch {
    // Handle error here
}

// Soft Delete a comment
do {
    let success = try await commentRepository.softDeleteComment(withId: "<comment-id>")
} catch {
    // Handle error here
}
Hard delete removes ALL associated data including:
  • Comment text and metadata
  • All reactions and reactions metadata
  • All replies to the comment
  • File attachments and media
  • Engagement analytics data

Best Practices

Use Soft Delete First

Start with soft delete for most moderation cases to preserve data for audit purposes.

Confirm Hard Deletes

Always show confirmation dialogs before permanent deletions to prevent accidental data loss.

Permission Checks

Validate user permissions before allowing any deletion operations to maintain security.

UI Feedback

Provide clear visual feedback about deletion status and any errors that occur during the process.