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

Bookmark fixes for 0.12.5 #4756

Merged
merged 1 commit into from
Oct 14, 2016
Merged

Bookmark fixes for 0.12.5 #4756

merged 1 commit into from
Oct 14, 2016

Conversation

bsclifton
Copy link
Member

@bsclifton bsclifton commented Oct 13, 2016

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

Auditors: @jkup @darkdh

Other Bookmarks

Other Bookmarks in about:bookmarks now displays sub-folders properly

Fixes #4685

Test Plan:

  1. Open Brave and go to about:bookmarks
  2. Create a bookmark if you don't already have one
  3. Drag and drop this bookmark into the "Other Bookmarks" folder
  4. Confirm when "Other Bookmarks" is clicked that it shows in the right pane
  5. Create a new bookmark folder and put this bookmark into it
  6. Drag and drop this new bookmark folder into "Other Bookmarks"
  7. Confirm the UI shows a subfolder under "Other Bookmarks"
  8. Click the subfolder and confirm bookmark shows in right pane

Fix disappearing bookmark folders

Bookmark folders can no longer be moved into themselves (which causes them to disappear).
(This was a long-standing bug and this commit adds a test to ensure it's not possible)

Fixes #4751

Test Plan:
This was hard to reproduce... I would suggest trying to drag and drop a lot in the UI. @alexwykoff had captured the steps as dragging a bookmark folder into the right pane. The bookmark folders should never disappear

<BookmarkFolderItem bookmarkFolder={bookmarkFolder}
this.props.isRoot && bookmarkFolder.get('parentFolderId') === -1
? null
: <BookmarkFolderItem bookmarkFolder={bookmarkFolder}
allBookmarkFolders={this.props.allBookmarkFolders}
Copy link
Member Author

Choose a reason for hiding this comment

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

This check is so that folders that are children of "Other Bookmarks" don't show under "Bookmarks Toolbar". Since the above check (line 50) was removed, it will now bind ALL bookmarks to this control.

const childBookmarkFolders = this.props.bookmarkFolder.get('folderId') === -1
? []
: this.props.allBookmarkFolders
const childBookmarkFolders = this.props.allBookmarkFolders
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this still return -1? If so won't a .filter() throw?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good eye 😄 The folderId of -1 is reserved for the "Other Bookmarks" folder (just like 0 is reserved for "Bookmarks Toolbar"). This binding creates an item for each child by matching folderId with the parentFolderId bound to this control. This does match successfully for "Other Bookmarks", but not at the root level (the one below which has the isRoot check, which is where "Other Bookmarks" is isolated to, the bottom)

Sorry that was an awfully big mouthful 😄 (hopefully it makes sense!)

Copy link
Member

Choose a reason for hiding this comment

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

I use -1 for "Other Bookmarks" in importer too.

@jkup
Copy link
Contributor

jkup commented Oct 13, 2016

Code LGTM! I posted that one concern but as long as that's not a problem ++ from me!

Fixes #4685

Bookmark folders can no longer be moved into themselves (which causes them to disappear).
(This was a long-standing bug and this commit adds a test to ensure it's not possible)
Fixes #4751
if (bookmark) {
// Don't allow a bookmark folder to be moved into itself
if (bookmark.get('folderId') === this.props.bookmarkFolder.get('folderId')) {
Copy link
Member

@bbondy bbondy Oct 14, 2016

Choose a reason for hiding this comment

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

we have another check somewhere that checks all decedents but I don't remember where off hand. Is this a strong enough check? I.e. could someone do something like this?

A
--- B
     --- C

And then move A into C to create a circular ref?

Copy link
Member Author

Choose a reason for hiding this comment

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

we have something like this in the moveSite code; I'll make sure that code is rock solid by working on some unit tests 😄

@bbondy
Copy link
Member

bbondy commented Oct 14, 2016

merging, thanks

@bbondy bbondy merged commit d034a63 into brave:master Oct 14, 2016
@darkdh
Copy link
Member

darkdh commented Oct 14, 2016

++

@luixxiul
Copy link
Contributor

follow-up: #4788 #4804

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.

7 participants