fix: add back lost code from bad rebase

This commit is contained in:
Sean Yesmunt 2019-08-13 23:52:17 -04:00
parent 58bbdb9a2e
commit 4e093983ea
2 changed files with 9 additions and 9 deletions

8
dist/bundle.es.js vendored
View file

@ -1936,13 +1936,13 @@ function doSetDraftTransactionAddress(address) {
}; };
} }
function doSendTip(amount, claimId, successCallback, errorCallback) { function doSendTip(amount, claimId, isSupport, successCallback, errorCallback) {
return (dispatch, getState) => { return (dispatch, getState) => {
const state = getState(); const state = getState();
const balance = selectBalance(state); const balance = selectBalance(state);
const myClaims = selectMyClaimsRaw(state); const myClaims = selectMyClaimsRaw(state);
const isSupport = myClaims.find(claim => claim.claim_id === claimId); const shouldSupport = isSupport || myClaims.find(claim => claim.claim_id === claimId);
if (balance - amount <= 0) { if (balance - amount <= 0) {
dispatch(doToast({ dispatch(doToast({
@ -1954,7 +1954,7 @@ function doSendTip(amount, claimId, successCallback, errorCallback) {
const success = () => { const success = () => {
dispatch(doToast({ dispatch(doToast({
message: isSupport ? __(`You deposited ${amount} LBC as a support!`) : __(`You sent ${amount} LBC as a tip, Mahalo!`), message: shouldSupport ? __(`You deposited ${amount} LBC as a support!`) : __(`You sent ${amount} LBC as a tip, Mahalo!`),
linkText: __('History'), linkText: __('History'),
linkTarget: __('/wallet') linkTarget: __('/wallet')
})); }));
@ -1993,7 +1993,7 @@ function doSendTip(amount, claimId, successCallback, errorCallback) {
lbryProxy.support_create({ lbryProxy.support_create({
claim_id: claimId, claim_id: claimId,
amount: creditsToString(amount), amount: creditsToString(amount),
tip: isSupport ? false : true tip: !shouldSupport
}).then(success, error); }).then(success, error);
}; };
} }

View file

@ -209,13 +209,13 @@ export function doSetDraftTransactionAddress(address) {
}; };
} }
export function doSendTip(amount, claimId, successCallback, errorCallback) { export function doSendTip(amount, claimId, isSupport, successCallback, errorCallback) {
return (dispatch, getState) => { return (dispatch, getState) => {
const state = getState(); const state = getState();
const balance = selectBalance(state); const balance = selectBalance(state);
const myClaims: Array<Claim> = selectMyClaimsRaw(state); const myClaims = selectMyClaimsRaw(state);
const isSupport = myClaims.find(claim => claim.claim_id === claimId); const shouldSupport = isSupport || myClaims.find(claim => claim.claim_id === claimId);
if (balance - amount <= 0) { if (balance - amount <= 0) {
dispatch( dispatch(
@ -230,7 +230,7 @@ export function doSendTip(amount, claimId, successCallback, errorCallback) {
const success = () => { const success = () => {
dispatch( dispatch(
doToast({ doToast({
message: isSupport message: shouldSupport
? __(`You deposited ${amount} LBC as a support!`) ? __(`You deposited ${amount} LBC as a support!`)
: __(`You sent ${amount} LBC as a tip, Mahalo!`), : __(`You sent ${amount} LBC as a tip, Mahalo!`),
linkText: __('History'), linkText: __('History'),
@ -274,7 +274,7 @@ export function doSendTip(amount, claimId, successCallback, errorCallback) {
Lbry.support_create({ Lbry.support_create({
claim_id: claimId, claim_id: claimId,
amount: creditsToString(amount), amount: creditsToString(amount),
tip: isSupport ? false : true, tip: !shouldSupport,
}).then(success, error); }).then(success, error);
}; };
} }