Disable rewards when diagnostics are off

This commit is contained in:
liamcardenas 2018-03-16 13:55:56 -07:00
parent 861131fd77
commit b56982d3b2
3 changed files with 20 additions and 5 deletions

View file

@ -4,9 +4,11 @@ import { selectFetchingRewards, selectUnclaimedRewards } from 'redux/selectors/r
import { selectUser } from 'redux/selectors/user';
import { doAuthNavigate, doNavigate } from 'redux/actions/navigation';
import { doRewardList } from 'redux/actions/rewards';
import { selectDaemonSettings } from 'redux/selectors/settings';
import RewardsPage from './view';
const select = (state, props) => ({
daemonSettings: selectDaemonSettings(state),
fetching: selectFetchingRewards(state),
rewards: selectUnclaimedRewards(state),
user: selectUser(state),

View file

@ -29,9 +29,9 @@ class RewardsPage extends React.PureComponent {
// }
renderPageHeader() {
const { doAuth, navigate, user } = this.props;
const { doAuth, navigate, user, daemonSettings } = this.props;
if (user && !user.is_reward_approved) {
if (user && !user.is_reward_approved && daemonSettings.share_usage_data) {
if (!user.primary_email || !user.has_verified_email || !user.is_identity_verified) {
return (
<section className="card">
@ -78,9 +78,19 @@ class RewardsPage extends React.PureComponent {
}
renderUnclaimedRewards() {
const { fetching, rewards, user } = this.props;
const { fetching, rewards, user, daemonSettings } = this.props;
if (fetching) {
if (!daemonSettings.share_usage_data) {
return (
<div className="card__content empty">
<p>
{__(
'Rewards are currently disabled for your account. Turn on diagnostic data sharing, in Settings, in order to re-enable them.'
)}
</p>
</div>
);
} else if (fetching) {
return (
<div className="card__content">
<BusyMessage message={__('Fetching rewards')} />

View file

@ -309,7 +309,10 @@ class SettingsPage extends React.PureComponent {
onChange={this.onShareDataChange.bind(this)}
defaultChecked={daemonSettings.share_usage_data}
label={__(
'Help make LBRY better by contributing analytics and diagnostic data and about my usage'
'Help make LBRY better by contributing analytics and diagnostic data and about my usage.'
)}
helper={__(
'You will be ineligble to earn rewards while diagnostics are not being shared.'
)}
/>
</div>