Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Add Importer support #4049

Merged
merged 1 commit into from
Sep 21, 2016
Merged

Add Importer support #4049

merged 1 commit into from
Sep 21, 2016

Conversation

darkdh
Copy link
Member

@darkdh darkdh commented Sep 16, 2016

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Test Plan:

fix #428
partial fix #2107

requires brave/muon#57

Auditors: @bridiver, @bbondy, @bsclifton

CommonMenu.bookmarksToolbarMenuItem(),
CommonMenu.separatorMenuItem,
CommonMenu.importBookmarksMenuItem()
CommonMenu.bookmarksToolbarMenuItem()
]
Copy link
Member

Choose a reason for hiding this comment

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

there is some commented out code here in the menu.js that I think you can delete, now that you've added import functionality. Search for locale.translation('importFrom')

importer.on('add-homepage', (e, detail) => {
})

importer.on('add-bookmarks', (e, bookmarks, topLevelFolder) => {
Copy link
Member

Choose a reason for hiding this comment

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

this handler has a LOT going on in it... Any chance we could break this (or parts of it) out into a method? Looks generic enough (not dependent on electron) to put into a utils class, which means we could eventually unit test it too 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

But the handler is for electron dependent bookmarks object and whole block is meant to handle it specifically. So I am not sure that we can pull out a generic method from it.

Copy link
Member

Choose a reason for hiding this comment

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

ah- makes sense. I'm OK w/ it as-is 😄


**Parameters**

**selected**: `object`, the browser data to import as per doc/state.md's importBroserDataSelected
Copy link
Member

Choose a reason for hiding this comment

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

definitely not a big deal, just a misspelling here:
s/importBroserDataSelected/importBrowserDataSelected

cookies: boolean
}
],
importBroserDataSelected: {
Copy link
Member

Choose a reason for hiding this comment

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

whoops, another one:
s/importBroserDataSelected/importBrowserDataSelected

@@ -0,0 +1,108 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
Copy link
Member

Choose a reason for hiding this comment

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

would it be possible to move this to the new directory structure?
https://github.com/brave/browser-laptop/blob/master/docs/directoryStructure.md

So for example, this would move to:
app/renderer/components

Great job on the control 😄

@bsclifton
Copy link
Member

Left some comments... great work 😄

@cndouglas cndouglas mentioned this pull request Sep 17, 2016
@darkdh
Copy link
Member Author

darkdh commented Sep 17, 2016

Thanks for your feedback, @bsclifton. I've addressed it in ec45bdf.

@@ -693,3 +693,14 @@ module.exports.clearAutofillData = () => {
ses.autofill.clearAutofillData()
}
}

module.exports.setCookie = (cookie) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this method should be moved out of filtering and only called on the default session

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed it in 1dee63d.

module.exports.sendToFocusedWindow(BrowserWindow.getAllWindows()[0], [messages.IMPORT_BOOKMARKS]), 100)
})
return
if (process.type === 'browser') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@@ -374,6 +376,11 @@ class Main extends ImmutableComponent {
windowActions.setContextMenuDetail()
})

ipc.on(messages.IMPORTER_LIST, (e, detail) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this would also be better as an appAction. We want to avoid adding more ipc handlers

@@ -374,6 +376,11 @@ class Main extends ImmutableComponent {
windowActions.setContextMenuDetail()
})

ipc.on(messages.IMPORTER_LIST, (e, detail) => {
windowActions.setImportBrowserDataDetail(detail)
Copy link
Collaborator

Choose a reason for hiding this comment

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

ideally actions should not be setters, they should describe the actual action. In this case something like appAction.supportedBrowsersUpdated which would then be handled in the windowStore and should call helper methods to update the state (don't call actions from actions).

@@ -532,6 +539,10 @@ class Main extends ImmutableComponent {
windowActions.setClearBrowsingDataDetail()
}

onHideImportBrowserDataPanel () {
windowActions.setImportBrowserDataDetail()
Copy link
Collaborator

Choose a reason for hiding this comment

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

along the same lines as the previous comment this would be something like windowActions.importDataPanelHidden

@luixxiul luixxiul added this to the 0.12.2dev milestone Sep 21, 2016
@darkdh darkdh force-pushed the import-browser-data branch from 1dee63d to 3b94788 Compare September 21, 2016 02:34
@darkdh
Copy link
Member Author

darkdh commented Sep 21, 2016

I will do appAction refactoring in follow-up commit. recorded in #2107 (comment)

@bridiver
Copy link
Collaborator

sounds good! Only the setCookie thing is critical for merging

@darkdh darkdh force-pushed the import-browser-data branch from 3b94788 to 2d91041 Compare September 21, 2016 04:43
@bbondy
Copy link
Member

bbondy commented Sep 21, 2016

merging!

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

Successfully merging this pull request may close these issues.

General Settings: "Browser data import" setting Import data from other browsers
7 participants