Fix repost deletion

This commit is contained in:
saltrafael 2021-06-17 14:57:04 -03:00 committed by Thomas Zarebczan
parent 97762fdd24
commit 360f64e71f
4 changed files with 17 additions and 5 deletions

View file

@ -97,7 +97,7 @@ function ClaimMenuList(props: Props) {
const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0));
const subscriptionLabel = isSubscribed ? __('Unfollow') : __('Follow');
const { push, replace } = useHistory();
const { push } = useHistory();
if (!claim) {
return null;
}
@ -166,7 +166,7 @@ function ClaimMenuList(props: Props) {
if (!isRepost && !isChannel) {
openModal(MODALS.CONFIRM_FILE_REMOVE, { uri });
} else {
openModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim, cb: !isRepost && (() => replace(`/$/${PAGES.CHANNELS}`)) });
openModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim });
}
}

View file

@ -288,7 +288,11 @@ function RepostCreate(props: Props) {
}).then((repostClaim: StreamClaim) => {
doCheckPendingClaims();
analytics.apiLogPublish(repostClaim);
doToast({ message: __('Woohoo! Successfully reposted this claim.') });
doToast({
message: __('Woohoo! Successfully reposted this claim.'),
linkText: __('Uploads'),
linkTarget: '/uploads',
});
replace(getRedirect(contentUri, uri, redirectUri));
});
}

View file

@ -1,6 +1,6 @@
import { connect } from 'react-redux';
import { doHideModal } from 'redux/actions/app';
import { doAbandonTxo, doAbandonClaim, selectTransactionItems } from 'lbry-redux';
import { doAbandonTxo, doAbandonClaim, selectTransactionItems, doResolveUri } from 'lbry-redux';
import { doToast } from 'redux/actions/notifications';
import ModalRevokeClaim from './view';
@ -13,6 +13,7 @@ const perform = dispatch => ({
closeModal: () => dispatch(doHideModal()),
abandonTxo: (txo, cb) => dispatch(doAbandonTxo(txo, cb)),
abandonClaim: (txid, nout, cb) => dispatch(doAbandonClaim(txid, nout, cb)),
doResolveUri: (uri) => dispatch(doResolveUri(uri)),
});
export default connect(select, perform)(ModalRevokeClaim);

View file

@ -15,13 +15,20 @@ type Props = {
tx: Txo,
claim: GenericClaim,
cb: () => void,
doResolveUri: (string) => void,
};
export default function ModalRevokeClaim(props: Props) {
const { tx, claim, closeModal, abandonTxo, abandonClaim, cb } = props;
const { tx, claim, closeModal, abandonTxo, abandonClaim, cb, doResolveUri } = props;
const { value_type: valueType, type, normalized_name: name, is_my_input: isSupport } = tx || claim;
const [channelName, setChannelName] = useState('');
React.useEffect(() => {
if (claim) {
doResolveUri(claim.permanent_url);
}
}, [claim, doResolveUri]);
const shouldConfirmChannel =
valueType === txnTypes.CHANNEL || type === txnTypes.CHANNEL || (type === txnTypes.UPDATE && name.startsWith('@'));