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
- Create a EditCommentRequest object using
EditCommentRequest.Builder
class by passing all the required parameters. - Call
editComment()
function using the instance ofLMFeedClient
. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
postId | String | Post ID of the comment to be edited. | |
commentId | String | ID of the comment to be edited. | |
text | String | Updated text content of the comment. |
EditCommentResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
comment | Comment | Object of the updated comment. | |
users | Map<String, User> | Map of user unique id to user object. |