Ghost/ghost/admin/tests/unit
Chris Raible 046b06fe72
Refactored local revisions to avoid QuotaExceededErrors (#21128)
ref https://ghost-foundation.sentry.io/issues/5908152800/

- In the current state, we are maintaining an 'index' key for all
revisions in localStorage. This gives us quick and easy access to all
the revisions in localStorage, but it requires additional "bookkeeping"
to update the index each time we add/remove a key.
- In some obscure edge cases, this results in the `remove()` method
throwing a `QuotaExceededError` (since removing a revision also requires
updating the index with `localStorage.setItem()`). If the `remove()`
call fails, we are sort of stuck — the only way to reduce our storage
usage is to remove items, but if the `remove()` method throws errors, we
can't do that.
- This change removes the whole index concept, and instead loops over
all the keys in localStorage, filtering by the prefix to find all our
revisions. This makes the `keys()` method slightly more complex, as it
has to filter out keys in localStorage that aren't related to revisions,
but it simplifies saving and removing revisions.
- Critically, this also means that `remove()` should never throw a
`QuotaExceededError`, since it no longer needs to call
`localStorage.setItem()` — it now simply calls
`localStorage.removeItem()` for the revision, which should never fail.
2024-09-26 12:50:31 -07:00
..
authenticators Made session.user a synchronous property rather than a promise 2021-07-08 14:54:31 +01:00
components 🐛 Fixed button URL suggestions not loading for contributors, editors and authors (#20416) 2024-06-20 14:22:41 +02:00
controllers Added extra post model state properties to debug logs 2024-09-20 09:14:39 +01:00
helpers Fixed member subscription status when multiple subs (#19530) 2024-01-24 12:16:26 +01:00
mixins Update dependency eslint-plugin-ghost to v1.4.0 2020-05-06 18:07:01 +01:00
models Ran ember-cli-update --run-codemods (#2219) 2022-01-21 19:25:47 +00:00
routes Added full-page refresh when new post route is in a bad state 2024-09-23 22:38:34 +01:00
serializers Switched from v3 to canary API 2021-02-05 09:12:26 +00:00
services Refactored local revisions to avoid QuotaExceededErrors (#21128) 2024-09-26 12:50:31 -07:00
transforms Refactored to use individual slack settings (#2384) 2022-05-16 11:38:32 +01:00
utils Added Tips & Donations one-off payments 2024-09-03 16:00:48 +01:00
validators Refactored to use individual slack settings (#2384) 2022-05-16 11:38:32 +01:00
.gitkeep Ember init, bower deps, es6 modules 2015-03-11 12:37:41 -06:00