Commit Graph

227 Commits

Author SHA1 Message Date
Fabien "egg" O'Carroll
37ef0582e6 Added members_subscription_created_events table & model
refs https://github.com/TryGhost/Team/issues/1803
2022-08-18 10:45:53 -04:00
Fabien "egg" O'Carroll
03155a61ff Added members_created_events table & model
refs https://github.com/TryGhost/Team/issues/1802
2022-08-18 10:45:53 -04:00
Daniel Lockyer
bde9b84221
Fixed page actions events stored as posts
- 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
2022-08-18 14:07:04 +02:00
Daniel Lockyer
f51226e5fb Organized package dependencies
- 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
2022-08-18 11:55:49 +02:00
renovate[bot]
0f998e30aa Update sentry-javascript monorepo to v7.11.1 2022-08-17 21:53:41 +02:00
renovate[bot]
79f28a82a3 Update sentry-javascript monorepo to v7.11.0 2022-08-17 21:16:25 +02:00
Naz
8b46814700 Reworked image sizes cache to work with async cache
refs https://github.com/TryGhost/Toolbox/issues/364

- The caches can be or async nature. Having await syntax allows to  support both types - sync and async.
2022-08-17 19:03:50 +02:00
Daniel Lockyer
7aecae11cc
Cleaned up multiple implementations of getAction
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
2022-08-17 10:40:34 +02:00
renovate[bot]
f348fc3223
Updated @tryghost dependencies (#15235)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-17 08:45:47 +02:00
Simon Backx
c4ea36cfde
Added member attribution script (#15242)
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.
2022-08-16 15:44:51 +02:00
Naz
6cf49d8f89 Fixed inconsistent format of image sizes cache
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).
2022-08-16 15:20:49 +02:00
Peter Zimon
1b6b905dcd Added free trial indicator to tier card in Admin
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
2022-08-16 14:15:31 +02:00
Naz
e4d02657ee Swapped image size "Map" cache for adapter cache
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
2022-08-16 12:35:35 +02:00
Naz
34b4421452 Moved settings cache to an explicit "in memory" adapter
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)
2022-08-16 12:35:35 +02:00
Naz
05eb719d0a Swapped image size cache with InMemoryCache
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.
2022-08-16 12:35:35 +02:00
Naz
e549528985 Simplified image size cache module constructor
refs https://github.com/TryGhost/Toolbox/issues/364

- As little as possible should be passed in in the parameters for any method/constructor/whatever. Specific Function > vague Object
2022-08-16 12:35:35 +02:00
Naz
58a656cbc2 Refactored cached image sized module async error handling
refs https://github.com/TryGhost/Toolbox/issues/364

- A little cleanup
2022-08-16 12:35:35 +02:00
Naz
92d6c998b3 Fixed error handling bug in image size cache
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
2022-08-16 12:35:35 +02:00
Naz
7910779143 Removed "has" method usage to be cache-compatible
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.
2022-08-16 12:35:35 +02:00
Naz
38c76847e9 Refactored cache image size test suite
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.
2022-08-16 12:35:35 +02:00
Naz
7d3b678d4e Refactored cached image size to have cache as DI
refs https://github.com/TryGhost/Toolbox/issues/364

- Groundwork before swapping out existing cache for in-memory cache from the adapter
2022-08-16 12:35:35 +02:00
Fabien "egg" O'Carroll
c37670ea40 Fixed Settings API test snapshot
refs https://github.com/TryGhost/Team/issues/1801

Adding a new labs flag increased the content length of the settings snapshot
2022-08-15 17:20:43 -04:00
Fabien "egg" O'Carroll
73fec0fc93 Added the memberAttribution alpha flag
refs https://github.com/TryGhost/Team/issues/1801

This will allow us to develop behind a flag, and switch it to beta
down the line.
2022-08-15 17:10:08 -04:00
Daniel Lockyer
d153b40c48 v5.9.4 2022-08-15 20:47:26 +01:00
Fabien 'egg' O'Carroll
96cd6df6fa
🐛 Fixed Comments administration for self hosters (#15239)
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.
2022-08-15 15:38:19 -04:00
Daniel Lockyer
b27ea8f504
Optimized database resets for local testing
- 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
2022-08-15 16:58:56 +02:00
Hannah Wolfe
9f38e8c49c
Removed unused comments route (#15238)
- 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
2022-08-15 15:45:42 +01:00
Hannah Wolfe
22fd7f289c
Removed need for snapshot updates for feature flags
- 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
2022-08-15 15:36:14 +01:00
Daniel Lockyer
70aa1dd3c8
Added auditLog labs flag
refs https://github.com/TryGhost/Toolbox/issues/356

- allows work on the Audit Log project whilst in alpha
2022-08-15 14:59:32 +02:00
Daniel Lockyer
d493fd7bf1 v5.9.3 2022-08-15 13:09:54 +01:00
Peter Zimon
aaa967eafe Fixed missing quote indicators in comment emails
refs. https://github.com/TryGhost/Team/issues/1794

- left border was missing for quotes in comment related emails
2022-08-15 13:47:25 +02:00
Simon Backx
bad4f13c2f 🐛 Fixed comments script always injected
refs https://ghost.slack.com/archives/C02G9E68C/p1660562592376769
2022-08-15 13:26:24 +02:00
Daniel Lockyer
fa6900b299 v5.9.2 2022-08-15 10:55:17 +01:00
Simon Backx
a666b846e6
🐛 Fixed unsubscribe flow for comment reply emails (#15232)
refs https://github.com/TryGhost/Team/issues/1790

- Currently we go to the account settings when you click 'Manage your email preferences' in the footer of an email that informs a comment author that they received a reply.
- Related Portal changes are here: https://github.com/TryGhost/Portal/pull/255
2022-08-15 11:36:08 +02:00
Simon Backx
f6a7f75465 Bumped comments-ui to v0.9 2022-08-15 11:30:54 +02:00
renovate[bot]
7f5d95ffff Update @tryghost 2022-08-15 10:08:46 +02:00
renovate[bot]
7d3f5d3165 Update dependency eslint to v8.22.0 2022-08-15 10:07:34 +02:00
Daniel Lockyer
d2eda5cf51 Extracted oembed service to separate package
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
2022-08-15 10:07:06 +02:00
Daniel Lockyer
dfbe8ee296 Removed Sentry from oembed service
- 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
2022-08-15 10:07:06 +02:00
renovate[bot]
5250dd9a12 Update dependency cssnano to v5.1.13 2022-08-13 11:20:27 +02:00
Daniel Lockyer
54baa8d71e v5.9.1 2022-08-12 17:11:31 +01:00
Daniel Lockyer
b7ea57e2da
🐛 Fixed packaging issue with missing component
refs bf254b9c6a

- this was missing from the referenced commit in order to import the
  package into Ghost core
2022-08-12 17:48:40 +02:00
Daniel Lockyer
b06b7c5ddd v5.9.0 2022-08-12 16:00:29 +01:00
Daniel Lockyer
02c9f287fb 🎨 Updated Casper to v5.3.0 2022-08-12 16:00:29 +01:00
Simon Backx
27df4e536f
Added native comments (#15223)
no issue

- Removes the comments lab flag (bumping it to GA).
- Bumps comments-ui to v0.8
2022-08-12 16:06:06 +02:00
Aileen Nowak
77e4be6b81 Updated tests to incl. host limit cases for core integrations
- 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
2022-08-12 14:18:44 +01:00
Aileen Nowak
5ac779f86b Added core type integrations to API serializer 2022-08-12 14:18:44 +01:00
Aileen Nowak
0e284edbad Allowed core integrations to work with Admin API 2022-08-12 14:18:44 +01:00
Aileen Nowak
c813e5d96e Added migrations to change Ghost Explore integration type
no issue

- The previous integration type is insufficient and we need to utilise a new type `core`
2022-08-12 14:18:44 +01:00
James Morris
44aa5336d6 Updated the comments version to 0.7.0
no issue
2022-08-12 14:11:46 +01:00