Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable rewards when diagnostics are off #1116

Merged
merged 3 commits into from
Mar 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/renderer/page/rewards/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
20 changes: 16 additions & 4 deletions src/renderer/page/rewards/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -78,9 +78,21 @@ class RewardsPage extends React.PureComponent {
}

renderUnclaimedRewards() {
const { fetching, rewards, user } = this.props;
const { fetching, rewards, user, daemonSettings, navigate } = 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'
)}{' '}
<Link onClick={() => navigate('/settings')} label="Settings" />
{__(', in order to re-enable them.')}
</p>
</div>
);
} else if (fetching) {
return (
<div className="card__content">
<BusyMessage message={__('Fetching rewards')} />
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/page/settings/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 about my usage.'
)}
helper={__(
'You will be ineligible to earn rewards while diagnostics are not being shared.'
)}
/>
</div>
Expand Down