redirect repost urls to claim urls
This commit is contained in:
parent
cd821ded34
commit
8bb7c5b5ea
3 changed files with 14 additions and 8 deletions
|
@ -61,7 +61,7 @@ class FilePage extends React.Component<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
if (fileInfo === undefined) {
|
if (prevProps.uri !== uri && fileInfo === undefined) {
|
||||||
fetchFileInfo(uri);
|
fetchFileInfo(uri);
|
||||||
}
|
}
|
||||||
// @endif
|
// @endif
|
||||||
|
@ -77,6 +77,7 @@ class FilePage extends React.Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { uri, claimIsMine, costInfo, fileInfo, balance, isText } = this.props;
|
const { uri, claimIsMine, costInfo, fileInfo, balance, isText } = this.props;
|
||||||
const insufficientCredits = !claimIsMine && costInfo && costInfo.cost > balance;
|
const insufficientCredits = !claimIsMine && costInfo && costInfo.cost > balance;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page className="main--file-page">
|
<Page className="main--file-page">
|
||||||
{!fileInfo && insufficientCredits && (
|
{!fileInfo && insufficientCredits && (
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
|
import { Redirect } from 'react-router-dom';
|
||||||
import { parseURI } from 'lbry-redux';
|
import { parseURI } from 'lbry-redux';
|
||||||
import BusyIndicator from 'component/common/busy-indicator';
|
import BusyIndicator from 'component/common/busy-indicator';
|
||||||
import ChannelPage from 'page/channel';
|
import ChannelPage from 'page/channel';
|
||||||
|
@ -9,6 +10,7 @@ import Button from 'component/button';
|
||||||
import { SITE_TITLE } from 'config';
|
import { SITE_TITLE } from 'config';
|
||||||
import Card from 'component/common/card';
|
import Card from 'component/common/card';
|
||||||
import AbandonedChannelPreview from 'component/abandonedChannelPreview';
|
import AbandonedChannelPreview from 'component/abandonedChannelPreview';
|
||||||
|
import { formatLbryUrlForWeb } from 'util/url';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isResolvingUri: boolean,
|
isResolvingUri: boolean,
|
||||||
|
@ -74,14 +76,17 @@ function ShowPage(props: Props) {
|
||||||
};
|
};
|
||||||
}, [title, channelName, streamName]);
|
}, [title, channelName, streamName]);
|
||||||
|
|
||||||
let innerContent = '';
|
// Don't navigate directly to repost urls
|
||||||
|
// Always redirect to the actual content
|
||||||
|
// Also need to add repost_url to the Claim type for flow
|
||||||
|
// $FlowFixMe
|
||||||
|
if (claim && claim.repost_url === uri) {
|
||||||
|
const newUrl = formatLbryUrlForWeb(claim.canonical_url);
|
||||||
|
return <Redirect to={newUrl} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
let innerContent = '';
|
||||||
if (!claim || (claim && !claim.name)) {
|
if (!claim || (claim && !claim.name)) {
|
||||||
if (claim && !claim.name) {
|
|
||||||
// While testing the normalization changes, Brannon found that `name` was missing sometimes
|
|
||||||
// This shouldn't happen, so hopefully this helps track it down
|
|
||||||
console.error('No name for associated claim: ', claim.claim_id); // eslint-disable-line no-console
|
|
||||||
}
|
|
||||||
innerContent = (
|
innerContent = (
|
||||||
<Page>
|
<Page>
|
||||||
{(claim === undefined || isResolvingUri) && <BusyIndicator message={__('Loading decentralized data...')} />}
|
{(claim === undefined || isResolvingUri) && <BusyIndicator message={__('Loading decentralized data...')} />}
|
||||||
|
|
|
@ -12,7 +12,7 @@ const STATIC_ROOT = path.resolve(__dirname, 'static/');
|
||||||
|
|
||||||
let baseConfig = {
|
let baseConfig = {
|
||||||
mode: ifProduction('production', 'development'),
|
mode: ifProduction('production', 'development'),
|
||||||
devtool: ifProduction('source-map', 'eval-cheap-source-map'),
|
devtool: ifProduction('source-map', 'eval-cheap-module-source-map'),
|
||||||
optimization: {
|
optimization: {
|
||||||
minimizer: [
|
minimizer: [
|
||||||
new TerserPlugin({
|
new TerserPlugin({
|
||||||
|
|
Loading…
Reference in a new issue