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

GH-1262 Blocked count for Categories respects trust/restrict/pause #133

Merged
merged 2 commits into from Jul 12, 2018
Merged
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -152,10 +152,20 @@ class Category extends React.Component {
* @return {ReactComponent} ReactComponent instance
*/
render() {
const { category } = this.props;
const { category, paused_blocking, sitePolicy } = this.props;
const globalBlocking = !!this.props.globalBlocking;
const filteredText = { color: 'red' };
const checkBoxStyle = `${(this.state.totalShownBlocked && this.state.allShownBlocked) ? 'all-blocked ' : (this.state.totalShownBlocked ? 'some-blocked ' : '')} checkbox-container`;

let trackersBlockedCount;
if (paused_blocking || sitePolicy === 2) {
trackersBlockedCount = 0;
} else if (sitePolicy === 1) {
trackersBlockedCount = category.num_total || 0;
} else {
trackersBlockedCount = category.num_blocked || 0;
}

return (
<div className={`${category.num_shown === 0 ? 'hide' : ''} blocking-category`}>
<div className={`sticky-category${this.state.showTooltip ? ' no-sticky' : ''}`}>
@@ -184,9 +194,9 @@ class Category extends React.Component {
</span>
</div>
{
!!category.num_blocked &&
!!trackersBlockedCount &&
<div className="blocked-count">
<span className="count">{`${category.num_blocked} `}</span>
<span className="count">{`${trackersBlockedCount} `}</span>
<span className="text">{ t('blocking_category_blocked') }</span>
</div>
}
@@ -81,13 +81,15 @@ describe('app/panel/reducers/summary.js', () => {

const initState = Immutable({
pageHost: 'www.cnn.com',
pageUrl: '',
sitePolicy: 2,
site_blacklist: [],
site_whitelist: ['cnn.com']
});

expect(summaryReducer(initState, action)).toEqual({
pageHost: 'www.cnn.com',
pageUrl: '',
sitePolicy: 1,
site_blacklist: ['cnn.com'],
site_whitelist: []
ProTip! Use n and p to navigate between commits in a pull request.