From 864d40bea760158f678ad678bafad28c2ee555c0 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt <sean@lbry.io> Date: Thu, 22 Apr 2021 01:54:54 -0400 Subject: [PATCH 1/2] superchat support --- dist/bundle.es.js | 18 ++++++++++-------- src/redux/actions/wallet.js | 26 ++++++++++++++------------ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 9474043..d32a48b 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -3117,7 +3117,7 @@ function doSetDraftTransactionAddress(address) { }; } -function doSendTip(params, isSupport, successCallback, errorCallback) { +function doSendTip(params, isSupport, successCallback, errorCallback, shouldNotify = true) { return (dispatch, getState) => { const state = getState(); const balance = selectBalance(state); @@ -3133,19 +3133,21 @@ function doSendTip(params, isSupport, successCallback, errorCallback) { return; } - const success = () => { - dispatch(doToast({ - message: shouldSupport ? __('You deposited %amount% LBRY Credits as a support!', { amount: params.amount }) : __('You sent %amount% LBRY Credits as a tip, Mahalo!', { amount: params.amount }), - linkText: __('History'), - linkTarget: '/wallet' - })); + const success = response => { + if (shouldNotify) { + dispatch(doToast({ + message: shouldSupport ? __('You deposited %amount% LBRY Credits as a support!', { amount: params.amount }) : __('You sent %amount% LBRY Credits as a tip, Mahalo!', { amount: params.amount }), + linkText: __('History'), + linkTarget: '/wallet' + })); + } dispatch({ type: SUPPORT_TRANSACTION_COMPLETED }); if (successCallback) { - successCallback(); + successCallback(response); } }; diff --git a/src/redux/actions/wallet.js b/src/redux/actions/wallet.js index 8d73e90..97254df 100644 --- a/src/redux/actions/wallet.js +++ b/src/redux/actions/wallet.js @@ -349,7 +349,7 @@ export function doSetDraftTransactionAddress(address) { }; } -export function doSendTip(params, isSupport, successCallback, errorCallback) { +export function doSendTip(params, isSupport, successCallback, errorCallback, shouldNotify = true) { return (dispatch, getState) => { const state = getState(); const balance = selectBalance(state); @@ -368,23 +368,25 @@ export function doSendTip(params, isSupport, successCallback, errorCallback) { return; } - const success = () => { - dispatch( - doToast({ - message: shouldSupport - ? __('You deposited %amount% LBRY Credits as a support!', { amount: params.amount }) - : __('You sent %amount% LBRY Credits as a tip, Mahalo!', { amount: params.amount }), - linkText: __('History'), - linkTarget: '/wallet', - }) - ); + const success = response => { + if (shouldNotify) { + dispatch( + doToast({ + message: shouldSupport + ? __('You deposited %amount% LBRY Credits as a support!', { amount: params.amount }) + : __('You sent %amount% LBRY Credits as a tip, Mahalo!', { amount: params.amount }), + linkText: __('History'), + linkTarget: '/wallet', + }) + ); + } dispatch({ type: ACTIONS.SUPPORT_TRANSACTION_COMPLETED, }); if (successCallback) { - successCallback(); + successCallback(response); } }; From b11687e2952771c8d5ec91ff87235d20359027a8 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt <sean@lbry.io> Date: Thu, 22 Apr 2021 14:13:10 -0400 Subject: [PATCH 2/2] remove unused comment types --- dist/flow-typed/Lbry.js | 10 ---------- flow-typed/Lbry.js | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/dist/flow-typed/Lbry.js b/dist/flow-typed/Lbry.js index 326b3c6..0225fa2 100644 --- a/dist/flow-typed/Lbry.js +++ b/dist/flow-typed/Lbry.js @@ -124,14 +124,6 @@ declare type ChannelUpdateResponse = GenericTxResponse & { declare type CommentCreateResponse = Comment; declare type CommentUpdateResponse = Comment; -declare type CommentListResponse = { - items: Array<Comment>, - page: number, - page_size: number, - total_items: number, - total_pages: number, -}; - declare type MyReactions = { // Keys are the commentId [string]: Array<string>, @@ -308,8 +300,6 @@ declare type LbryTypes = { preference_set: (params: {}) => Promise<any>, // Commenting - comment_list: (params: {}) => Promise<CommentListResponse>, - comment_create: (params: {}) => Promise<CommentCreateResponse>, comment_update: (params: {}) => Promise<CommentUpdateResponse>, comment_hide: (params: {}) => Promise<CommentHideResponse>, comment_abandon: (params: {}) => Promise<CommentAbandonResponse>, diff --git a/flow-typed/Lbry.js b/flow-typed/Lbry.js index 326b3c6..0225fa2 100644 --- a/flow-typed/Lbry.js +++ b/flow-typed/Lbry.js @@ -124,14 +124,6 @@ declare type ChannelUpdateResponse = GenericTxResponse & { declare type CommentCreateResponse = Comment; declare type CommentUpdateResponse = Comment; -declare type CommentListResponse = { - items: Array<Comment>, - page: number, - page_size: number, - total_items: number, - total_pages: number, -}; - declare type MyReactions = { // Keys are the commentId [string]: Array<string>, @@ -308,8 +300,6 @@ declare type LbryTypes = { preference_set: (params: {}) => Promise<any>, // Commenting - comment_list: (params: {}) => Promise<CommentListResponse>, - comment_create: (params: {}) => Promise<CommentCreateResponse>, comment_update: (params: {}) => Promise<CommentUpdateResponse>, comment_hide: (params: {}) => Promise<CommentHideResponse>, comment_abandon: (params: {}) => Promise<CommentAbandonResponse>,