delete repost

This commit is contained in:
saltrafael 2021-06-09 09:42:38 -03:00 committed by jessopb
parent 4ef8247985
commit 3cd2548206
4 changed files with 13 additions and 10 deletions

View file

@ -64,6 +64,7 @@ function ClaimMenuList(props: Props) {
channelIsBlocked,
doCommentModBlock,
doCommentModUnBlock,
isRepost,
doCollectionEdit,
hasClaimInWatchLater,
collectionId,
@ -156,10 +157,10 @@ function ClaimMenuList(props: Props) {
}
function handleDelete() {
if (!isChannel) {
if (!isRepost && !isChannel) {
openModal(MODALS.CONFIRM_FILE_REMOVE, { uri });
} else {
openModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim: claim, cb: () => replace(`/$/${PAGES.CHANNELS}`) });
openModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim, cb: !isRepost && (() => replace(`/$/${PAGES.CHANNELS}`)), isRepost });
}
}
@ -195,7 +196,7 @@ function ClaimMenuList(props: Props) {
{subscriptionLabel}
</div>
</MenuItem>
) : (
) : (!isRepost &&
<MenuItem className="comment__menu-option" onSelect={handleAnalytics}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.ANALYTICS} />
@ -294,7 +295,7 @@ function ClaimMenuList(props: Props) {
</>
) : (
<>
{!isChannelPage && (
{!isChannelPage && !isRepost && (
<MenuItem className="comment__menu-option" onSelect={handleEdit}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.EDIT} />

View file

@ -135,6 +135,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
isCollectionMine,
collectionUris,
} = props;
const isRepost = claim && claim.repost_channel_url;
const WrapperElement = wrapperElement || 'li';
const shouldFetch =
claim === undefined || (claim !== null && claim.value_type === 'channel' && isEmpty(claim.meta) && !pending);
@ -422,7 +423,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
)}
</div>
</div>
{!hideMenu && <ClaimMenuList uri={uri} collectionId={collectionId} channelUri={channelUri} />}
{!hideMenu && <ClaimMenuList uri={uri} collectionId={collectionId} channelUri={channelUri} isRepost={isRepost} />}
</>
</WrapperElement>
);

View file

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

View file

@ -258,8 +258,7 @@ export const makeSelectSigningIsMine = (rawUri: string) => {
} catch (e) {
return false;
}
const repostedChannel = claims && claims[uri] && claims[uri].reposted_claim && (claims[uri].reposted_claim.signing_channel || claims[uri].reposted_claim);
const signingChannel = claims && claims[uri] && (repostedChannel || claims[uri].signing_channel || claims[uri]);
const signingChannel = claims && claims[uri] && (claims[uri].signing_channel || claims[uri]);
return signingChannel && myClaims.has(signingChannel.claim_id);
});