Delete Comment
In the LikeMinds iOS Feed SDK, users have the capability to delete their own comments. This functionality allows members to easily remove their comments from the discussion thread or post, providing them with control over their contributions and ensuring a clean and organized conversation environment. Deleting a comment is a straightforward process, giving users the ability to manage and curate their own content within the application.
note
Community Managers can also delete the comments of other members, but a reason is required.
Steps to delete a comment
- Create a DeleteCommentRequest object using
DeleteCommentRequest.builder()
class by passing all the required parameters. - Call
deleteComment()
function using the instance ofLMFeedClient
. - Process the response LMResponse<NoData> as per your requirement.
// object of DeleteCommentRequest
let request = DeleteCommentRequest.builder()
.postId(ENTER_POST_ID) // post id of the comment to be deleted
.commentId(ENTER_COMMENT_ID) // id of the comment to be deleted
.deleteReason("Reason for comment deletion") // reason for deletion required when Community Manager deletes others comment
.build()
LMFeedClient.shared.deleteComment(request) { response in
// get response (LMResponse<NoData>)
if (response.success) {
// your function to process comment deleted action
processResponse()
} else {
// your function to process error message
processError(response.errorMessage)
}
}
note
Same function can be used to delete a reply as well. Just pass the id of the reply as comment id.
Models
DeleteCommentRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
postId | String | Post id of the comment to be deleted | |
commentId | String | Unique id of the comment to be deleted. | |
reason | String | Reason for comment deletion. |
note
reason
is only required when Community Manager deletes other members comment.