Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
3mp8r3 committed Jul 21, 2023
1 parent 30dfa93 commit 4ef4882
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
8 changes: 6 additions & 2 deletions go/internal/indexerhandler/feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,16 @@ func (h *Handler) createAIAnswer(e *Message, metadata map[string]interface{}, cr
return errors.Wrap(err4, "failed to get block time")
}
u := uuid.New()
metadata["message"] = answer
newMetaData := make(map[string]interface{})
for k, v := range metadata {
newMetaData[k] = v
}
newMetaData["message"] = answer
post := indexerdb.Post{
Identifier: u.String(),
ParentPostIdentifier: createPostMsg.Identifier,
Category: 1, //Comment
Metadata: metadata,
Metadata: newMetaData,
UserReactions: map[string]interface{}{},
CreatedBy: "",
CreatedAt: createdAt.Unix(),
Expand Down
18 changes: 17 additions & 1 deletion packages/screens/FeedPostView/FeedPostViewScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ export const FeedPostViewScreen: ScreenFC<"FeedPostView"> = ({
});
const isNextPageAvailable = useSharedValue(hasNextPage);
const isLoadingSharedValue = useSharedValue(true);
const postResultWithBot = useMemo(() => {
if (
postResult &&
botData &&
botData.pages.length > 0 &&
botData.pages[0]!.list!.length > 0
) {
postResult.sub_post_length = postResult.sub_post_length + 1;
return postResult;
} else {
return postResult;
}
}, [postResult, botData]);

useEffect(() => {
isLoadingSharedValue.value = isLoadingPostResult || isLoadingComments;
Expand Down Expand Up @@ -243,7 +256,10 @@ export const FeedPostViewScreen: ScreenFC<"FeedPostView"> = ({
borderRightWidth: 0,
}
}
post={postResultToPost(selectedNetworkId, postResult)}
post={postResultToPost(
selectedNetworkId,
postResultWithBot
)}
isPostConsultation
onPressReply={onPressReply}
/>
Expand Down

0 comments on commit 4ef4882

Please sign in to comment.