change display of blocked error

This commit is contained in:
zeppi 2022-11-04 16:35:04 -04:00
parent 6d52763e19
commit 1d55a84c94
4 changed files with 27 additions and 13 deletions

View file

@ -2319,5 +2319,7 @@
"Your hub has blocked this content because it subscribes to the following blocking channel:": "Your hub has blocked this content because it subscribes to the following blocking channel:", "Your hub has blocked this content because it subscribes to the following blocking channel:": "Your hub has blocked this content because it subscribes to the following blocking channel:",
"Your hub has blocked access to this content do to a complaint received under the US Digital Millennium Copyright Act.": "Your hub has blocked access to this content do to a complaint received under the US Digital Millennium Copyright Act.", "Your hub has blocked access to this content do to a complaint received under the US Digital Millennium Copyright Act.": "Your hub has blocked access to this content do to a complaint received under the US Digital Millennium Copyright Act.",
"Autoplay Next is on.": "Autoplay Next is on.", "Autoplay Next is on.": "Autoplay Next is on.",
"Content Blocked": "Content Blocked",
"Your hub has blocked %content% because it subscribes to the following blocking channel:": "Your hub has blocked %content% because it subscribes to the following blocking channel:",
"--end--": "--end--" "--end--": "--end--"
} }

View file

@ -162,17 +162,19 @@ function ShowPage(props: Props) {
) : ( ) : (
<Page> <Page>
<Card <Card
title={uri} title={__('Content Blocked')}
subtitle={ subtitle={
<> <>
{(!errorCensor || !errorCensor.text) && {errorCensor &&
__('Your hub has blocked this content because it subscribes to the following blocking channel:')} __(`Your hub has blocked %content% because it subscribes to the following blocking channel:`, {
{errorCensor && errorCensor.text}{' '} content: uri,
})}{' '}
<Button <Button
button="link" button="link"
navigate={errorCensor && errorCensor.canonical_url} navigate={errorCensor && errorCensor.canonical_url}
label={errorCensor && errorCensor.name} label={errorCensor && errorCensor.name}
/> />
{errorCensor && <div className={'error__text'}>{`\nMessage:\n${errorCensor.text}\n`}</div>}
</> </>
} }
/> />

View file

@ -86,16 +86,25 @@ export function doResolveUris(
// https://github.com/facebook/flow/issues/2221 // https://github.com/facebook/flow/issues/2221
if (uriResolveInfo) { if (uriResolveInfo) {
if (uriResolveInfo.error) { if (uriResolveInfo.error) {
// TODO: handled filtered too
if (uriResolveInfo.error.name === 'BLOCKED') {
// $FlowFixMe // $FlowFixMe
resolveInfo[uri] = { resolveInfo[uri] = {
// $FlowFixMe
...fallbackResolveInfo, ...fallbackResolveInfo,
errorCensor: { errorCensor: {
// $FlowFixMe // $FlowFixMe
...uriResolveInfo.error.censor, ...uriResolveInfo.error.censor,
// $FlowFixMe // $FlowFixMe
text: uriResolveInfo.error.text, text: uriResolveInfo.error.text,
}, }, // $FlowFixMe
}; };
} else {
// $FlowFixMe
resolveInfo[uri] = {
...fallbackResolveInfo,
};
}
} else { } else {
if (checkReposts) { if (checkReposts) {
if (uriResolveInfo.reposted_claim) { if (uriResolveInfo.reposted_claim) {

View file

@ -83,6 +83,7 @@ export const selectClaimIdForUri = (state: State, uri: string) => selectClaimIds
export const selectReflectingById = (state: State) => selectState(state).reflectingById; export const selectReflectingById = (state: State) => selectState(state).reflectingById;
// TODO: remove this.
export const makeSelectBlacklistedDueToDMCA = (claimUri: string) => export const makeSelectBlacklistedDueToDMCA = (claimUri: string) =>
createSelector(makeSelectClaimErrorCensor(claimUri), (claimError) => { createSelector(makeSelectClaimErrorCensor(claimUri), (claimError) => {
if (!claimError) { if (!claimError) {