Commit Graph

13159 Commits

Author SHA1 Message Date
Sam Lord
1ec79bfaea Revert "Added @root-utils to the ghost-version module"
This reverts commit 846e9f1bbc.
2021-06-14 18:42:40 +01:00
Hannah Wolfe
c37de311ea
Split validation index into separate files
- The data/validation module is made up of several loosely related things with lots of dependencies
- Separating out the various components makes it possible to see what's what, and importantly what has complex dependencies
- validator + validate probably go togetheri in an external module, the other two files should probably have their own homes in related areas of ghost e.g. schema -> data/schema/validate.js
2021-06-14 18:18:28 +01:00
Sam Lord
846e9f1bbc Added @root-utils to the ghost-version module
no issue
Part of the effort to split ghost into smaller, decoupled parts. The
@root-utils package lets us avoid hard-coding a path to package.json,
and means that the ghost-version.js file could eventually be moved
into a separate module.
2021-06-14 16:33:53 +01:00
Daniel Lockyer
0cd9acabec
Imported Bookshelf type into plugin JSDocs
no issue

- the `Bookshelf` type wasn't being imported anywhere and editors were
  showing warnings for the missing type
- also fixes use of `Bookshelf.Model` - this doesn't work if we declare
  `Bookshelf` using a `@typedef` and the preferred syntax is using an
  array index
- note: it still complains because we're calling functions that are only
  declared in our custom Bookshelf Model but this is a step in the right
  direction
2021-06-14 16:30:58 +01:00
Daniel Lockyer
de9960fc45
Fixed broken syntax in pagination plugin
refs d783a8d2d4

- missed a comma in the `messages` object 🤦
2021-06-14 15:21:57 +01:00
Daniel Lockyer
d783a8d2d4
Removed use of i18n in Bookshelf plugins
no issue

- i18n is eventually going away in Ghost so we want to remove uses of it
- Bookshelf plugins are also getting extraced out of Ghost so we need to
  remove all local requires
- i18n is being replaced by inline templating with strings stored in the
  `messages` object
- this commit switches out the use of i18n in the Bookshelf plugins and
  replaces the templating function with our `@tryghost/tpl` package
2021-06-14 15:13:41 +01:00
Renovate Bot
1ec7c70c6f
Update dependency @sentry/node to v6.7.0 2021-06-14 10:06:31 +00:00
Renovate Bot
ed87d1837a Update dependency postcss to v8.3.3 2021-06-14 09:41:29 +01:00
Renovate Bot
aa531dc28b Update dependency @tryghost/members-csv to v1.0.1 2021-06-11 17:44:57 +01:00
Daniel Lockyer
e3ea40e268
Fixed JSDoc for DB helper functions
no issue

- the docs were referring to different parameter names so this commit
  bring them in line to make the warnings go away
2021-06-11 16:03:42 +01:00
Renovate Bot
aee829db15 Update dependency @tryghost/helpers to v1.1.46 2021-06-11 13:37:21 +01:00
Renovate Bot
8d9f06f7c9 Update dependency @tryghost/tpl to v0.1.1 2021-06-11 13:29:43 +01:00
Renovate Bot
07bc610e7e Update dependency @tryghost/session-service to v0.1.23 2021-06-11 13:27:04 +01:00
Renovate Bot
1811e0029f Update dependency @tryghost/vhost-middleware to v1.0.15 2021-06-11 13:26:04 +01:00
Renovate Bot
6cbb6c3c17 Update dependency @tryghost/image-transform to v1.0.12 2021-06-11 13:23:56 +01:00
Renovate Bot
8f7bba3a0e Update dependency @tryghost/mw-session-from-token to v0.1.21 2021-06-11 13:23:50 +01:00
Renovate Bot
d312a05f22 Update dependency @tryghost/promise to v0.1.9 2021-06-11 13:23:43 +01:00
Renovate Bot
def12e0951 Update CSS preprocessors 2021-06-11 13:23:29 +01:00
Renovate Bot
8baad6af30 Update dependency @tryghost/errors to v0.2.12 2021-06-11 13:23:17 +01:00
Renovate Bot
d89ef63317 Update dependency @tryghost/constants to v0.1.8 2021-06-11 13:23:07 +01:00
Renovate Bot
cd5b186b00 Update dependency @tryghost/bootstrap-socket to v0.2.9 2021-06-11 12:29:08 +01:00
Renovate Bot
d9883d6060 Update dependency @tryghost/adapter-manager to v0.2.13 2021-06-11 12:28:50 +01:00
Renovate Bot
13c2d84e1e Update dependency @tryghost/job-manager to v0.8.7 2021-06-11 12:28:38 +01:00
Renovate Bot
3bd03d2bca Update dependency @tryghost/limit-service to v0.6.1 2021-06-11 12:28:32 +01:00
Renovate Bot
99b06682f5 Update dependency @tryghost/security to v0.2.9 2021-06-11 12:28:20 +01:00
Renovate Bot
ff5b1be4e1 Update dependency @tryghost/zip to v1.1.14 2021-06-11 12:28:06 +01:00
Rishabh
8605597eea Updated multiple products UI handling on Portal
refs 4c1c607b83

- last commit missed updating portal version in the url, updated.
2021-06-11 15:10:23 +05:30
Rishabh
4c1c607b83 Added multiple products UI in Portal behind feature flag
refs https://github.com/TryGhost/Team/issues/767

- adds new multiple products UI in Portal (works behind the `multipleProducts` feature flag)
- Portal's current single product UI behaves the same when flag is switched off
2021-06-11 14:14:11 +05:30
Rishabh
0766a19afd Updated products data in portal site endpoint
refs https://github.com/TryGhost/Team/issues/763
refs https://github.com/TryGhost/Team/issues/718

- Removes redundant `plans` data from site data
- Updates products data to include monthly/yearly price
- Filters multiple products on site data based on labs flag
2021-06-11 12:41:46 +05:30
Kevin Ansfield
1bc57b584a
Added posts_meta.feature_image_{alt,caption} columns (#13030)
refs https://github.com/TryGhost/Team/issues/770

We want post feature image functionality to better match what's available inside the editor, to do that we'll need somewhere to store alt and caption meta data. `posts_meta` chosen because even though we want to make this generic for other tables in the future those tables also have a `feature_image` (or closely related) field.

- updated schema with new columns
- added migration to create columns
- cleaned new columns from API output
  - not output on v2/v3
  - conditionally output on v4/canary output based on labs flag
- bumped `@tryghost/admin-api-schema` to allow new columns through in canary API requests
  - silently clean properties from input when labs flag is disabled
  - updated acceptance tests so they fail if `admin-api-schema` is not letting the new fields through
2021-06-10 20:35:56 +01:00
Renovate Bot
b53de12e12
Update dependency eslint-plugin-ghost to v2.3.0 2021-06-10 16:13:31 +00:00
Renovate Bot
3472d7b63d
Update dependency @sentry/node to v6.6.0 2021-06-10 14:30:48 +00:00
Kevin Ansfield
4e724b6451
Fixed order of flatten/clean operations in posts output serializers (#13038)
no issue

`post.clean()` implementation was expecting a flat structure representing final API output but was being called before the flatten operation for `posts_meta` meaning the structure looked like `attrs.posts_meta.property` instead

- adjusted order in output serializers to call `clean()` after flattening the `posts_meta` object
- in `v2` output serializer, moved removal of properties from the serializer into `clean()` for consistency
2021-06-10 15:14:02 +01:00
Kevin Ansfield
f49f7699aa
Enabled all labs flags when testing (#13036)
no issue

Shows impact of new code behind labs flags through the existing acceptance/regression tests. Allows for existing tests to be updated to match new behaviour rather than requiring separate tests where individual flags are enabled. Should result in minimal test updating once code reaches GA.

- adds a forced `'labs:enabled'` fixture op that edits the `labs` setting to enable all flags then restarts the settings service to pick up the new setting
- modifies labs service to not remove ALPHA_FEATURE labs settings when running in a testing environment
2021-06-10 12:54:34 +01:00
Renovate Bot
139cf448d7
Update metascraper to v5.22.1 2021-06-09 15:53:54 +00:00
Hannah Wolfe
1f11bd9012
Updated package-json lib to not need DI
- The underlying package-json package has had i18n ripped out using the new tpl utility instead
- It's also then been refactored to not be a class that needs instantiating
- This means it can be required directly and its public interface methods used where needed
- This is a much nicer, neater pattern for what is a mature utility library :)
2021-06-09 16:48:19 +01:00
Hannah Wolfe
16728a3ef1
Swapped to American English spellings
- Traditionally all of Ghost's public-facing text was written in British English
 - We're changing that to US English because that's more common
 - US English should also be used in code e.g. properties are called color not colour
 - most of these changes are in comments, but I've changed them so that we have US English in front of us always
 - fixed a few other typos I noticed whilst there
2021-06-09 16:39:06 +01:00
Naz
0f6ea35d7e Added 'alpha' feature support to labs
refs https://github.com/TryGhost/Team/issues/772

- When the feature is introduced into Ghost at it's first lifecycle stage - "alpha" the rule is to have a "enableDeveloperExperiments" flag along with labs toggle turned on before it's usagble in the codebase
- The changeset introduced a "ALPHA_KEYS" concept which should allow distinguishing alpha flags from beta flags.
2021-06-09 19:30:34 +04:00
Daniel Lockyer
d25b8680f4
Added CI step to print debug logs upon CLI failure
no issue

- if Ghost-CLI tests fail, the CLI will put some extra debug logs in
  `~/.ghost/logs`
- these are useful to help see what the issue is, so we should print
  them out if we're experiencing a failure
- this commit cats the contents of the folder so we can see it in CI
2021-06-09 13:51:55 +01:00
Daniel Lockyer
1e54db2720
Moved @tryghost/tpl to dependencies
refs 971ac479dc

- `@tryghost/tpl` was accidentally placed in `devDependencies` but
  Ghost needs this to run so it would cause Ghost-CLI to fail when it
  only installs `dependencies`
- this commit moves the dependency to `dependencies`
- also pins the dependency to `0.1.0`
2021-06-09 13:48:32 +01:00
Hannah Wolfe
7f16533d4f
Added jsconfig.json to enable type checking
- we're experimenting with using a simple jsconfig file to enable type checking for Ghost + related repos
 - this should allow us all to see where we have typing issues, without requiring everything to be strictly typed or generating type files
2021-06-09 12:20:59 +01:00
Hannah Wolfe
971ac479dc
Updated ghost-server to use new minimal tpl helper
- We are going to get rid of the internal i18n tool because it doesn't solve a real use case
- Instead, we have a new tpl utility that does basic string interpolation
- This pattern will make it easier for us to decouple the codebase, and the new tool helps to keep the refactor surface area really small
- This is the first example of using the new tpl helper, so it also adds @tryghost/tpl
2021-06-09 12:20:59 +01:00
Rishabh
136fb093a3 Added labs flag for multiple products
refs https://github.com/TryGhost/Team/issues/763

- Adds new labs feature flag in the allow list to enable multiple products
2021-06-09 15:39:05 +05:30
Rishabh
b4f53a0b75 Reset active price ids for product on Stripe disconnect
refs e17f5004cc

In case of Stripe disconnect, it was possible that the product table still contained reference to monthly/yearly price id while the price itself isn't present in the DB. As part of Stripe disconnect reset, this also resets monthly/yearly price id for product.
2021-06-08 22:16:42 +05:30
Daniel Lockyer
faf9598d7a
v4.7.0 2021-06-08 17:06:37 +01:00
Daniel Lockyer
3ef2e684f2
Updated Ghost-Admin to v4.7.0 2021-06-08 17:06:37 +01:00
Rishabh Garg
e17f5004cc
🐛 Fixed unable to create new prices on switching Stripe account (#13013)
closes https://github.com/TryGhost/Team/issues/724
closes https://github.com/TryGhost/Team/issues/739

Currently, site owners are allowed to disconnect Stripe if they don't have any active subscriptions for a member. On disconnect, all stripe related data for the old account in DB should be cleared as using Stripe id for old account can cause weird failures due to incorrect Stripe key being used. This was also causing site owners to not be able to create new prices after connecting to new account as it ended up using old stripe product id which failed on Stripe request.
2021-06-08 21:28:16 +05:30
Rishabh
413c1cc4ce Handled empty stripe price object in API
no refs

In case of Stripe disconnect, its possible that the product table still contains reference to monthly/price id while the object itself isn't present in the DB. In this scenario the stripe price returned is empty object instead of `null` , which then passes down empty object in the API that causes clients to fail if they just check existence of stripe price. The fix returns `null` value for monthly/yearly price in case it has no reference and is empty object.
2021-06-08 20:59:39 +05:30
Rishabh
d2e4f30b5b Handled empty prices for product in Portal settings
no refs

Monthly/yearly price values on a product can be `null` when stripe is not connected, this change handles the prices passed to Portal settings to ignore null prices in the array.
2021-06-08 19:41:55 +05:30
Rishabh Garg
ba9b2ee68f
Updated monthly/yearly data in price helper (#13012)
closes https://github.com/TryGhost/Team/issues/761

With multiple products, each product can have an active monthly/yearly price, so we no longer store the monthly/yearly price ids in global settings but instead store them in product table directly. This means we need to update our global `@price` helper to also use the updated schema and use the monthly/yearly prices from product table instead of settings data.
2021-06-08 16:32:39 +05:30