Skip to content

Add back browser button support for callouts

What does this MR do and why?

  • when a callout is dismissed it is marked in the database so that it does not show again. however if a user navigates back via the browser, the cached page does not have the updated dismissed status and the user will see the callout again. this MR:
    • stores a timestamp for the callout in local storage
    • cleans up local storage callout items if the timestamp is older than 2 hours
    • cleanup only occurs when the class is rendered (on another page that uses this dismissible callout)
  • see #412475

References

Screenshots or screen recordings

No visual changes

How to set up and validate locally

  1. Find a page that uses this persistent_user_callout class (example: http://127.0.0.1:3000/dashboard/merge_requests/search)
    1. Callout: Your merge requests have a new homepage!
  2. Open up the console -> Application -> Local Storage
  3. Dismiss the callout
    1. Observe the callout key get added to local storage
    2. Observe new callout registry has the key in an array
    3. Observe the callout get added to the database (table: user_callouts)
  4. Navigate to another page
  5. Click the browser "back" button
  6. The callout may flash but should NOT reappear
  7. To check that local storage clean up occurs. you can alter the local storage timestamp to be greater than 2 hours prior
    1. Follow steps 4 - 5
    2. You should see the callout key is removed and the registry key is an empty array.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #412475

Edited by Kiesha Herman

Merge request reports

Loading