separating permlink prefix for comments and waves

This commit is contained in:
Nouman Tahir 2023-09-22 17:37:25 +05:00
parent d190ecd3d2
commit 16982b1ab0
2 changed files with 10 additions and 4 deletions

View File

@ -1,7 +1,7 @@
import { useDispatch } from "react-redux";
import { useAppSelector } from "../../hooks";
import { postComment } from "../../providers/hive/dhive";
import { extractMetadata, generateReplyPermlink, makeJsonMetadata } from "../../utils/editor";
import { extractMetadata, generateUniquePermlink, makeJsonMetadata } from "../../utils/editor";
import { Alert } from "react-native";
import { updateCommentCache } from "../../redux/actions/cacheActions";
import { toastNotification } from "../../redux/actions/uiAction";
@ -10,6 +10,7 @@ import { useState } from "react";
import { useUserActivityMutation, wavesQueries } from "../../providers/queries";
import { PointActivityIds } from "../../providers/ecency/ecency.types";
import { usePublishWaveMutation } from "../../providers/queries/postQueries/wavesQueries";
import { PostTypes } from "../../constants/postTypes";
export const usePostSubmitter = () => {
@ -38,7 +39,10 @@ export const usePostSubmitter = () => {
if (currentAccount) {
setIsSending(true);
const permlink = generateReplyPermlink(parentPost.author);
const _prefix = postType === PostTypes.WAVE
? postType
: `re-${parentPost.author.replace(/\./g, '')}`
const permlink = generateUniquePermlink(_prefix);
const author = currentAccount.name;
const parentAuthor = parentPost.author;
const parentPermlink = parentPost.permlink;

View File

@ -26,12 +26,12 @@ import { default as ROUTES } from '../../../constants/routeNames';
// Utilities
import {
generatePermlink,
generateReplyPermlink,
makeJsonMetadata,
makeOptions,
extractMetadata,
makeJsonMetadataForUpdate,
createPatch,
generateUniquePermlink,
} from '../../../utils/editor';
// import { generateSignature } from '../../../utils/image';
@ -707,7 +707,9 @@ class EditorContainer extends Component<EditorContainerProps, any> {
});
const { post } = this.state;
const permlink = generateReplyPermlink(post.author);
const _prefix = `re-${post.author.replace(/\./g, '')}`
const permlink = generateUniquePermlink(_prefix);
const parentAuthor = post.author;
const parentPermlink = post.permlink;