- this was due to the fact that we use the same model for pages as we do
for posts, so the hardcoded `post` key was not accurate
- this commit adds support for providing a function to return the key for the
action type
- cleaned up unused dependencies
- adds missing dependencies that are used in the code
- this should help us be more explicit about the dependencies a package
uses
refs https://github.com/TryGhost/Toolbox/issues/356
- we had a function called `getAction` in every model where we were
collecting CRUD actions to store in the DB
- this function has the same boilerplate code - make sure it's not
internal and then construct the object to return
- as we add more actions to more models, we probably want to pull this
out and just configure the things specific to the model
- this commit pulls out the function into the actions plugin and adds a
couple of keys to the models to indicate we'd like to store CRUD
actions, along with the model name
refs https://github.com/TryGhost/Team/issues/1804
- Adds a script that is only injected when the member attribution alpha flag is enabled
- This script builds a history and saves it in localStorage as `ghost-history` that contains something like this:
``` json
[
{
"time": 1660650730,
"path": "/about/"
},
{
"time": 1660651730,
"path": "/welcome/"
}
]
```
- Keeps track of the time of every page visit, so we can correctly remove old items. I also considered saving the time separately and clearing the whole history when the saved time is older than 24h, but that would have the side effect that items older than 24h might leak into the history if you visit every 12 hours (to give an example). Plus, having objects in the history might make it easier to add other attributes to the items if we ever want to do that in the future. We also have access to the time between visits.
- Added `.eslintrc` configuration for this new frontend script. This makes it easier to spot errors when developing, and follow the same syntax rules as other scripts. In the future it can allow us to require an older ECMA version in the browser script. If we like this pattern, we could also use it for other frontend scripts.
refs https://github.com/TryGhost/Toolbox/issues/364
refs 147ec91162
- This looks like a subtle bug that has gone unnoticed for years. Have checked if we rely on the logic anywhere (mostly used in image-dimensions frontend helper) - we don't access the "url" directly.
- There is no reasoning attached behind why the cached size was stored as a url (see refed commit)
- WHY is this even being fixed? Caches can store anything... does not mean we should! Inconsistent data becomes a real PITA if the cache is persisted and is hard to repopulate (e.g. to migrate the cached data format).
refs. https://github.com/TryGhost/Team/issues/1806
- free trial indicator - which helps users identify tiers easier - was missing on tier cards in Settings / Membership in the Admin
refs https://github.com/TryGhost/Toolbox/issues/364
- The "new Map()" cache was a "hidden cache" that did not follow any specific pattern. Following the cache adapter pattern here makes it possible swapping out the cache for alternative implementations - e.g. Redis storage
refs https://github.com/TryGhost/Toolbox/issues/364
- Before introducing an image size caching mechanism we need to make existing caches explicit - makes sure caches are operating in multiple different instances.
- Explicit syntax also allows to pass in different configurations for each cache instance (e.g. use different Redis connections for caches with different purposes)
refs https://github.com/TryGhost/Toolbox/issues/364
- The InMemoryCache is an implementation of the cache adapter interface and allows to test cache in the works which is "close to the real world". Being able to do so in tests for image sizes cache manager proves we can use other cache adapters such as Redis based ones.
refs https://github.com/TryGhost/Toolbox/issues/364
- Doing the `.catch(errors.NotFoundError...` was throwing another error as this syntax did not work with native promises. Checking `instanceof` works 100% and is way more explicit/readable way to handle this type of error differently
refs https://github.com/TryGhost/Toolbox/issues/364
- Cache adapter does not have a "has" method, so using "get" instead to achieve the same to have full compatibility. Should allow to just drop in the cache adapter implementation instead of current Map instance.
refs https://github.com/TryGhost/Toolbox/issues/364
- It was using an outdated syntax and relied on Bluebird depencency. Updated the syntax to async/await and dropped the Bluebird dependency.
refs https://github.com/TryGhost/Team/issues/1799
Rather than using the `adminAuthAssets` config which is not updated to
be aware of running in a different directory to the cwd, we use the
getContentPath method which handles all of the directory checking.
Without this, we were unable to serve the admin-auth iframe, as the
directory was incorrect for self hosters.
- we've had an optimization in CI that copies a fresh SQLite DB to a
file, and copies it back when we need to do a DB reset
- I originally only let this run in CI but we've had it around for a
while so we should GA it to run on local machines
- there may be edge cases, but we should fix them instead of letting
tests run slower for development
- this also makes sure we clean up any existing files before
initializing the DB
- the comments system lives at members/api/comments and was meant to be removed from here in an early refactor but was missed, possibly as a result of the huge rebase we did
- prior to this commit, if you add or remove a faeture flag, you also have to update the snapshots for the settings tests
- feature flags are intended to be very easy to add and remove, and so this extra step doesn't fit with our needs
- it's also unnecessary, we don't need to verify the exact contents of the labs setting
refs https://github.com/TryGhost/Toolbox/issues/363
- the oembed service is completely standalone and could do with some
individual unit tests
- moving it out to a package allows us to draw the boundaries better and
allows us to remove some dependencies from the core package.json
- I'm not sure if we gain anything here except noise
- it was added after a bug in the oembed service but it was regarding
oembed-parser and not metascraper
- added core and builtin integrations to test fixtures
- allowed passing a custom api key id to generate JWT
- updated admin key auth test to make successful request with a `core` integration, which doesn't work atm because relations are not returned