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

Commit

Permalink
Merge pull request #11977 from NejcZdovc/hotfix/#11973-advance
Browse files Browse the repository at this point in the history
Fixes advance setting change
  • Loading branch information
bsclifton committed Nov 15, 2017
1 parent d2708a0 commit e729d46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/browser/api/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2224,7 +2224,7 @@ const onMediaRequest = (state, xhr, type, tabId) => {
return state
}

const minDuration = getSetting(settings.PAYMENTS_MINIMUM_VISIT_TIME)
const minDuration = parseInt(getSetting(settings.PAYMENTS_MINIMUM_VISIT_TIME))
duration = parseInt(duration)
if (duration > 0 && duration < minDuration) {
duration = minDuration
Expand Down
9 changes: 9 additions & 0 deletions test/unit/app/browser/api/ledgerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,15 @@ describe('ledger api unit tests', function () {
assert(saveVisitSpy.withArgs(cacheAppState, publisherKey, paymentsMinVisitTime, false).calledOnce)
})

it('min duration is set to minimum visit time if below that threshold (string setting)', function () {
paymentsMinVisitTime = '5000'
const xhr2 = 'https://www.youtube.com/api/stats/watchtime?docid=kLiLOkzLetE&st=20.338&et=21.339'
ledgerApi.onMediaRequest(cacheAppState, xhr2, ledgerMediaProviders.YOUTUBE, 1)
assert(publisherFromMediaPropsSpy.notCalled)
assert(saveVisitSpy.withArgs(cacheAppState, publisherKey, 5000, false).calledOnce)
paymentsMinVisitTime = 5000
})

it('revisited if visiting the same media in the same tab', function () {
// first call, revisit false
ledgerApi.onMediaRequest(cacheAppState, xhr, ledgerMediaProviders.YOUTUBE, 1)
Expand Down

0 comments on commit e729d46

Please sign in to comment.