Skip to content

Commit

Permalink
posts legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed Jan 18, 2024
1 parent 74b46e2 commit 0262e77
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/devhub/entity/addon/blog/editor/provider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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],
Expand Down
18 changes: 8 additions & 10 deletions src/devhub/entity/post/Panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/devhub/entity/post/Post.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 3 additions & 3 deletions src/devhub/entity/post/PostEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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),
Expand Down

0 comments on commit 0262e77

Please sign in to comment.