maint: cleanup old rewarded content

This commit is contained in:
Thomas Zarebczan 2019-11-02 11:55:17 -04:00 committed by Sean Yesmunt
parent c2f31568f5
commit dce28c4b63
7 changed files with 5 additions and 36 deletions

View file

@ -1,16 +1,13 @@
import { connect } from 'react-redux';
import { makeSelectFilePartlyDownloaded, makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
import { selectRewardContentClaimIds } from 'lbryinc';
import { makeSelectFilePartlyDownloaded, makeSelectClaimIsMine } from 'lbry-redux';
import { makeSelectIsSubscribed, makeSelectIsNew } from 'redux/selectors/subscriptions';
import FileProperties from './view';
const select = (state, props) => ({
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
downloaded: makeSelectFilePartlyDownloaded(props.uri)(state),
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
isNew: makeSelectIsNew(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
claim: makeSelectClaimForUri(props.uri)(state),
});
export default connect(

View file

@ -11,20 +11,15 @@ type Props = {
claimIsMine: boolean,
isSubscribed: boolean,
isNew: boolean,
claim: Claim,
rewardedContentClaimIds: Array<string>,
};
export default function FileProperties(props: Props) {
const { uri, downloaded, claimIsMine, rewardedContentClaimIds, isSubscribed, claim } = props;
const { claim_id: claimId } = claim;
const isRewardContent = rewardedContentClaimIds.includes(claimId);
const { uri, downloaded, claimIsMine, isSubscribed } = props;
return (
<div className="file-properties">
{isSubscribed && <Icon tooltip icon={icons.SUBSCRIBE} />}
{!claimIsMine && downloaded && <Icon tooltip icon={icons.DOWNLOAD} />}
{isRewardContent && <Icon tooltip icon={icons.FEATURED} />}
<FilePrice hideFree uri={uri} />
<VideoDuration className="media__subtitle" uri={uri} />
</div>

View file

@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { selectUnclaimedRewardValue, selectFetchingRewards, doFetchRewardedContent } from 'lbryinc';
import { selectUnclaimedRewardValue, selectFetchingRewards } from 'lbryinc';
import RewardSummary from './view';
const select = state => ({
@ -7,11 +7,7 @@ const select = state => ({
fetching: selectFetchingRewards(state),
});
const perform = dispatch => ({
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
});
export default connect(
select,
perform
null
)(RewardSummary);

View file

@ -1,11 +1,5 @@
import { connect } from 'react-redux';
import {
selectUnclaimedRewardValue,
selectFetchingRewards,
doRewardList,
doFetchRewardedContent,
selectClaimedRewards,
} from 'lbryinc';
import { selectUnclaimedRewardValue, selectFetchingRewards, doRewardList, selectClaimedRewards } from 'lbryinc';
import RewardSummary from './view';
const select = state => ({
@ -16,7 +10,6 @@ const select = state => ({
const perform = dispatch => ({
fetchRewards: () => dispatch(doRewardList()),
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
});
export default connect(

View file

@ -1,6 +1,5 @@
import { connect } from 'react-redux';
import * as settings from 'constants/settings';
import { selectRewardContentClaimIds } from 'redux/selectors/content';
import { doRemoveUnreadSubscription } from 'redux/actions/subscriptions';
import { doSetClientSetting } from 'redux/actions/settings';
import { doSetContentHistoryItem } from 'redux/actions/content';
@ -32,7 +31,6 @@ const select = (state, props) => ({
metadata: makeSelectMetadataForUri(props.uri)(state),
obscureNsfw: !selectShowMatureContent(state),
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
channelUri: makeSelectChannelForClaimUri(props.uri, true)(state),

View file

@ -7,7 +7,6 @@ import FileViewerInitiator from 'component/fileViewerInitiator';
import FilePrice from 'component/filePrice';
import FileDetails from 'component/fileDetails';
import FileActions from 'component/fileActions';
import Icon from 'component/common/icon';
import DateTime from 'component/dateTime';
import Button from 'component/button';
import Page from 'component/page';
@ -27,7 +26,6 @@ type Props = {
fileInfo: FileListItem,
contentType: string,
uri: string,
rewardedContentClaimIds: Array<string>,
claimIsMine: boolean,
costInfo: ?{ cost: number },
fetchFileInfo: string => void,
@ -101,7 +99,6 @@ class FilePage extends React.Component<Props> {
claim,
contentType,
uri,
rewardedContentClaimIds,
openModal,
claimIsMine,
prepareEdit,
@ -117,7 +114,6 @@ class FilePage extends React.Component<Props> {
// File info
const { signing_channel: signingChannel } = claim;
const channelName = signingChannel && signingChannel.name;
const isRewardContent = (rewardedContentClaimIds || []).includes(claim.claim_id);
const webShareable =
costInfo && costInfo.cost === 0 && contentType && ['video', 'image', 'audio'].includes(contentType.split('/')[0]);
// We want to use the short form uri for editing
@ -239,7 +235,6 @@ class FilePage extends React.Component<Props> {
<div className="media__actions media__actions--between media__actions--nowrap">
<ClaimUri uri={uri} />
<div className="file-properties">
{isRewardContent && <Icon size={20} iconColor="red" icon={icons.FEATURED} />}
{nsfw && <div className="badge badge--mature">{__('Mature')}</div>}
<FilePrice badge uri={normalizeURI(uri)} />
</div>

View file

@ -25,11 +25,6 @@ export const makeSelectIsPlaying = (uri: string) =>
playingUri => playingUri === uri
);
export const selectRewardContentClaimIds = createSelector(
selectState,
state => state.rewardedContentClaimIds
);
export const makeSelectContentPositionForUri = (uri: string) =>
createSelector(
selectState,