Edit Comment
The LikeMinds React Feed SDK, users can engage in interactive discussions by adding comments to posts. This feature enables users to express their thoughts, ask questions, and engage with other members in a dynamic and collaborative manner.
Steps to edit a comment on post
- Use the
editComment()
function provided by thelmFeedClient
object created earlier. - Create an instance of
EditCommentRequest
, as shown in the snippet and pass it to the above method. - Use the response as per your requirement
try {
const editCommentRequest = EditCommentRequest.builder()
.setPostId("<ENTER_POST_ID>") // Id of the post on which member has commented
.setCommentId("<ENTER_COMMENT_ID>") // Enter comment id
.setText("Update Text")
.build();
const response = await lmFeedClient.editComment(editCommentRequest);
// Use the response as per your requirement.
} catch (error) {
// Use the error as per your requirement.
}
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 | Reply | Object of the added comment. | |
users | Record<string, User> | Map of user unique id to user object. | ✔️ |