Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookmarks: Undo behavior #3828

Merged
merged 20 commits into from
Nov 21, 2023
Merged

Bookmarks: Undo behavior #3828

merged 20 commits into from
Nov 21, 2023

Conversation

malmstein
Copy link
Contributor

@malmstein malmstein commented Nov 8, 2023

Task/Issue URL: https://app.asana.com/0/488551667048375/1205171041444238/f

Description

This PR changes how undo works at a UI layer level for saved sites.
Until now, when the user wanted to delete a bookmark, we were directly removing it from the DB. In the case that the user were to undo the change, we were adding a new row to the DB. This is problematic in many levels, changing order of Favourites and also triggering unnecessary Sync operations.

Steps to test this PR

All test cases assume that Sync is enabled

Remove Favourite from Bookmarks screen

  • Add a favourite
  • Verify that Sync operation is triggered
  • Open Bookmarks screen
  • Remove favourite
  • Verify Sync operation is not triggered
  • Verify Site does not appear in Favourites list
  • Tap on Undo
  • Verify Sync operation is not triggered
  • Verify Site appears in the Favourites list
  • Remove favourite and let Snackbar disappear
  • Verify that Sync operation is triggered

Remove Bookmark from Browser

  • Add a bookmark
  • Verify that Sync operation is triggered
  • Open Bookmarks screen
  • Remove bookmark
  • Verify Sync operation is not triggered
  • Verify Site does not appear in Favourites list
  • Verify Site does not appear in Bookmarks list
  • Tap on Undo
  • Verify Sync operation is not triggered
  • Verify Site appears in the Favourites list
  • Verify Site appears in the Bookmarks list
  • Remove bookmark and let Snackbar disappear
  • Verify that Sync operation is triggered

Remove Favourite from Browser

  • Add a favourite
  • Verify that Sync operation is triggered
  • Remove favourite
  • Verify Sync operation is not triggered
  • Verify Site is not favourited in the Browser Menu
  • Tap on Undo
  • Verify Sync operation is not triggered
  • Verify Site is favourited in the Browser Menu
  • Remove favourite and let Snackbar disappear
  • Verify that Sync operation is triggered

Remove Bookmark from Browser

  • Add a bookmark
  • Verify that Sync operation is triggered
  • Open Browser Menu and tap on Edit
  • Remove bookmark
  • Verify Sync operation is not triggered
  • Verify Site is not favourited in the Browser Menu
  • Verify Site is not bookmarked in the Browser Menu (should see Add bookmark instead)
  • Tap on Undo
  • Verify Sync operation is not triggered
  • Verify Site is favourited in the Browser Menu
  • Remove favourite and let Snackbar disappear
  • Verify that Sync operation is triggered

Remove Favourite from New Tab

  • Add a favourite
  • Verify that Sync operation is triggered
  • Open New Tab
  • Long tap on Favourite and Delete it
  • Verify Sync operation is not triggered
  • Verify Site no longer appears in the grid
  • Tap on Undo
  • Verify Sync operation is not triggered
  • Verify Site is visible in the grid
  • Remove favourite and let Snackbar disappear
  • Verify that Sync operation is triggered

Remove Favourite from Omnibar Quick Access

  • Add a favourite
  • Verify that Sync operation is triggered
  • Tap on omnibar so that the quick access panel appears
  • Long tap on Favourite and Delete it
  • Verify Sync operation is not triggered
  • Verify Site no longer appears in the grid
  • Tap on Undo
  • Verify Sync operation is not triggered
  • Verify Site is visible in the quick access panel
  • Remove favourite and let Snackbar disappear
  • Verify that Sync operation is triggered

Remove Favourite from Favourites Widget

  • Add Favourites Widget to device Home screen
  • Add a favourite
  • Verify that Sync operation is triggered
  • Send device to home and tap on Favourites Widget
  • Long tap on Favourite and Delete it
  • Verify Sync operation is not triggered
  • Verify Site no longer appears in the grid
  • Tap on Undo
  • Verify Sync operation is not triggered
  • Verify Site is visible in the quick access panel
  • Remove favourite and let Snackbar disappear
  • Verify that Sync operation is triggered

@malmstein malmstein force-pushed the 08-30-Bookmarks_Undo_behavior branch from b38d8e8 to cd16c21 Compare November 8, 2023 10:18
@malmstein
Copy link
Contributor Author

malmstein commented Nov 8, 2023

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@malmstein malmstein force-pushed the 08-30-Bookmarks_Undo_behavior branch 3 times, most recently from 62c0291 to f1133b2 Compare November 14, 2023 10:27
@malmstein malmstein marked this pull request as ready for review November 14, 2023 12:18
Copy link
Contributor

@cmonfortep cmonfortep left a comment

Choose a reason for hiding this comment

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

I have a few comments I would like to review together:

  • Move logic out of the UI, and keep viewmodel methods agnostic.
  • We don't have a consitent way to hide savedsites/folders. One implementation for Bookmarks screen, and different implementations for BrowserTab and SystemSearch screens. I think we should unify the logic (posted a proposal, let's review if that will work)

@malmstein malmstein force-pushed the 08-30-Bookmarks_Undo_behavior branch 2 times, most recently from cf0cf20 to a1db403 Compare November 17, 2023 10:48
Copy link
Contributor

@cmonfortep cmonfortep left a comment

Choose a reason for hiding this comment

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

LGTM works great!

@malmstein malmstein force-pushed the 08-30-Bookmarks_Undo_behavior branch from 3562a65 to ffd2edd Compare November 21, 2023 09:19
@malmstein malmstein merged commit 67f2b53 into develop Nov 21, 2023
7 checks passed
@malmstein malmstein deleted the 08-30-Bookmarks_Undo_behavior branch November 21, 2023 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants