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

Add extensionsTab to preferences page #8065

Merged
merged 2 commits into from
Apr 10, 2017
Merged

Add extensionsTab to preferences page #8065

merged 2 commits into from
Apr 10, 2017

Conversation

cezaraugusto
Copy link
Contributor

@cezaraugusto cezaraugusto commented Apr 4, 2017

  • 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).

Add extensionsTab to preferences page

Auditors: @bsclifton, @bbondy

Closes #6530, #6794

screen shot 2017-04-04 at 4 10 08 pm

Test plan:

  1. Automated test must pass:

extension state

npm run test -- --grep="extensionUninstalled"

extensionsReducer

npm run test -- --grep="extensionsReducer"

extensionsTab

npm run test -- --grep="ExtensionsTab component"

QA Steps:

  1. Go to extensions tab
  2. Enabling an extension should enable it
  3. Disabling an extension should disable it
  4. Removing an extension should remove its folder (you can see its path logged on console)
  5. Removed extension should not appear in UI, and should be disabled after removal
  6. Enabling a removed extension should install it again
  7. Enabling another password manager should disable the first
  8. Disabling all password managers should set "built-in" password manager to active
  9. You can't remove built-in (webtorrent and sync) extensions -- update per @bradleyrichter request Sync is no longer included

@jonathansampson
Copy link
Collaborator

@cezaraugusto Rebase, please? :)

@jonathansampson
Copy link
Collaborator

Perhaps about:extensions should redirect to about:preferences#extensions with this change?

@jonathansampson
Copy link
Collaborator

I don't feel too great about including these extensions images in the browser itself. I feel as though we should get those from the extension store instead. Otherwise, we'll have to do extra work each time we support a new extension.

@cezaraugusto
Copy link
Contributor Author

rebased. Added more tests.

@cezaraugusto
Copy link
Contributor Author

cezaraugusto commented Apr 7, 2017

@jonathansampson I agree with you regarding extensions images but at this moment there's no way of having their data unless it's installed by default.

Ideally they would have their store with name, description, and image, even when they're not installed by default (built-in). At that moment we can also remove dummyContent I included, and process of adding new extensions would be easier

@jonathansampson
Copy link
Collaborator

jonathansampson commented Apr 8, 2017

@cezaraugusto Good point. Can't show an extension's image if the image hasn't yet been loaded with the extension. We may need to have a bigger-vision discussion about this. Current approach is clearly necessary, but won't scale. My apologies :)

Can you add an image for Honey?

honey-logo-128

l10nSyncDesc=
l10nWebtorrent= Torrent Viewer
l10nWebtorrentDesc=
l10nVimium= Vimium
Copy link
Collaborator

Choose a reason for hiding this comment

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

We'll be shipping Honey soon (perhaps in 0.14.2). Can we include it?
https://chrome.google.com/webstore/detail/honey/bmnlcjabgnpnenekpadlanbbkooimhnj

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure which is going to land first but will include once Honey lands

// switch back password to unmanaged (null)
e.target.value
? aboutActions.changeSetting(settings.ACTIVE_PASSWORD_MANAGER, this.props.prefKey)
: aboutActions.changeSetting(settings.ACTIVE_PASSWORD_MANAGER, null)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar pattern in extensionsTab.js. There false was used; here null is being used. Can we go with one or the other, so there isn't any confusion about whether or not the two behave differently?

+    isPasswordManager(extensionId)
+      ? aboutActions.changeSetting(settings.ACTIVE_PASSWORD_MANAGER, extensionId)
+      : aboutActions.changeSetting(getExtensionSetting(extensionId), false)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes I'll update, thanks for noticing

const pocket = config.PocketExtensionId
const sync = config.syncExtensionId
const webtorrent = config.torrentExtensionId
const vimium = config.vimiumExtensionId
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add Honey :)

description: 'l10nPocketDesc',
icon: 'img/extensions/pocket-128.png'
}
// { id: 'vimium' // TBD }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add Honey.

case vimium:
extensionSetting = settings.VIMIUM_ENABLED
break
default:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add Honey.

@@ -1339,7 +1339,7 @@ class Main extends ImmutableComponent {
.includes(siteTags.BOOKMARK)) || emptyMap
: null}
history={this.bindHistory(frame)}
extensions={frame.get('location') === 'about:extensions'
extensions={['about:extensions', 'about:preferences'].includes(getBaseUrl(frame.get('location')))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we continue to support about:extensions after this?

Copy link
Collaborator

@jonathansampson jonathansampson left a comment

Choose a reason for hiding this comment

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

Left a handful of single comments here and there. Really great PR. Primary theme is forthcoming support for Honey.

@bbondy
Copy link
Member

bbondy commented Apr 10, 2017

@cezaraugusto pls rebase this one when you get a chance. Thanks!

@cezaraugusto
Copy link
Contributor Author

ok rebased 👍

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Since the header style didn't match, I created a follow up issue. We can revisit updating all the styles to this new orange color / style 😄 #8165

// so we add a prop called 'excluded' and use it to hide extension on UI
if (extension) {
return state.setIn(['extensions', extensionId], extension.set('excluded', true))
} else {
Copy link
Member

Choose a reason for hiding this comment

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

instead of an else, this could be cleaner to just return state (no else) 😄

@@ -3,3 +3,29 @@ extensions=Extensions
extensionIdLabel=ID:
extensionPathLabel=Path:
extensionPermissionsLabel=Permissions:
notifyNewExtensionsAdded=Notifiy me when new extensions are added
Copy link
Member

Choose a reason for hiding this comment

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

Misspelling here; s/Notifiy/Notify

* @param {String} extensionId - The current extension ID
* @returns {String} The given setting option
*/
module.exports.getExtensionSetting = (extensionId) => {
Copy link
Member

Choose a reason for hiding this comment

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

This method name isn't entirely accurate, since it's getting the key used to do the lookup in the settings... maybe we can change the name to something like getExtensionKey?

url: 'some_url',
path: 'some/path',
version: '1.0',
description: 'epic game about an android dragon dinossaur',
Copy link
Member

Choose a reason for hiding this comment

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

🐲 🤖

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Changes work (and look) great! 😄 Nice job on the tests too

We'll need a follow-up for Honey once it's merged also

@bsclifton bsclifton merged commit 16ac2ab into brave:master Apr 10, 2017
@luixxiul
Copy link
Contributor

@cezaraugusto does this close #6794 as well?

@bsclifton
Copy link
Member

@luixxiul it sure does! 😄 I'll go ahead and close that out

@cezaraugusto cezaraugusto deleted the extensions/6530 branch July 25, 2017 07:30
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.

5 participants