Skip to main content

Edit Comment

The LikeMinds Android Feed SDK empowers members to edit their own comments.

note

Community Managers can also edit the comments of other members.

Steps to edit a comment

  1. Create a EditCommentRequest object using EditCommentRequest.Builder class by passing all the required parameters.
  2. Call editComment() function using the instance of LMFeedClient.
  3. Process the response (LMResponse<EditCommentResponse>) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of EditCommentRequest
val editCommentRequest = EditCommentRequest.Builder()
.postId("ENTER POST ID") // post id of the comment to be edited
.commentId("ENTER COMMENT ID") // id of the comment to be edited
.text("ENTER COMMENT TEXT") // updated text of the comment
.build()
// get response (LMResponse<EditCommentResponse>)
val response = LMFeedClient.getInstance().editComment(editCommentRequest)
if (response.success) {
// your function to process the response data
processEditCommentResponse(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}
note

Same function can be used to edit a reply as well. Just pass the id of the reply as comment id.

note

You must send the text as it is if you don't want to update it, otherwise the text will be set to empty.

Models

EditCommentRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
postIdStringPost ID of the comment to be edited.
commentIdStringID of the comment to be edited.
textStringUpdated text content of the comment.

EditCommentResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
commentCommentObject of the updated comment.
usersMap<String, User>Map of user unique id to user object.