-
Notifications
You must be signed in to change notification settings - Fork 975
Fixes publisher not added to the ledger #11592
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11592 +/- ##
==========================================
- Coverage 52.54% 52.26% -0.29%
==========================================
Files 268 268
Lines 25296 25311 +15
Branches 4032 4034 +2
==========================================
- Hits 13293 13228 -65
- Misses 12003 12083 +80
|
9c20c0b
to
cc9b183
Compare
I am done with an initial work. I am waiting for some feedback regarding what is visit, then I will do final clenup |
30e33b5
to
f7b1813
Compare
PR is ready for the review |
Resolves brave#11575 Auditors: Test Plan:
f7b1813
to
4d5c436
Compare
@@ -3,6 +3,8 @@ | |||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | |||
|
|||
const Immutable = require('immutable') | |||
const electron = require('electron') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine but I think preferred style is const {BrowserWindow} = require('electron')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it was moved code, so feel free to leave as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if (!lastActiveTabId || tabId === lastActiveTabId) { | ||
state = ledgerApi.pageDataChanged(state, { | ||
location: pageUrl, | ||
tabId: tabId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit on style:
just tabId
instead of tabId: tabId
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -1,5 +1,6 @@ | |||
chrome.idle.setDetectionInterval(15 * 60) | |||
chrome.idle.onStateChanged.addListener((idleState) => { | |||
// uses appConstants.APP_IDLE_STATE_CHANGED action constant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: start comment with capital and end in period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
afterEach(function () { | ||
pageDataChangedSpy.restore() | ||
}) | ||
it('doesnt calls ledgerApi.pageDataChanged when no idle state is provided', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: does not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
assert(pageDataChangedSpy.withArgs(appState).calledOnce) | ||
}) | ||
it('calls ledgerApi.addVisit', function () { | ||
assert(addVisitSpy.calledOnce) | ||
it('doesnt calls ledgerApi.pageDataChanged when in idleState', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit does not or doesn't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
app/common/lib/ledgerUtil.js
Outdated
* @return {boolean} true if page should have usage collected, false if not | ||
*/ | ||
const shouldTrackView = (view, responseList) => { | ||
if (view == null) { | ||
const shouldTrackView = (tab) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please rename this to tabValue
because we usually use tab
as the webContents in code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
app/browser/api/ledger.js
Outdated
if (location === currentUrl) { | ||
return state | ||
} | ||
|
||
state = setLocation(state, timestamp, tabId) | ||
/* | ||
Save previous recorder page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: * to align with other stars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
app/browser/api/ledger.js
Outdated
const aboutUrl = getSourceAboutUrl(lastUrl) || lastUrl | ||
if (aboutUrl && aboutUrl.match(/^about/)) { | ||
state = pageDataState.resetInfo(state) | ||
// add visit to the ledger when we are not in a private tab |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit comment style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
app/browser/api/ledger.js
Outdated
|
||
currentUrl = (location && location.match(/^about/)) ? locationDefault : location | ||
currentTimestamp = timestamp | ||
// update to the latest view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit comment style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
4d5c436
to
eac5a03
Compare
Fixes publisher not added to the ledger
Fixes publisher not added to the ledger
Fixes publisher not added to the ledger
Submitter Checklist:
git rebase -i
to squash commits (if needed).Resolves #11553 - Publishers auto-included even with auto-include switch disabled
Resolves #11575 - Page data refactor
Resolves #11273 - Ledger table doesn't auto populate the publishers
Resolves #11274 - Site not added to publisher list even after spending ~10 mins on the site
Auditors:
Test Plan:
for every test plan you need to clean your profile and enable payments
Plan A
Plan B
Plan C- do plan B- switch to the site tab and stay on it for 15s- open new tab and visit different site for 15s- switch to preference tab and new site should be added and old site should have 2 visitsPlan C is not valid, please check plan E
Plan D
Plan E
Plan F
auto-include
settingsPlan G
Plan H
Reviewer Checklist:
Tests