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

fix: ability to fetch separators by id #15290

Merged
merged 1 commit into from
Oct 19, 2018
Merged

fix: ability to fetch separators by id #15290

merged 1 commit into from
Oct 19, 2018

Conversation

codebytere
Copy link
Member

Description of Change

Resolves #15119.

Changes menu-utils to take into account separators with ids such that they are not removed during the sorting process. Also adds a test to prevent future regression.

/cc @alexeykuzmin

Checklist

Release Notes

Notes: fixes ability to fetch separators menu items by id

Copy link
Contributor

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@alexeykuzmin alexeykuzmin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is pretty obscure, but should work for simple cases.
Thank you!

@codebytere
Copy link
Member Author

Failed on unrelated

webContents module sendInputEvent(event) "before each" hook for "can send keydown events with special keys"

@codebytere codebytere merged commit f9f34fd into master Oct 19, 2018
@release-clerk
Copy link

release-clerk bot commented Oct 19, 2018

Release Notes Persisted

fixes ability to fetch separators menu items by id

@trop
Copy link
Contributor

trop bot commented Oct 19, 2018

We have automatically backported this PR to "4-0-x", please check out #15294

@trop trop bot removed the target/4-0-x label Oct 19, 2018
@trop
Copy link
Contributor

trop bot commented Oct 19, 2018

We have automatically backported this PR to "3-0-x", please check out #15295

@@ -156,14 +161,15 @@ function sortGroups (groups) {

function sortMenuItems (menuItems) {
const isSeparator = (item) => item.type === 'separator'
const separators = menuItems.filter(i => i.type === 'separator')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const separators = menuItems.filter(isSeparator)

joined.push(joiner)
if (joinIDs.length > 0) {
joined.push(joinIDs[0])
joinIDs.splice(0, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

joined.push(joinIDs.shift())

Instead of those two lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

menu.getMenuItemById() doesn't work for separators
3 participants