Skip to content

Commit

Permalink
Never show the excluded page in PostSelector
Browse files Browse the repository at this point in the history
  • Loading branch information
Copons committed Apr 20, 2018
1 parent 03a030e commit 58ce792
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions client/my-sites/post-selector/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export default class extends React.PureComponent {
emptyMessage,
createLink,
selected,
excludeTree,
showTypeLabels,
suppressFirstPageLoad,
} = this.props;
Expand All @@ -103,6 +104,7 @@ export default class extends React.PureComponent {
emptyMessage={ emptyMessage }
createLink={ createLink }
selected={ selected }
excludePost={ excludeTree }
showTypeLabels={ showTypeLabels }
suppressFirstPageLoad={ suppressFirstPageLoad }
/>
Expand Down
6 changes: 5 additions & 1 deletion client/my-sites/post-selector/selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class PostSelectorPosts extends React.Component {
emptyMessage: PropTypes.string,
createLink: PropTypes.string,
selected: PropTypes.number,
excludePost: PropTypes.number,
onSearch: PropTypes.func,
onChange: PropTypes.func,
multiple: PropTypes.bool,
Expand Down Expand Up @@ -303,7 +304,10 @@ class PostSelectorPosts extends React.Component {
};

renderItem = ( item, _recurse = false ) => {
if ( item.parent && ! _recurse && includes( this.postIds, item.parent.ID ) ) {
if (
this.props.excludePost === item.ID ||
( item.parent && ! _recurse && includes( this.postIds, item.parent.ID ) )
) {
return;
}

Expand Down

0 comments on commit 58ce792

Please sign in to comment.