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

Keep bookmarked entries on history #6211

Merged
merged 1 commit into from
Jan 11, 2017
Merged

Keep bookmarked entries on history #6211

merged 1 commit into from
Jan 11, 2017

Conversation

cezaraugusto
Copy link
Contributor

@cezaraugusto cezaraugusto commented Dec 14, 2016

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Ran git rebase -i to squash commits (if needed).

Auditor: @bsclifton, @darkdh

Fix #6160

Test plan:

Automated tests must pass

npm run test -- --grep="returns newSiteDetail value for lastAccessedTime when oldSite value is undefined"
npm run test -- --grep="returns oldSiteDetail value for lastAccessedTime when newSite value is undefined"

Manual tests:

  1. Visit a site
  2. Go to about:history and check entry is there
  3. Bookmark that site
  4. Entry should still be visible on about:history
  5. Bookmark about:history
  6. History should be bookmarked (but not visible on about:history as we don't store about pages)

@darkdh
Copy link
Member

darkdh commented Dec 14, 2016

We should add this case into

siteUtil
    addSite
      for new entries (oldSite is null)
        when adding history

@bsclifton
Copy link
Member

Great fix, @cezaraugusto 😄 Only thing I can add is a +1 for @darkdh's comment for adding a test

@bsclifton
Copy link
Member

@cezaraugusto does this also fix #5413?

@cezaraugusto
Copy link
Contributor Author

cezaraugusto commented Dec 14, 2016

@bsclifton not really, that one happens due to our site's counter. There's an inconsistency between the moment we add a bookmark, but fix is on the way (next).

location: testUrl1,
lastAccessedTime: 123,
tags: [siteTags.BOOKMARK]
})
Copy link
Member

Choose a reason for hiding this comment

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

I guess you might forgot to call addSite for this siteDetail and you may need to leverage previous processedSites as first argument.

Copy link
Member

Choose a reason for hiding this comment

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

@cezaraugusto the above mention by @darkdh is correct; we need to actually call addSite (which then calls mergeSiteDetails, where the change was made). When you call addSite, you'll want to make a test case for each value. Where it returns:

  • lastAccessedTime = newSiteDetail.get('lastAccessedTime')
  • lastAccessedTime = oldSiteDetail.get('lastAccessedTime')
  • lastAccessedTime = 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok thanks, added one for oldSites and one for newSites. Case for lastAccessedTime = 0 was already covered by @darkdh, since it's the same case AFAIU, I left it as-is.

it('returns oldSiteDetail value for lastAccessedTime when newSite value is undefined', function () {
const oldSiteDetail = Immutable.fromJS({
lastAccessedTime: 456,
tags: [siteTags.BOOKMARK],
Copy link
Member

Choose a reason for hiding this comment

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

Test looks good but I think we should remove oldSiteDetail's tags to make it closer to our use case "Bookmark a site after it is added to history"

@darkdh
Copy link
Member

darkdh commented Dec 16, 2016

lgtm

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 great 😄 Thanks for the tests!

Auditor: @bsclifton, @darkdh

Fix #6160

Test plan:

Automated tests must pass
npm run test -- --grep="returns newSiteDetail value for lastAccessedTime when oldSite value is undefined"

npm run test -- --grep="returns oldSiteDetail value for lastAccessedTime when newSite value is undefined"
@bsclifton bsclifton changed the base branch from master to 0.13.1-branch January 11, 2017 17:31
@bsclifton
Copy link
Member

CI had 2 errors; I re-ran both of those locally and they both passed. 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.

4 participants