maint: cleanup old rewarded content

This commit is contained in:
Thomas Zarebczan 2019-11-02 11:55:17 -04:00
parent 1389e2c6b6
commit e39a070789
7 changed files with 5 additions and 36 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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