injecting image urls and ratios in comment metadata

This commit is contained in:
Nouman Tahir 2023-10-17 17:28:25 +05:00
parent 65b0ff5c3b
commit 8caee49a71
3 changed files with 12 additions and 6 deletions

View File

@ -78,7 +78,6 @@ export const usePostSubmitter = () => {
parentPermlink,
permlink,
commentBody,
[],
jsonMetadata
)

View File

@ -1509,8 +1509,7 @@ export const postComment = (
parentPermlink,
permlink,
body,
parentTags,
jsonMetadata = null,
jsonMetadata,
) =>
_postContent(
account,
@ -1520,7 +1519,7 @@ export const postComment = (
permlink,
'',
body,
jsonMetadata ? jsonMetadata : makeJsonMetadataReply(parentTags || ['ecency']),
jsonMetadata,
null,
null,
)

View File

@ -49,6 +49,7 @@ import bugsnapInstance from '../../../config/bugsnag';
import { useUserActivityMutation } from '../../../providers/queries/pointQueries';
import { PointActivityIds } from '../../../providers/ecency/ecency.types';
import { usePostsCachePrimer } from '../../../providers/queries/postQueries/postQueries';
import { PostTypes } from '../../../constants/postTypes';
/*
* Props Name Description Value
@ -716,6 +717,13 @@ class EditorContainer extends Component<EditorContainerProps, any> {
const parentTags = post.json_metadata.tags;
const draftId = `${currentAccount.name}/${parentAuthor}/${parentPermlink}`; // different draftId for each user acount
const meta = await extractMetadata({
body: fields.body,
fetchRatios: true,
postType: PostTypes.COMMENT
})
const jsonMetadata = makeJsonMetadata(meta, parentTags || ['ecency'])
await postComment(
currentAccount,
pinCode,
@ -723,7 +731,7 @@ class EditorContainer extends Component<EditorContainerProps, any> {
parentPermlink,
permlink,
fields.body,
parentTags,
jsonMetadata
)
.then((response) => {
// record user activity for points
@ -1135,7 +1143,7 @@ class EditorContainer extends Component<EditorContainerProps, any> {
handleShouldReblogChange={this._handleShouldReblogChange}
handleSchedulePress={this._handleSchedulePress}
handleFormChanged={this._handleFormChanged}
handleOnBackPress={() => {}}
handleOnBackPress={() => { }}
handleOnSubmit={this._handleSubmit}
initialEditor={this._initialEditor}
isDarkTheme={isDarkTheme}