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

Fix blocks when useOnce is true #3988

Merged
merged 2 commits into from Dec 15, 2017

Conversation

Projects
None yet
2 participants
@Rahmon
Contributor

Rahmon commented Dec 14, 2017

Description

Blocks can still be inserted from the list next to the inserter even if useOnce is true #3968

How Has This Been Tested?

This has been tested with "npm test", "npm run test-e2e" and manually on Chrome and Firefox.

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows has proper inline documentation.
@aduth

aduth approved these changes Dec 15, 2017

This looks good 👍

@@ -40,6 +41,10 @@ export class VisualEditorInserter extends Component {
onInsertBlock( createBlock( name ) );
}
isDisabledBlock( block ) {
return block.useOnce && find( this.props.blocks, ( { name } ) => block.name === name );

This comment has been minimized.

@aduth

aduth Dec 15, 2017

Member

Minor: some (Array#some) would be more appropriate than find (Array#find) only because we care that it exists (boolean), and have no intent to use the found value.

@aduth

aduth Dec 15, 2017

Member

Minor: some (Array#some) would be more appropriate than find (Array#find) only because we care that it exists (boolean), and have no intent to use the found value.

This comment has been minimized.

@Rahmon

Rahmon Dec 15, 2017

Contributor

Can I still commit in this branch to do that?

@Rahmon

Rahmon Dec 15, 2017

Contributor

Can I still commit in this branch to do that?

This comment has been minimized.

@aduth

aduth Dec 15, 2017

Member

Can I still commit in this branch to do that?

I'm not sure how forked branches work when a merge has already been done upstream†, but at the very least you'd still need to create a new pull request if you feel compelled to make the change.

† I'm kinda curious though if committing to your branch would allow for a new pull request 😄

@aduth

aduth Dec 15, 2017

Member

Can I still commit in this branch to do that?

I'm not sure how forked branches work when a merge has already been done upstream†, but at the very least you'd still need to create a new pull request if you feel compelled to make the change.

† I'm kinda curious though if committing to your branch would allow for a new pull request 😄

This comment has been minimized.

@Rahmon

Rahmon Dec 16, 2017

Contributor

I did a commit but nothing got happen here. I think I need to create a new pull request... xD

@Rahmon

Rahmon Dec 16, 2017

Contributor

I did a commit but nothing got happen here. I think I need to create a new pull request... xD

@aduth aduth merged commit 5d81a0a into WordPress:master Dec 15, 2017

2 checks passed

codecov/project 38.36% (+0.04%) compared to e421572
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@Rahmon Rahmon referenced this pull request Dec 16, 2017

Merged

Minor refactoring: change from "find" to "some" function #4052

3 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment