From 14da521229126f92051e0049a3e37fa01f164d6b Mon Sep 17 00:00:00 2001 From: emad-salah Date: Fri, 30 Oct 2020 13:22:01 +0100 Subject: [PATCH] Fixed post tips for new posts path --- services/gunDB/contact-api/jobs/onOrders.js | 4 +--- utils/lndJobs.js | 15 ++++----------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/services/gunDB/contact-api/jobs/onOrders.js b/services/gunDB/contact-api/jobs/onOrders.js index 3d9380c0..3a73dd73 100644 --- a/services/gunDB/contact-api/jobs/onOrders.js +++ b/services/gunDB/contact-api/jobs/onOrders.js @@ -51,7 +51,6 @@ const ordersProcessed = new Set() * @prop {import('shock-common').Schema.InvoiceState} state * @prop {string} targetType * @prop {(string)=} postID - * @prop {(number)=} postPage */ let currentOrderAddr = '' @@ -241,8 +240,7 @@ const listenerForAddr = (addr, SEA) => async (order, orderID) => { hash, state: 'OPEN', targetType: order.targetType, - postID: order.postID, - postPage: order.postPage + postID: order.postID } getUser() .get(Key.TIPS_PAYMENT_STATUS) diff --git a/utils/lndJobs.js b/utils/lndJobs.js index d5b36b11..a37cac78 100644 --- a/utils/lndJobs.js +++ b/utils/lndJobs.js @@ -39,10 +39,7 @@ const _lookupInvoice = hash => const _getPostTipInfo = ({ postID, page }) => new Promise((resolve, reject) => { getUser() - .get(Key.WALL) - .get(Key.PAGES) - .get(page) - .get(Key.POSTS) + .get(Key.POSTS_NEW) .get(postID) .once(post => { if (post && post.date) { @@ -58,7 +55,7 @@ const _getPostTipInfo = ({ postID, page }) => }) }) -const _incrementPost = ({ postID, page, orderAmount }) => +const _incrementPost = ({ postID, orderAmount }) => new Promise((resolve, reject) => { const parsedAmount = parseFloat(orderAmount) @@ -69,7 +66,7 @@ const _incrementPost = ({ postID, page, orderAmount }) => Logger.info('[POST TIP] Getting Post Tip Values...') - return _getPostTipInfo({ postID, page }) + return _getPostTipInfo({ postID }) .then(({ tipValue, tipCounter }) => { const updatedTip = { tipCounter: tipCounter + 1, @@ -77,10 +74,7 @@ const _incrementPost = ({ postID, page, orderAmount }) => } getUser() - .get(Key.WALL) - .get(Key.PAGES) - .get(page) - .get(Key.POSTS) + .get(Key.POSTS_NEW) .get(postID) .put(updatedTip, () => { Logger.info('[POST TIP] Successfully updated Post tip info') @@ -158,7 +152,6 @@ const executeTipAction = (tip, invoice) => { if (tip.targetType === 'post') { _incrementPost({ postID: tip.postID, - page: tip.postPage, orderAmount: invoice.amt_paid_sat }) }