Commit Graph

9068 Commits

Author SHA1 Message Date
Kevin Ansfield
22306c4b19 Fixed type errors in post-email-serializer
no issue

- fixed errors showing in editor, no bugs just minor expected type differences
2021-06-18 15:37:42 +01:00
Daniel Lockyer
a457631a20
Moved defaultColumnsToFetch to Bookshelf CRUD plugin
no issue

- the CRUD plugin uses this function so we want to keep similar things
  together to make it easier to test in the future
2021-06-17 17:07:10 +01:00
Daniel Lockyer
0830bcb74e
Moved setId function to Bookshelf events plugin
no issue

- `setId` is only used within the `events` plugin and it makes sense to
  keep code together
- we don't lose anything by putting it here, but it should make it
  easier to test in the future
2021-06-17 17:07:10 +01:00
Fabien O'Carroll
5b66933981 Supported directly assigning products to members
refs https://github.com/TryGhost/Team/issues/748

This updates the @tryghost/members-api MemberRepository to stop ignoring
the `products` data passed to write operations, and to attach products
directly to members. As this logic is part of a new feature, we are
maintaining existing functionality by deleting the products data when
the feature flag is not enabled.

This functionality allows us to give members complimentary access to a
product without needing to use a Stripe Subscription internally.
2021-06-17 16:57:53 +01:00
Daniel Lockyer
c0baf5fdee
Moved formatOnWrite function to Bookshelf override plugin
no issue

- `formatOnWrite` doesn't override anything in Bookshelf but we use it
  within the `override` plugin and sub-models may override it, so it's
  easier to keep these things together
2021-06-17 16:47:47 +01:00
Daniel Lockyer
a635f3b68d
Updated JSDoc optional syntax in CRUD plugin
no issue

- optional parameters can be given in square brackets which makes
  editors understand it easier
2021-06-17 15:04:52 +01:00
Daniel Lockyer
a622f44564 Extracted Bookshelf method overrides to plugin
no issue

- all these functions override those within Bookshelf so this commit
  extracts them into a separate plugin from the Base model
2021-06-17 15:02:34 +01:00
Daniel Lockyer
5e9ab27a21
Refactored out local DB require in bulk-operations plugin
no issue

- we were only importing the `db` to access the `knex` instance, but
  we can get this through the Bookshelf instance
- switches to pulling out `knex` from Bookshelf so we can remove the
  remaining local require
2021-06-17 13:16:11 +01:00
Daniel Lockyer
a2b3568956
Fixed indenting for Bookshelf sanitize plugin JSDoc
no issue

- the indentation copied over incorrectly when I moved the code between
  files
2021-06-17 13:01:15 +01:00
Daniel Lockyer
76397f5aed Moved Bookshelf plugins to folder
no issue

- this moves all the plugins into a folder which but allows us to
  see which are still hanging around to be extracted out
2021-06-17 12:04:38 +01:00
Daniel Lockyer
67539a143b Extracted Bookshelf data manipulation code into plugins
no issue

- this commit extracts all code relating to manipulating/fixing data
  from the Base model into its own plugin
2021-06-17 12:04:38 +01:00
Daniel Lockyer
33d0f686be Extracted Bookshelf user type code into plugin
no issue

- this commit extracts the code relating to detecting if a user ID is
  internal/external from the Base model into a separate plugin
2021-06-17 12:04:38 +01:00
Daniel Lockyer
89ba4081b4 Extracted Bookshelf filtered collection code into plugin
no issue

- this commit extracts all code relating to filtering collections to a
  separate plugin to break down the Base model
2021-06-17 12:04:38 +01:00
Daniel Lockyer
930df4b7fb Extracted Bookshelf bulk operations to plugin
no issue

- this commit extracts code relating to bulk DB operations into a
  separate plugin
- it __could__ go into the CRUD one but these operations are a little
  more involved
2021-06-17 12:04:38 +01:00
Daniel Lockyer
e2b2a51d9b Extracted Bookshelf generateSlug function to plugin
no issue

- this commit extracts the niche `generateSlug` function into
  its own plugin so it can be extracted in the future
2021-06-17 12:04:38 +01:00
Daniel Lockyer
553e0932b2 Added missing Bookshelf JSDoc import
no issue

- this helps us with types across the model code
2021-06-17 12:04:38 +01:00
Daniel Lockyer
763d368c6e Extracted Bookshelf sanitization code to plugins
no issue

- this commit extracts all options + data sanitization code from the Base
  model into a plugin
2021-06-17 12:04:38 +01:00
Daniel Lockyer
f4f31027b7 Extracted Bookshelf raw_knex function to plugin
no issue

- this commit extracts the niche `raw_knex` function from the Base model
  into its own plugin
2021-06-17 12:04:38 +01:00
Daniel Lockyer
6ce1b11a15 Extracted Bookshelf events code to plugin
no issue

- this commit extracts event related code from the Base model into a plugin
- in particular:
    - events initialization
    - the `on*` events
    - `emitChange` - I'm not sure about this one but it __is__ event
      related
2021-06-17 12:04:38 +01:00
Daniel Lockyer
93c00b1ab7 Extracted Bookshelf actions code to plugin
no issue

- this commit extracts code related to Actions from the Base model into
  a separate plugin
- `api-key.js` contained the exact same helper function as the Base
  model so that has been de-duplicated
2021-06-17 12:04:38 +01:00
Daniel Lockyer
14ffd0b9d9 Extracted Bookshelf setup code into separate file
no issue

- I'm working on pulling apart the base index.js and this code is
  specific to setting up Bookshelf + the plugins, which is pretty
  contained and can stay in one file
- it only has one local require so it might be a good candidate for
  extracting out of Ghost in the future
2021-06-17 12:04:38 +01:00
Sam Lord
bdfac2524e Revert "Re-export logging in ./core/shared/logging"
This reverts commit 588bbcab84.
2021-06-17 11:11:03 +01:00
Kevin Ansfield
557ef28ae5 Added psmRedesign as an allowed labs flag
refs https://github.com/TryGhost/Team/issues/786

- flag will be used by Admin to toggle between old (popover) and new (sidebar) post settings menu behaviour
2021-06-17 10:49:20 +01:00
Sam Lord
588bbcab84 Re-export logging in ./core/shared/logging
no issue
Fixes commit caea330647 when running on Ghost (Pro), this is a temporary patch that will be removed when there are no references to the logging module.
2021-06-17 09:10:24 +01:00
Hannah Wolfe
ba8cdc8d2d
Split config utils into utils and helpers
- There are two different types of function here
   1. "helpers" are public API - config.something() that provide dynamic helpers on top of config
   2. "utils" are internal methods used only by config itself
- This commit makes this distinction clearer, although we should also change the code to enforce that utils are not exposed
2021-06-16 15:05:51 +01:00
Hannah Wolfe
93f9bc0105
Renamed config index to loader
- Renamed the file in line with our rules around index.js files
- Cleaned up some outdated code patterns
- Want to make the config module a little clearer in what it does
2021-06-16 14:42:06 +01:00
Hannah Wolfe
2adc7545c1
Cleaned code comments in config
- just one of those things you do to help make sense of code :D
- improves readability
2021-06-16 14:26:59 +01:00
Sam Lord
3f0bab4389 Replaced request module with @tryghost/request
no issue
Part of the effort to break up Ghost into smaller, decoupled modules.
2021-06-16 13:16:15 +01:00
Sam Lord
24332c3d24 Replaced ghost-version.js with @tryghost/version
no issue
Part of the effort to break up the Ghost codebase into smaller, decoupled modules.
2021-06-16 13:16:15 +01:00
Fabien 'egg' O'Carroll
8ea577b58b
Added support for canceling subscriptions (#13039)
refs https://github.com/TryGhost/Team/issues/775

As we currently do not delete canceled subscriptions and they are
exposed via the API, this functionality has been added to the
editSubscription controller method under the PUT HTTP method.

The cancelSubscription method in @tryghost/members-api was updated to
handle deleting by member id
2021-06-16 11:25:19 +01:00
Hannah Wolfe
526993965a
Switch to @trghost/validator, remove validator
- Part of the effort to split Ghost down into smaller, decoupled pieces
- Moved out our internal validator tooling to a separate library
- Replaced all usage of our own tooling and validatorjs directly with @tryghost/validator
- Removed the validatorjs dependency and removed the renovate pin
- This gives us a consistant, smaller, clearer public API for validations
- It will eventually be used on Ghost Admin too
- This way we can start getting up to date with validator whilst not increasing build size
2021-06-16 08:11:22 +01:00
Daniel Lockyer
97c0c93959 Refactored Bookshelf CRUD functions into plugin
no issue

- we're going to pull this out into the framework monorepo but
  refactoring it here first makes it a lot easier to extract without
  losing the history
2021-06-15 18:27:43 +01:00
Sam Lord
35e51e364b Switch to @tryghost/debug, remove ghost-ignition
no issue
The only pieces of Ghost-Ignition used in Ghost were debug and
logging. Both of these modules have been superceded by the Framework
monorepo, and all usages of Ignition have now been removed, replaced
with @tryghost/debug and @tryghost/logging.
2021-06-15 17:24:22 +01:00
Daniel Lockyer
f91daffdad
Revert "Refactored Bookshelf CRUD functions into plugin"
this reverts the following until tests have been fixed:
 - e51d505abb
 - c86ac27dcf
 - 3ffba967f2
2021-06-15 16:41:14 +01:00
Sam Lord
caea330647 Change to use @tryghost/logging
no issue

Logging is now controlled by a logginrc.js file in the root of the project - and now we can just import @tryghost/logging everywhere
2021-06-15 15:59:11 +01:00
Daniel Lockyer
3ffba967f2
Fixed path to CRUD plugin
no issue

- I renamed this just before pushing the previous commits but forgot to
  update it here
2021-06-15 15:50:22 +01:00
Daniel Lockyer
c86ac27dcf
Removed unused require
no issue

- we no longer need this as the code was extracted into a plugin
2021-06-15 15:49:21 +01:00
Daniel Lockyer
e51d505abb
Refactored Bookshelf CRUD functions into plugin
no issue

- we're going to pull this out into the `framework` monorepo but
  refactoring it here first makes it a lot easier to extract without
  losing the history
- note: this is very temporary and will be extracted soon
2021-06-15 15:46:33 +01:00
Hannah Wolfe
0fe8426f97
Renamed validation to validator + better public API
- renamed our internal validation library to "validator" - which is the same as the tool it wraps
- updated the public api so that validator methods are directly exposed
- this will make it a drop-in replacement for validator-js
- in turn, this allows us to pull this out into @tryghost/validator, and use our own wrapper instead of the 3rd party library
2021-06-15 15:32:36 +01:00
Hannah Wolfe
1688b17c49
Refactored + cleaned up validation tools
- General code cleanup
- Removed unused notContains rule
- Swapped custom empty rule for builtin isEmpty rule
- Dropped usage of .extend on validator, as this was removed 2 years ago!
   - This will allow us to upgrade the validator dependency to a much newer version
- Changed our internal validator module to only expose the functions we use.
   - This gives us a clearer Public API
   - It makes it easier to see if we are affected by changes in validator
   - It's still easy to add another validator, we just have to update what we require
   - We can potentially use this to make smaller builds esp for client-side usage
   - Once ripped out into a module we can use ES imports :D
- Rejigged and _slightly_ improved the tests
2021-06-15 15:17:20 +01:00
Sam Lord
160cb07e02 Added @tryghost/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.

This commit uses a patched version of @tryghost/root-utils which
checks for the existence of a `current` directory, as used in
Ghost-CLI. Since this is very specific to Ghost and Ghost CLI, there's
a new method called "getGhostRoot" for this purpose.
2021-06-15 15:06:31 +01:00
Daniel Lockyer
7cbe565f4f
Fixed JSDocs in base model
no issue

- Promise parameter types are given in diamond branches instead of
  parentheses, so switching to this makes editors happy
2021-06-15 13:28:59 +01:00
Daniel Lockyer
495ef867c2 Extracted Bookshelf plugins from Ghost to Framework repo
refs:
  - cf15f60085
  - dd20cc649b
  - ccf27f7009
  - abf146d61f
  - 2b54c92a14
  - bb029a53f6
  - 95bd7ee675
  - 9018b4df22
  - df01a6e5f4
  - d313726b34

- these plugins were in a state where they were independent enough to be
  pulled out into their own packages, which is what we did in the
  referenced commits above
- each package is named like `@tryghost/bookshelf-<plugin>`
- to avoid requiring multiple packages into Ghost, we've also created a
  wrapper package called `@tryghost/bookshelf-plugins` which re-exports
  all these plugins, so the changes in Ghost are very simple - dbebdd43b5
- this commit deletes the plugins + tests, and replaces with our new
  package with some minor code changes
2021-06-15 12:49:38 +01:00
Hannah Wolfe
4e49aeb9a0
Moved password validation into a library
- This is super specific code relating only to validating passwords.
- It's needed as a shared validator as we use other funnels to help people setup Ghost on Pro, but currently it's hard-baked into Ghost
- It's also not the greatest code. It'd be nice to be able to rework it and know that would automatically update everywhere passwords are set
2021-06-15 12:33:14 +01:00
Hannah Wolfe
d3cc85c920
Moved schema validator into the schema module
- This is a really specific piece of code related to validating models against our internal schema.js format
- This doesn't make sense without a schema.js file
- It does depend on the internal validator and validate tools - but those are used elsewhere too, and can reasonably be moved out of the codebase
- I don't see schema.js moving out of the codebase any time soon. We can move the validator but it would be a class that requires schema via DI
- For now my focus is on getting the data/validation tooling separated and making clear sense
- Improving data/schema can come later :)
2021-06-15 11:54:34 +01:00
Hannah Wolfe
68d60a1834
Removed i18n from validation modules 2021-06-15 11:30:37 +01:00
Daniel Lockyer
8e46288f37
Fixed JSDocs within pagination Bookshelf plugin
no issue

- `options` is not a correct type, so changed it to `Object` - maybe we
  could introduce an `options` type at some point
- also fixed another case of incorrect subtype extraction from
  `bookshelf`
2021-06-15 09:09:48 +01:00
Rishabh
db50aa64d8 Added cache invalidation for products api
no refs

- adding/changing products needs cache invalidation header otherwise frontend endpoints like `/members/api/site` use cached product data
- adds cache invalidation for both add and edit endpoints for products
2021-06-15 12:40:55 +05:30
Daniel Lockyer
5c866fadde
Removed i18n from base model
refs d783a8d2d4

- we're removing i18n from Ghost core because it no longer meets our
  needs
- this switches out i18n in the base Bookshelf model for our
  `tryghost/tpl` package with a `messages` object of strings sprinkled
  through the code
2021-06-14 20:53:13 +01:00
Daniel Lockyer
b7d96149e2
Improved JSDoc typing for Bookshelf plugins
no issue

- eager-load: turned param import into typedef for reusability and fixed
  attribute typing
- pagination:
    - removed typing on helper function object - this was incorrect and
      tsserver can pick up the real types a lot better, so removing it
      reduces maintenance overhead
    - `fetchPage` actually returns a Promise, so this fixes the typing
      on the docs
2021-06-14 20:52:18 +01:00
Daniel Lockyer
becf4c04e5
Converted Bookshelf collision plugin into async-await
no issue

- this helps avoid promise chaining and keeps the code neater
- also removes unneeded `bluebird` import after this change
2021-06-14 20:52:18 +01:00
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
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
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
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
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
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
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
Fabien O'Carroll
76a54059b0 Fixed Product API handling of original options
no-issue

The default include values are empty arrays which are not falsy, so the
boolean OR operator would never use the second operand. Instead we
concatenate the options together so that the API can use all of them.
2021-06-08 11:41:00 +01:00
Fabien O'Carroll
09a817da16 Fixed Product serializer lookup of original include
no-issue

The Frame object colocates the query, params & options data under a
single options property, this is not the case for the "original" data
however, which means that we need to explicitly check individual
"original" properties. We do not expect the `include` option to be used
as a param so that has been left out for now.

This reverts commit ea9a83d444.
2021-06-08 11:27:16 +01:00
Sanne de Vries
a028f7e706 Added padding to newsletter header image 2021-06-08 11:33:07 +02:00
Kevin Ansfield
97fec8443b Fixed email header divider showing when title+icon are disabled but no publication icon is set
refs https://github.com/TryGhost/Team/issues/755

- the default value for `show_header_icon` is `true` but if there's no publication icon set then it should be read as `false` when rendering the email
2021-06-08 10:18:18 +01:00
Hannah Wolfe
7069cc1221 Added initial match helper
refs: https://github.com/TryGhost/Team/issues/759

- wired up a matchHelper feature flag & used the labsEnabledHelper tool to gate the helper
- added a first version of the match helper, which is intended to replace the has helper
- this is an experimental helper and may or may not make it to GA
- match is a simple comparison helper, right now it does a very basic equals or not equals comparison
- much more functionality is needed to reach parity with has
2021-06-07 21:15:05 +01:00
Sam Lord
905a228cb7 Merged 4.6.6 into main 2021-06-07 18:03:33 +01:00
Sam Lord
433dd35839 Updated Ghost-Admin to v4.6.6 2021-06-07 17:59:45 +01:00
Naz
7a21522804 Restored labs' getAll function
refs https://github.com/TryGhost/Team/issues/757
refs 37ef40b46e/core/server/services/labs.js

- As more labs flags have been added to allowlist the `getAll` method should be returning members+all allowlisted flags
- The changeset restored the state of the method to the one reffed in the commit
2021-06-07 20:51:37 +04:00
Naz
3f286e8eb4 Removed group/type mapping in v4/canary Settings API
refs https://github.com/TryGhost/Team/issues/757

- The "type" value in settings is meant to be representing the data type stored in the "value" field. It was an overlooked bug in v4 API adding a mapper to  group->type
2021-06-07 19:47:02 +04:00
Kevin Ansfield
8dc4f183e2 Updated newsletter email template for new settings
refs https://github.com/TryGhost/Team/issues/755

Make use of the new settings in the email template when `enableDeveloperExperiments` flag is enabled.

- added header image output if set
- hide all header output if both show publication title+icon are disabled
- hide individual header output for title and logo based on individual settings
- add left-align and serif classes to title based on individual settings
- hide feature image when disabled
2021-06-07 16:31:50 +01:00
Kevin Ansfield
485a50794e Added extra newsletter settings
refs https://github.com/TryGhost/Team/issues/755

Additional customisation settings for newsletter emails are being introduced. Defaults match the existing email design.

- adds new settings
  - `newsletter_header_image` - stores URL from image upload
  - `newsletter_show_header_icon` - boolean toggle, default `true`
  - `newsletter_show_header_title` - boolean toggle, default `true`
  - `newsletter_show_feature_image` - boolean toggle, default `true`
  - `newsletter_title_alignment` - "left" or "center" selection, default "center"
  - `newsletter_title_font_category` - "serif" or "sans_serif" selection, default "sans_serif" (matches body font category selection)
2021-06-07 16:31:50 +01:00
Naz
48d36b6a48 Disallowed aditing "labs" settings in v2/v3 APIs
refs https://github.com/TryGhost/Team/issues/757

- There is no usecase for editing "labs" settings outside of canary/v4 API versions. Removing support for older versions makes the supported API surface smaller (easy maintenance).
2021-06-08 02:18:17 +12:00
Naz
d8230f3343 Added labs setting import validation
refs https://github.com/TryGhost/Team/issues/757

- Similarly to the API input serrialization importer should not pass through unknown labs keys to avoid soiling data
2021-06-08 02:18:17 +12:00
Naz
cd35358fdb Added labs setting input validation
refs https://github.com/TryGhost/Team/issues/757

- To safeguard from mise of a very permissing "object" value of the "labs" setting this change introduces an "allowlist" approach to filtering unrecognized labs flags
- Should allow maintainers to have a clear view of which labs flags are currently in use and manage them accordingly
2021-06-08 02:18:17 +12:00
Naz
8ab43b84d5 Enabled 'labs' to be accepted as a value in Settings API
refs https://github.com/TryGhost/Team/issues/757

- As labs has been added back to the settings table the APIs are reverting back to accepting it as a value
2021-06-08 02:18:17 +12:00
Naz
49ba26373d 🏗 Added "labs" setting enabling feature flags
refs https://github.com/TryGhost/Team/issues/757
refs https://github.com/TryGhost/Team/issues/332
refs ea6d656457

- We have a need a quick way to add features behind flags. The old way of "labs" is the quickest way to achieve this. It has ready tooling around it and well understood pitfalls. This change reintroduces "labs" group & key in settings table in the same shape it used to be (see reffed commit)
- Next step will be introducing very basic guard rails to protect from pitfalls previous implementation of "labs" had. This will include an allowlist based input validation for lab's object's data
-  The labs being an "object" type is an EXCEPTION. Even though it's an antipattern we aim to move away from, for now it's the lowest impact solution that will unblock the use of flags in the system. A proper solution will come at some point.
2021-06-08 02:18:17 +12:00
Sam Lord
573b0db76a Merged 4.6.5 into main 2021-06-07 11:31:01 +01:00
Sam Lord
625406ede5 Updated Ghost-Admin to v4.6.5 2021-06-07 11:25:17 +01:00
Fabien 'egg' O'Carroll
81de2fe223 🐛 Fixed saving Members with Complimentary plans (#13008)
* 🐛 Fixed saving Members with Complimentary plans

refs https://github.com/TryGhost/Team/issues/758

Since 4.6 The Admin is using the comped flag again, rather than creating
subscriptions for zero-amount prices directly. With the `comped` flag
removed, the default state was for it to be falsy in the Admin, and when
saved would trigger the legacy comped flow, cancelling the subscription.

This reverts commit 57a176ff3d.
2021-06-07 11:16:32 +01:00
Hannah Wolfe
724db487a0
Swapped _.escape for proxy.escapeExpression
- we don't need to use _.escape from lodash as we already have escapeExpression from handlebars
- it's more correct to use the escape utility from our theme engine when escaping strings _for_ our theme engine!
- Note there is a minor difference between the two:
  - Lodash: &, <, >, " and '
    - refs: https://lodash.com/docs/4.17.15#escape
  - Handlebars: &, <, >, ", ', ` and =
    - refs: https://handlebarsjs.com/api-reference/utilities.html#helper-utilities

- This could cause slightly weird behaviour in themes around ` and = characters, but as it's just convering to html entities it should be fine
2021-06-04 20:07:44 +01:00
Rishabh
c7cf9855fe Updated Portal to handle multiple products
refs https://github.com/TryGhost/Team/issues/718

This bumps Portal to `~1.5.1` which handles changes for multiple tiers/products -

- Handles updated `portal_plans` setting to use monthly/yearly again
- Handles list of available prices to use prices across multiple products
2021-06-04 19:25:39 +05:30
Rishabh
4e01fe9d09 Updated price/products data for portal settings
refs https://github.com/TryGhost/Team/issues/718

The ids for default prices for a product is now stored directly on product model instead of on global settings. This change updates
- the products data sent to Portal to use list of products with their active monthly/yearly prices, as well as
- the prices data sent to Portal to use the prices of default(first) product
2021-06-04 13:03:33 +05:30
Rishabh
ea9a83d444 Fixed product API removing included data
no refs

The product output serializer is removing the include data due to the includes being missing in frame options for some reason. This is a temporary fix that always allows the default includes as `monthly/yearly_price` to unblock the API, and we can revert it back to explicit request once fixed.
2021-06-04 12:28:56 +05:30
Fabien O'Carroll
3adeab142d Added Product data to theme middleware
refs https://github.com/TryGhost/Team/issues/708

- Defaults to an empty array on `@products` so we have valid data
   (product should be null if products isn't)
- This is the first step toward supporting multiple products at the
  theme level
2021-06-03 18:40:18 +01:00
Fabien 'egg' O'Carroll
2a81d0a986
🐛 Fixed saving Members with Complimentary plans (#13008)
* 🐛 Fixed saving Members with Complimentary plans

refs https://github.com/TryGhost/Team/issues/758

Since 4.6 The Admin is using the comped flag again, rather than creating
subscriptions for zero-amount prices directly. With the `comped` flag
removed, the default state was for it to be falsy in the Admin, and when
saved would trigger the legacy comped flow, cancelling the subscription.

This reverts commit 57a176ff3d.
2021-06-03 18:28:14 +01:00
Fabien O'Carroll
a0df10f1b8 Fixed Products API removing included data
no-issue

The include data is stored under original.options rather than original.
2021-06-03 18:04:57 +01:00
Fabien O'Carroll
83a9a1d0a5 Supported monthly & yearly price in Products API
refs https://github.com/TryGhost/Team/issues/712

- Adds a Content API for products, which can be used by the theme-engine
  middleware to populate the products data.
- Removes Stripe ids from Content API so they cannot be used to
  initiate checkout sessions directly
- The monthly_price and yearly_price are used to create new prices, and
  to set them to the default monthly & yearly price for the product.
2021-06-03 17:08:02 +01:00
Naz
7d05da6185 Removed update check service in favor of external package
refs https://github.com/TryGhost/Team/issues/728

- The code of update check has been extracted into it's own package as a part of TryGhost/Core monorepo. This commit is a cleanup of the leftover files
2021-06-03 13:24:19 +04:00
Naz
a7dec233ba Fixed error being saved in notification settings
refs https://github.com/TryGhost/Team/issues/754

- This is fixing the root cause of an error being saved in `settings` table under `notifications` key. There needs to be a follow up to this fixing any possible instances that might have been affected byt the bug
2021-06-03 12:54:09 +04:00
Daniel Lockyer
4edb8f40d6
Fixed config variable in UpdateCheck
refs 2e7d0a4e26

- the referenced commit pushed some refactors to the service but
  `this.config` should have just been `config`
- Ghost was 500ing so this commit fixes the incorrect variable
2021-06-02 14:29:11 +01:00
Naz
666baf8d50 Removed GhostMailer parameter from UpdateCheckService
refs https://github.com/TryGhost/Team/issues/728

- This is continuation of the previous commit. TLDR: Passing only the necessary parameter data makes it easier to reason about what dependencies the UpdateCheckService has to deal with
- Instead of passing in a whole GhostMailer instance passing only an email sending function, which again - makes things way more manageable to reason about
- The end of refactor, next will be a move of the UpdateCheckService into a separate module in tryghost/core
2021-06-02 15:18:32 +04:00
Naz
42efa043d8 Removed ghostVersion parameter from UpdateCheckService
refs https://github.com/TryGhost/Team/issues/728

- This is continuation of the previous commit. TLDR: Passing only the necessary parameter data makes it easier to reason about what dependencies the UpdateCheckService has to deal with
- Burned ghostVersion module passing in vafor of just one additional config parameter. Now the module along with unit tests can be easily extracted out of the codebase!
2021-06-02 15:08:26 +04:00
Naz
759f6ed3ba Removed urlFor parameter from UpdateCheckService
refs https://github.com/TryGhost/Team/issues/728

- This is continuation of the previous commit. TLDR: Passing only the necessary API endpoint function makes it easier to reason about what dependencies the UpdateCheckService has to deal with
- Substituted a parameter with already existing 'siteUrl' config value. No need to duplicate work!
2021-06-02 14:37:29 +04:00
Naz
bd51dd09db Limited the API surface of the UpdateCheckService
refs https://github.com/TryGhost/Team/issues/728

- This is continuation of the previous commit. TLDR: Passing only the necessary API endpoint function makes it easier to reason about what dependencies the UpdateCheckService has to deal with
- Limited urlUtils to only one function as that's all the UpdateCheck uses. Next step will be removing the function completely as and passing a 'blogURL' as a config value (way better readability this way)
2021-06-02 14:31:07 +04:00
Naz
2e7d0a4e26 Limited the API surface of the UpdateCheckService
refs https://github.com/TryGhost/Team/issues/728

- This is continuation of the previous commit. TLDR: Passing only the necessary API endpoint function makes it easier to reason about what dependencies the UpdateCheckService has to deal with
- There are 8 different configs that NotificationService depends upon it will need some further investigation around which ones are even needed anymore and the naming is not the best. To keep the time cap at bay leaving it at what it is.
2021-06-02 14:08:29 +04:00
Naz
bdab32d30a Limited the API surface of the UpdateCheckService
refs https://github.com/TryGhost/Team/issues/728

- Passing only the necessary API endpoint function makes it easier to reason about what dependencies the UpdateCheckService has to deal with
- The instance initialization had to be moved insided the module's exports to resolve "models" module initialization failure
2021-06-02 14:08:29 +04:00
Kevin Ansfield
0fdfcd5002 Removed unused fields relationship function on Post model
refs https://github.com/TryGhost/Ghost/issues/12565

- missed when cleaning up unused app related database fields
2021-06-02 10:09:30 +01:00
Kevin Ansfield
a87410ef28 🐛 Fixed logs showing an error when sending an email with no feature image
no issue

- we were attempting to read an image file to determine it's dimensions when no feature image was set. This wasn't a fatal error as it was handled gracefully and had no ill consequences but it was adding confusing errors to the logs
2021-06-01 17:07:33 +01:00
Naz
a78e034643 Added update check notificaitons test coverage
refs https://github.com/TryGhost/Team/issues/728

- This is a continuation of the test coverage for the UpdateCheckService.
- Covers scpecial cases of notification processing within Update Check
- The refactor inside the update check service was a convenience to get rid or the Bluebird dependency completely. Also, some minor preventative code added to avoid errors from referencing undefined objects
2021-06-01 17:35:10 +04:00
Naz
3173603d96 Updated UpdateCheckService methods to async/await
refs https://github.com/TryGhost/Team/issues/728

- In additions to easier tracking of "this" context in the unit tests it gets rid of unnecessary Bluebird's "reflect" method which was making unit test dependent on Bluebird's specific Promise implementation
2021-06-01 17:35:10 +04:00
Naz
d5e6dbb0fb Extraced update check code into a separate service
refs https://github.com/TryGhost/Team/issues/728

- This is a first step before moving update check code into an outside codebase.
- The aim is to have a self-contained module which could be unit tested and have a very clear API
2021-06-01 17:35:10 +04:00
Fabien 'egg' O'Carroll
52a97957e1
Added monthly & yearly price relation to Product
refs https://github.com/TryGhost/Team/issues/710

This allows us to fetch the default monthly and yearly price models for
a product model, which is important since we no longer want to expose
the entire list of prices, but just the designated monthly & yearly prices.
2021-06-01 11:00:28 +01:00
Fabien 'egg' O'Carroll
bdd7c0f821
Added {monthly,yearly}_price columns to products
refs https://github.com/TryGhost/Team/issues/710
refs https://github.com/TryGhost/Team/issues/725

Products will now have a single monthly and yearly price which will be
used throughout Themes, Portal & Admin. These columns will be used to
track the current prices for each of them, and will update anytime we
change the pricing of a product.

Due to a circular table dependency we have not added a foreign key
constraint to the new columns, this will be handled at a later date. It
is tracked in issue 725 references above
2021-06-01 09:38:15 +01:00
Thibaut Patel
0f2c586659 Revert "Upgraded the update-check api to v4"
commit 414938cfc7

- This reverts commit 414938cfc7.
- The tests fails so I'll wait for Naz to finish the ongoing update-check tests refactoring before upgrading the api version again
2021-05-31 21:50:17 +02:00
Thibaut Patel
414938cfc7 Upgraded the update-check api to v3
issue https://github.com/TryGhost/Team/issues/727
2021-05-31 19:44:15 +02:00
Daniel Lockyer
b98e0b0bbb v4.6.4
-----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQTqYa7kNs8D7Oo9dgLSEYbwtHKVrQUCYK/iogAKCRDSEYbwtHKV
 rcgCAP9qagl5CtrgE1mLx7fs+W+yy+UOslBqhR/o49aOQMTEbAD/ajcR5w2qv/mW
 GRK0qr9boWPcQm6YpiuEQ9j4SYMoCQU=
 =p+5B
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQTqYa7kNs8D7Oo9dgLSEYbwtHKVrQUCYK/jPgAKCRDSEYbwtHKV
 rcEgAQDh43UkCDj/rg3jxMeItspMXwnwrg+ZpscgoeCdm4nFKAD/UtsJCrma4+j8
 if2jOddYUy4xAAPUMwhpwsRJVMkWbgY=
 =gtbT
 -----END PGP SIGNATURE-----

Merged v4.6.4 into main

v4.6.4
2021-05-27 19:21:44 +01:00
Daniel Lockyer
c317d39e33
Updated Ghost-Admin to v4.6.4 2021-05-27 19:19:14 +01:00
Rishabh Garg
83c0cbb516
🐛 Fixed missing stripe connected check on boot (#12992)
refs https://github.com/TryGhost/Team/issues/598
refs https://github.com/TryGhost/Ghost/commit/5cdf910e

As part of the changes to disallow sites with starting up without https when they are connected to stripe, the conditional missed the check for stripe connection. As a result we were erroring in boot sequence for all sites starting without https irrespective if they are connected to Stripe or not which is incorrect. This fixes the `init` check for members service to only error for non-https sites if they are connected to Stripe.
2021-05-27 23:03:03 +05:30
Daniel Lockyer
46eba3c53b v4.6.3
-----BEGIN PGP SIGNATURE-----
 
 iHQEABYIAB0WIQTqYa7kNs8D7Oo9dgLSEYbwtHKVrQUCYK/IAAAKCRDSEYbwtHKV
 rcOAAPYkPbDj5/tsTY5CLyrG0q0LkfFrVQgxVAkbWvIH/XXhAP4teJ+SP82LjTB9
 CWHwJW/eNqHrdaEJ6rs0kKTVnHPIDA==
 =hVsO
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQTqYa7kNs8D7Oo9dgLSEYbwtHKVrQUCYK/IjgAKCRDSEYbwtHKV
 rflnAQDsNIDOoTk6BZbUQg6lMwy26gmfBpgSq6G9iW0LRk+wTgEAon7vRajj6M+d
 FAEebE2qLPw8TtKxWculo+RKip3+nwk=
 =iiXt
 -----END PGP SIGNATURE-----

Merged v4.6.3 into main

v4.6.3
2021-05-27 17:27:50 +01:00
Daniel Lockyer
f4d8e818e3
Updated Ghost-Admin to v4.6.3 2021-05-27 17:25:35 +01:00
Thibaut Patel
a17403ab6a Move the update-check service to a scheduled job
issue https://github.com/TryGhost/Team/issues/729
2021-05-27 17:17:26 +02:00
Rishabh
3cf0ad41bf Updated preview post message handling in Portal
no refs

As part of new membership settings in Admin, we need to resize the Portal preview container to dynamically adjust to selected preview options. Portal is updated to handle and fire resize events for Admin on popup container changes so the preview can be adjusted correctly.

- Bumps minimal Portal version to ~1.4.6
2021-05-27 17:56:26 +05:30
Naz
df4df2a4aa Added admin email for UpdateChecker's alerts
refs https://github.com/TryGhost/Team/issues/726

- When UpdateCheck service sends a notification with "type: 'alert'" an email goes out to admin users with the "message" content of the notification.
- This functionality is aimed to handling critical messages like urgent instance updates
- Next step will be getting as much of the update check code extracted into a "service" and then moved out of Ghost's codebase
2021-05-27 13:12:28 +04:00
Naz
a1556797b6 Refactored GhostMailer's send to current code standards
no issue

- While working on https://github.com/TryGhost/Team/issues/726 have questioned some of the options that were passed along to the `send` method. Documented findings and refactored the code slightly while touching it
2021-05-27 12:37:03 +04:00
Naz
3ca7b74987 Refactored update check to use async/await syntax
refs https://github.com/TryGhost/Team/issues/726

- These are minimal changes that I've done while reviewing the code inside the update-check module. There's more to come, only picked up the low-hanging fruit!
2021-05-27 12:37:03 +04:00
Daniel Lockyer
0bb3922eef
Updated Ghost-Admin to v4.6.2 2021-05-27 08:17:23 +01:00
Rishabh Garg
36803a4290
🐛 Fixed incorrect @price.currency value in themes (#12987)
closes https://github.com/TryGhost/Ghost/issues/12986
refs 1345268089

As part of changes in 4.6, the default price ids for monthly/yearly prices are stored in new settings - `members_monthly_price_id`, `members_yearly_price_id` - which are used to determine current active prices for the site from list of all existing prices. While the last commit updated the prices to use the settings, the data for currency was still used from non-zero prices instead of the new settings value.

- Updated tests to check price currency
2021-05-27 10:49:35 +05:30
Daniel Lockyer
7a20758ef6
Updated Ghost-Admin to v4.6.1 2021-05-26 18:46:08 +01:00
Rishabh Garg
1345268089
🐛 Fixed incorrect price data in themes (#12985)
closes https://github.com/TryGhost/Ghost/issues/12980
closes https://github.com/TryGhost/Team/issues/730

As part of changes in 4.6, the default price ids for monthly/yearly prices are stored in new settings - `members_monthly_price_id`, `members_yearly_price_id` - which are used to determine current active prices for the site from list of all existing prices. The `@price` helper was incorrectly still relying on the old logic for active monthly/yearly price using the first active price with matching nickname, and resulted in showing incorrect price data on the theme.

- Updated tests to check price data using settings value
2021-05-26 22:58:26 +05:30
Kevin Ansfield
5fe9036ecf Added sentry_dsn and sentry_env properties to /canary/site/
refs https://github.com/TryGhost/Team/issues/723

- enables Admin to report unhandled exceptions and API errors when configured
2021-05-26 16:54:04 +01:00
Rishabh Garg
367b1a509f 🐛 Fixed members list not loading (#12930)
refs https://github.com/TryGhost/Team/issues/660

In case stripe price for a subscription is missing in `stripe_prices` table, it will cause the API to load members list to fail with 500 as we try to serialize the stripe price on member subscription using empty object. This fixes the guard against populating price object for missing data in DB.

Note: This is only a short-term fix till we add a proper fix to cleanup the DB in the subsequent release.
2021-05-26 19:52:42 +05:30
Naz
1b26692430 Refactored update check to use async/await syntax
refs https://github.com/TryGhost/Team/issues/726

- These are minimal changes that I've done while reviewing the code inside the update-check module. There's more to come, only picked up the low-hanging fruit!
2021-05-26 16:06:06 +04:00
Naz
88564751f9 Removed duplicate update check error hanlindg
refs https://github.com/TryGhost/Team/issues/726

- Update check service is self contained and handles errors through logging internally. There is no visible upside to do the same logging in multiple places
2021-05-26 15:52:24 +04:00
Kevin Ansfield
3b366dc55d
Fixed max-api-complexity linting warnings for site and config APIs (#12982)
no issue

- moved `config` and `site` API output generation to a `public-config` service allowing all API versions to use `publicConfig.config` or `publicConfig.site` in their query methods
- updated `config` and `site` API output serializers to use an allow-list that limits the data returned for each API version
2021-05-26 12:10:19 +01:00
Naz
d67ee68b0d Fixed initialization logic in post scheduler
refs e370d33378

- The initialization logic was simplified and not refactored in all placed during the refed change
2021-05-26 10:44:11 +04:00
Kevin Ansfield
c2793eedd3 Fixed no-restricted-require warning for core/shared/url-utils.js
no issue

Our server-defined `mobiledoc` object was required by `UrlUtils.cardTransformers` property to help set up a shortcut for url transform functions but that was breaking the independence of `UrlUtils` by crossing the shared/server boundary.

- `cardTransformers` is only needed for the `mobiledocToTransformReady` utility function that will only be used by the server
- removed `UrlUtils.cardTransformers` (and associated require) from our `UrlUtils` instance and updated the few areas the server uses `mobiledocToTransformReady()` to pass in the mobiledoc card objects directly as an option
2021-05-25 21:13:57 +01:00
Naz
e370d33378 Refactored scheduling index files into class/initializer pattern
refs https://github.com/TryGhost/Team/issues/694

- This refactor is not ideal but moves us closer to the desired form of class with injectable (and testable) parameters. Allowed to refactor the test slightly so at least we can check if schedulerd  subscribed events work and if they trigger the adapter with correct data
- Ideally the api/model calls shoudl be abstracted away as well, but that's for another time
- Also got rid of completely pointless "adapters/scheduling" unit test. All it was checking was if the "init" method was called int the passe in object
2021-05-25 22:32:41 +04:00
Daniel Lockyer
c38c0d1a93
Updated Ghost-Admin to v4.6.0 2021-05-25 15:11:56 +01:00
Naz
1ec44431b1 Simplified scheduling-auth-token module's interface
refs https://github.com/TryGhost/Team/issues/694

- Only passing necessary data into the module simplifies it's interface and allows to decouple it further from model layer dependencies
- Note, also verified and corrected the return type of the auth token creating method
2021-05-24 17:34:36 +04:00
Naz
90e5af12ae Refactored post scheduler to use async/await syntax
refs https://github.com/TryGhost/Team/issues/694

- This should allow to reason about what's happening inside the module a little easier
2021-05-24 17:34:36 +04:00
Naz
00f6c76d1f Extracted scheduling integration fetching into separate module
refs https://github.com/TryGhost/Team/issues/694

- This is a tiny step towards more decoupled scheduler's code organization
- Similar to previous commit, it's just code extraction
- Next steps will be injecting these modules as "init"  function depencency" so we can test scheduling behavior in isolation
2021-05-24 17:34:36 +04:00
Naz
33696b8244 Extracted scheduling token generation into separate module
refs https://github.com/TryGhost/Team/issues/694

- This is a tiny step towards more decoupled scheduler's code organization
2021-05-24 17:34:36 +04:00
Fabien O'Carroll
f4c40249ce Fixed members auth middleware
no-issue

The JWT library we used does not throw an error which can be used by
Ghost. So we need to catch and wrap it in our own errors from
@tryghost/errors.
2021-05-24 11:28:15 +01:00
Fabien O'Carroll
730811fb6e Handled week & day interval in population of mrr events
refs https://github.com/TryGhost/Team/issues/635

This is to ensure we don't break migrations for any sites which have
imported external subscriptions which have an interval of 'week' or
'day'

The bump to members-api includes the handling of these intervals for
ongoing population of mrr events
2021-05-21 17:57:17 +01:00
Naz
459e8215b9 Split data exporter's index file into separate module
refs https://github.com/TryGhost/Team/issues/610

- This is a next step removing bloat from export module's index.js file, which get's rid of eslisn error completely
2021-05-21 19:13:55 +04:00