mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-24 08:55:14 +03:00
re-added reverted content
This commit is contained in:
parent
494018c8ff
commit
d026f8c31f
@ -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";
|
||||
@ -30,7 +30,7 @@ export const usePostSubmitter = () => {
|
||||
// handle submit reply
|
||||
const _submitReply = async (commentBody: string, parentPost: any, postType: PostTypes = PostTypes.COMMENT) => {
|
||||
if (!commentBody) {
|
||||
return false ;
|
||||
return false;
|
||||
}
|
||||
if (isSending) {
|
||||
return false;
|
||||
@ -39,7 +39,11 @@ 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;
|
||||
@ -49,8 +53,9 @@ export const usePostSubmitter = () => {
|
||||
|
||||
//adding jsonmeta with image ratios here....
|
||||
const meta = await extractMetadata({
|
||||
body:commentBody,
|
||||
fetchRatios:true
|
||||
body: commentBody,
|
||||
fetchRatios: true,
|
||||
postType
|
||||
})
|
||||
const jsonMetadata = makeJsonMetadata(meta, parentTags || ['ecency'])
|
||||
|
||||
@ -138,15 +143,15 @@ export const usePostSubmitter = () => {
|
||||
|
||||
|
||||
//feteced lates wafves container and post wave to that container
|
||||
const _submitWave = async (body:string) => {
|
||||
const _submitWave = async (body: string) => {
|
||||
|
||||
try {
|
||||
const _wavesHost = 'ecency.waves' //TODO: make waves host selection dynamic
|
||||
const latestWavesPost = await wavesQueries.fetchLatestWavesContainer(_wavesHost);
|
||||
|
||||
const _cacheCommentData = await _submitReply(body, latestWavesPost)
|
||||
const _cacheCommentData = await _submitReply(body, latestWavesPost, PostTypes.WAVE)
|
||||
|
||||
if(_cacheCommentData){
|
||||
if (_cacheCommentData) {
|
||||
pusblishWaveMutation.mutate(_cacheCommentData)
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ import { default as ROUTES } from '../../../constants/routeNames';
|
||||
// Utilities
|
||||
import {
|
||||
generatePermlink,
|
||||
generateReplyPermlink,
|
||||
generateUniquePermlink,
|
||||
makeJsonMetadata,
|
||||
makeOptions,
|
||||
extractMetadata,
|
||||
@ -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;
|
||||
|
@ -215,10 +215,12 @@ export const extractMetadata = async ({
|
||||
body,
|
||||
thumbUrl,
|
||||
fetchRatios,
|
||||
postType,
|
||||
}: {
|
||||
body: string;
|
||||
thumbUrl?: string;
|
||||
fetchRatios?: boolean;
|
||||
postType?: PostTypes;
|
||||
}) => {
|
||||
// NOTE: keepting regex to extract usernames as reference for later usage if any
|
||||
// const userReg = /(^|\s)(@[a-z][-.a-z\d]+[a-z\d])/gim;
|
||||
|
Loading…
Reference in New Issue
Block a user