HomePhabricator
Diffusion Comm 2ce478126824

[web] Enable db for all users

Description

[web] Enable db for all users

Summary:
Part of ENG-4844
Depends on D9108

Enabling web database for all users, including non-staff and anonymous users. Merged clearSensitiveData with init because they need to be done atomically: clearSensitiveData leaves db in uninitialized state, which caused problems in some edge cases. Also renamed notSupported to notRunning as it better describes the db state. Also simplified web/sqlite-data-handler so it has structure more similar to the native/sqlite-data-handler.

Draft migration handled in the next diff.

Test Plan:
Tested on chromium and safari:

  • [on master] Replaced code in isSQLiteSupported:
return false; // <- added
if (!isDev && (!currentLoggedInUserID || !isStaff(currentLoggedInUserID))) {
  return false;
}
  • Logged in, made sure that there is persist:root in local storage, closed the web page
  • [Applied this diff] Opened the web page
  • Checked logs
    • "Database initialization success"
    • "migrating state to sqlite storage"
    • "version match, noop migration"
  • Checked if selected apps were persisted after reload
  • Reloaded web app, logged out, reload again -> checked if after each operation I got "Database initialization success" log

Tested on chromium:

  • [On master] Replaced the code like in the previous test case, but _didn't_ log in
  • Made sure that there is persist:root in local storage, closed the web page
  • [Applied diff + added console log when user id is set] Opened the web page, checked that the logs are the same as in the previous test case (db init and sqlite migration)
  • Logged in -> user id was set
  • Reloaded -> got "Database intialization success"
  • Logged out -> got "Clearing sensitive data" and "Database intialization success"

Reviewers: kamil, inka, atul, tomek

Reviewed By: kamil, inka, atul

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D9109

Details

Provenance
Michal Gniadek <michal.gniadek@swmansion.com>Authored on Sep 8 2023, 3:03 AM
Reviewer
kamil
Differential Revision
D9109: [web] Enable db for all users
Parents
rCOMM5704f7fa8d34: [web] Initialize database at startup on safari
Branches
Unknown
Tags
Unknown

Event Timeline

Michal Gniadek <michal.gniadek@swmansion.com> committed rCOMM2ce478126824: [web] Enable db for all users (authored by Michal Gniadek <michal.gniadek@swmansion.com>).Sep 18 2023, 3:25 AM