Text Editing
Update comment text content with full formatting support and validation
Image Management
Add, remove, or replace images with attachment validation
Edit Tracking
Automatic timestamp updates with transparent edit indicators
Permission Control
Strict ownership validation ensures users edit only their content
When editing comments, existing attachments are completely replaced. To preserve existing images, include them in the new attachments array.
Edit Permissions
Comment editing follows strict permission rules to maintain accountability and prevent unauthorized modifications.Permission Rule | Description | Enforcement |
---|---|---|
Owner Only | Users can only edit their own comments | Verified through userId comparison |
Not Deleted | Cannot edit comments marked as deleted | Checked via isDeleted status |
Content Validation | Text length and image format validation | Enforced before edit submission |
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
commentId | String | Yes | Unique identifier of the comment to edit |
text | String | No | Updated text content (max 50,000 characters) |
attachments | Array | No | Image attachments (replaces all existing attachments) |
metadata | Object | No | Custom metadata object for additional data |
When editing with attachments, all existing attachments are replaced. Include existing attachment IDs to preserve them.
Text Editing
Update comment text content while preserving metadata and maintaining edit history.Image Editing
Update comment attachments by replacing existing images with new ones. All images must be uploaded before editing.Image editing replaces ALL existing attachments. To preserve existing images, include their file IDs in the new attachments array.
Best Practices
Permission Validation
Always validate ownership and edit permissions before allowing users to modify comments.
Content Preservation
When editing with attachments, include existing file IDs to preserve desired media.
Error Handling
Implement comprehensive error handling for network, permission, and validation failures.
User Feedback
Provide clear feedback about edit status, limitations, and any validation errors.
Edit Indicators
Display edit timestamps and indicators to maintain transparency in conversations.
Offline Support
Queue edit operations for execution when connectivity is restored.