From 0262e7749824669364d7877f4c898598d86ae245 Mon Sep 17 00:00:00 2001 From: Elliot Braem <16282460+elliotBraem@users.noreply.github.com> Date: Wed, 17 Jan 2024 19:24:35 -0500 Subject: [PATCH] posts legacy --- .../entity/addon/blog/editor/provider.jsx | 4 ++-- src/devhub/entity/post/Panel.jsx | 18 ++++++++---------- src/devhub/entity/post/Post.jsx | 2 +- src/devhub/entity/post/PostEditor.jsx | 6 +++--- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/devhub/entity/addon/blog/editor/provider.jsx b/src/devhub/entity/addon/blog/editor/provider.jsx index 39bc711f6..6899f5ae9 100644 --- a/src/devhub/entity/addon/blog/editor/provider.jsx +++ b/src/devhub/entity/addon/blog/editor/provider.jsx @@ -94,7 +94,7 @@ const handleOnSubmit = (v, isEdit) => { console.log(isEdit); if (isEdit) { Near.call({ - contractName: "${REPL_DEVHUB_CONTRACT}", + contractName: "${REPL_DEVHUB_LEGACY}", methodName: "edit_post", args: { id: v.id, @@ -109,7 +109,7 @@ const handleOnSubmit = (v, isEdit) => { }); } else { Near.call({ - contractName: "${REPL_DEVHUB_CONTRACT}", + contractName: "${REPL_DEVHUB_LEGACY}", methodName: "add_post", args: { labels: ["blog", handle], diff --git a/src/devhub/entity/post/Panel.jsx b/src/devhub/entity/post/Panel.jsx index ef4742f32..0638a5ae8 100644 --- a/src/devhub/entity/post/Panel.jsx +++ b/src/devhub/entity/post/Panel.jsx @@ -521,16 +521,14 @@ const search = (processedQueryArray, index) => { const amountOfResultsToShowFirst = 5; const buildPostsIndex = () => { - return Near.asyncView("${REPL_DEVHUB_CONTRACT}", "get_posts").then( - (posts) => { - const index = buildIndex(posts); - const data = posts.reduce((acc, post) => { - acc[post.id] = post; - return acc; - }, {}); - return { index, data }; - } - ); + return Near.asyncView("${REPL_DEVHUB_LEGACY}", "get_posts").then((posts) => { + const index = buildIndex(posts); + const data = posts.reduce((acc, post) => { + acc[post.id] = post; + return acc; + }, {}); + return { index, data }; + }); }; const getProcessedPostsCached = () => { diff --git a/src/devhub/entity/post/Post.jsx b/src/devhub/entity/post/Post.jsx index 1ece0790d..416097207 100644 --- a/src/devhub/entity/post/Post.jsx +++ b/src/devhub/entity/post/Post.jsx @@ -308,7 +308,7 @@ const onLike = () => { contractName: "${REPL_SOCIAL_CONTRACT}", methodName: "grant_write_permission", args: { - predecessor_id: "${REPL_DEVHUB_CONTRACT}", + predecessor_id: "${REPL_DEVHUB_LEGACY}", keys: [context.accountId + "/index/notify"], }, gas: Big(10).pow(14), diff --git a/src/devhub/entity/post/PostEditor.jsx b/src/devhub/entity/post/PostEditor.jsx index 2b35df226..43f8908e3 100644 --- a/src/devhub/entity/post/PostEditor.jsx +++ b/src/devhub/entity/post/PostEditor.jsx @@ -345,7 +345,7 @@ const onSubmit = () => { Object.assign({}, state, { parent_post_id: parentId }) ); txn.push({ - contractName: "${REPL_DEVHUB_CONTRACT}", + contractName: "${REPL_DEVHUB_LEGACY}", methodName: "add_post", args: { parent_id: parentId, @@ -359,7 +359,7 @@ const onSubmit = () => { Object.assign({}, state, { edit_post_id: postId }) ); txn.push({ - contractName: "${REPL_DEVHUB_CONTRACT}", + contractName: "${REPL_DEVHUB_LEGACY}", methodName: "edit_post", args: { id: postId, @@ -375,7 +375,7 @@ const onSubmit = () => { contractName: "${REPL_SOCIAL_CONTRACT}", methodName: "grant_write_permission", args: { - predecessor_id: "${REPL_DEVHUB_CONTRACT}", + predecessor_id: "${REPL_DEVHUB_LEGACY}", keys: [context.accountId + "/index/notify"], }, gas: Big(10).pow(14),