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

Add "forget this domain" feature #12754

Merged
merged 2 commits into from
Mar 15, 2018

Conversation

AlexRobinson-
Copy link

@AlexRobinson- AlexRobinson- commented Jan 20, 2018

closes #3948

👋 Hey everyone, first time making a PR here. I was unsure what to put in the Test Plan section, any help there is appreciate.

This adds an item to the context menu for a url on the about:history page to remove all sites for the selected domain from the history list.

What it Looks Like:
screen shot 2018-01-21 at 1 33 35 am

brave forget domain

Auditors:

Test Plan:

Submitter Checklist:

  • 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).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed. (Ask a Brave employee to help if you cannot access this document.)

Test Plan:

Reviewer Checklist:

  • Request a security/privacy review as needed if one was not already requested.

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@codecov-io
Copy link

codecov-io commented Jan 20, 2018

Codecov Report

Merging #12754 into master will increase coverage by 0.18%.
The diff coverage is 59.09%.

@@            Coverage Diff             @@
##           master   #12754      +/-   ##
==========================================
+ Coverage   56.09%   56.27%   +0.18%     
==========================================
  Files         279      278       -1     
  Lines       27307    27610     +303     
  Branches     4443     4500      +57     
==========================================
+ Hits        15318    15538     +220     
- Misses      11989    12072      +83
Flag Coverage Δ
#unittest 56.27% <59.09%> (+0.18%) ⬆️
Impacted Files Coverage Δ
app/locale.js 35.77% <ø> (ø) ⬆️
js/constants/appConstants.js 100% <ø> (ø) ⬆️
js/actions/appActions.js 19.57% <0%> (+0.45%) ⬆️
js/contextMenus.js 18.43% <0%> (-0.02%) ⬇️
app/browser/reducers/historyReducer.js 97.81% <86.66%> (-1.35%) ⬇️
app/common/lib/fetchSearchSuggestions.js 22.85% <0%> (-10.48%) ⬇️
js/stores/appStoreRenderer.js 91.66% <0%> (-8.34%) ⬇️
app/renderer/components/reduxComponent.js 84.61% <0%> (-6.16%) ⬇️
app/common/state/updateState.js 94.11% <0%> (-5.89%) ⬇️
...renderer/components/preferences/payment/history.js 34.17% <0%> (-3.18%) ⬇️
... and 35 more

@@ -4,6 +4,7 @@

const Immutable = require('immutable')
const BrowserWindow = require('electron').BrowserWindow
const {URL} = require('url')
Copy link
Member

Choose a reason for hiding this comment

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

please use app/common/urlParse.js instead

Copy link
Author

Choose a reason for hiding this comment

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

break
}

historyState.getSites(state).forEach(something => {
Copy link
Member

Choose a reason for hiding this comment

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

please use a descriptive variable name like historySite instead of something

Copy link
Author

Choose a reason for hiding this comment

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

Oh woops, forgot I left that in there. Nice catch!

@@ -350,6 +361,83 @@ describe('historyReducer unit test', function () {
})
})

Copy link
Member

Choose a reason for hiding this comment

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

thanks for adding tests!

@diracdeltas diracdeltas self-requested a review January 22, 2018 19:08
Copy link
Member

@diracdeltas diracdeltas left a comment

Choose a reason for hiding this comment

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

see above

closes brave#3948
This adds an item to the context menu for a url on the about:history page to remove all sites for the selected domain from the history list.

Auditors:

Test Plan:
@AlexRobinson-
Copy link
Author

@diracdeltas up for another review?

I also wasn't sure what to do with the translations - I was unable to find info around this. I have left the text inline, but any guidance on this is appreciated

@cndouglas
Copy link

@AlexRobinson- If you want to localize the text, here are the steps:

  1. Add a new entry to app/extensions/brave/locales/en-US/menu.properties. The entry should look something like this: deleteDomainFromHistory=Delete Domain from History.
  2. Add the deleteDomainFromHistory key to the rendererIdentifiers array in app/locale.js.
  3. Replace the inline text with locale.translation('deleteDomainFromHistory').

Here's an example: https://github.com/brave/browser-laptop/pull/13010/files.

}

historyState.getSites(state).forEach(historySite => {
if (urlParse(historySite.get('location')).hostname === domain) {
Copy link
Member

Choose a reason for hiding this comment

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

should probably check that urlParse(historySite.get('location')) is non-falsey

Copy link
Author

Choose a reason for hiding this comment

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

it seems urlParse always returns an object

https://github.com/brave/browser-laptop/blob/master/app/common/urlParse.js#L19

So it should always be non-falsey

Would you still prefer a check in there? If so should we display any errors to the user? Or just ignore the fail and do nothing?

Copy link
Author

Choose a reason for hiding this comment

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

Any thoughts on this @diracdeltas

Copy link
Member

Choose a reason for hiding this comment

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

nvm original comment

template.push({
label: 'Delete Domain from History',
click: () => {
const domain = urlParse(siteDetail.get('location')).hostname
Copy link
Member

Choose a reason for hiding this comment

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

same as above

@@ -356,6 +356,14 @@ const siteSingleDetailTemplate = (siteKey, type, activeFrame) => {
}
}
})

template.push({
label: 'Delete Domain from History',
Copy link
Member

Choose a reason for hiding this comment

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

see @liunkae's comment above about localization

@bsclifton bsclifton added this to the Completed work milestone Feb 28, 2018
Copy link
Member

@diracdeltas diracdeltas left a comment

Choose a reason for hiding this comment

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

works great!

@BrendanEich
Copy link
Member

Nice!

@bsclifton bsclifton modified the milestones: Completed work, 0.24.x (master) Mar 15, 2018
@bsclifton
Copy link
Member

bsclifton commented Mar 15, 2018

Great job with this, @AlexRobinson- ! Huge thanks for covering the work with a test 😄

Let me know if you'd like to grab another issue

@bsclifton bsclifton self-requested a review March 15, 2018 06:08
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.

Looks like there's a trailing space in there (I'm guessing you're on Windows 😄 ). Can you run npm run lint and fix the line identified? Other than that, looks great!

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.

Disregard my previous review- must have been a bug on Travis' part (see https://travis-ci.org/brave/browser-laptop/jobs/342211676). I pulled your fork and it works great 😄

@bsclifton bsclifton merged commit c63299a into brave:master Mar 15, 2018
@AlexRobinson-
Copy link
Author

Definitely not on Windows! shudder front end development has been so much smoother since moving to a mac

I'm excited to see this go through! Thank you for all of the help getting it through as well. I'll consider picking up another task soon 😄

@bsclifton
Copy link
Member

@AlexRobinson- awesome 😄 Feel free to shoot me an email at clifton@brave.com and I'd be glad to help

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.

Implement "forget this domain" feature on about:history
7 participants