refs https://github.com/TryGhost/Toolbox/issues/363
- this API framework is standalone and should be pulled out into a
separate package so we can define its boundaries more clearly, and
promote better testing of smaller parts
- these requires go outside of the shared folder, and then back in to
the index.js
- this is confusing and won't work when we pull this code out of core
- this commit cleans up the requires to make them more explicit
refs https://github.com/TryGhost/Toolbox/issues/363
- AFAICT, this is an outdated and unused concept from when subscribers
were a thing, but members are now how we do things, and this is causing code
to linger around that we don't need
refs https://github.com/TryGhost/Toolbox/issues/363
- this middleware is standalone and I suspect we're going to be touching
it further when we work on Ghost's caching in the near future
- the tests here were no longer relevant because they were more testing
things that have been moved to `mailgun-client`
- this commit cleans up the tests to ensure we're passing the correct
parameters to the mailgun client package
- also adds jsdoc on all the functions and maintains 100% code coverage
- this is the current functionality of the code, as it has always been,
but this test ensures we prioritise the values in the config over
those in settings
- even though we don't do anything yet, the code was calling `.length`
on an object, which is `undefined`
- this fixes that by checking the length of the keys
- also moves the code block down so we can early-return if mailgun is
not configured
refs https://github.com/TryGhost/Team/issues/1726
Free trial offers don't have a Stripe coupon created for them, as the trial is directly added to checkout session. So for mapping a subscription to offer, we pass the offer id directly from checkout metadata to link the subscription in backend with right offer data. This also handles the case where the offer id against a subscription can get overwritten for a subsequent subscription event, as the sub event from Stripe doesn't has the trial offer info.
- handles storing an offer id for a subscription
- updates member detail in Admin to show the offer info for a subscription
refs https://github.com/TryGhost/Team/issues/1726
- free trial offers don't need a stripe coupon created for them
- checkout sessions for free trial offers ignore stripe coupon and directly pass the trial days value
- trial days of an offer take precedence over trial days added as default to a tier
refs https://github.com/TryGhost/Team/issues/1726
- updates offer setup to allow new `trial` as discount type, was prev only `fixed` and `percent`
- updates offer setup to allow `amount` as free trial days value
- updates offer setup to allow `trial` as discount duration value for trial offers, was prev only `once`/`forever`/`repeating`
refs https://github.com/TryGhost/Team/issues/1726
- updates offer type validation to include `trial`
- add offer duration validation which includes `trial` for free trial offers
refs https://github.com/TryGhost/Toolbox/issues/363
- this copies over tests from `email-analytics-provider-mailgun` that
are more relevant here
- there is now duplication in tests across the two packages but this
will be resolved soon
- A few users had noticed they get weird content in their excerpts when using e.g. an html block with an iframe
- This use case is common for people embedding podcasts at the top of their posts
- this test checks that the mailgun client respects the changes in
settings, which is something that we used to ask
`email-analytics-provider-mailgun` to do when the mailgun client was
made in that package
- since then, we've pulled it out, so we should move the test to the
`mailgun-client` library
refs https://github.com/TryGhost/Toolbox/issues/363
- this commit pulls all code involving the Mailgun client SDK into one
new package called `mailgun-client`
- this means we should be able to replace `mailgun-js` (deprecated) with
`mailgun.js` (the new, official one) without editing code all over the
place
- this also lays some groundwork for better testing of smaller
components
refs https://github.com/TryGhost/Team/issues/1723
- Added count.replies to comments
- Added replies endpoint
- Limited returned replies to 3.
- Replaced likes_count with count.likes in comments
- Instead of fetching all the likes of a comment to determine the total count, we'll now use count.likes
- Instead of fetching all the likes of a comment to determine whether a member liked a comment, we'll now use count.liked (which returns the amount of likes of the current member, being 0 or 1). This is mapped to `liked` to make it more natural to work with.
The `members.test.snap` file changed because we no longer include `liked: false` if we didn't fetch the liked relation. And in the comments events of the activity feed the liked property is therefore removed.
These changes requires an update to the `bookshelf-include-count` plugin:
- Updated to also work for nested relations
- This moves the count queries from the `bookshelf-include-count` plugin to the `countRelations` method of each model.
- Updated to keep the counts after saving a model (crud.edit didn't return the counts before)
- these files are copied into the `ghost/core` folder by monobundle so
they can be included with NPM, but they shouldn't be in git because
they'd just be duplicates of the top-level files
- in order to pack the tarball correctly, we need monobundle to run
beforehand
- up until now, it's the responsibility of the release script to make sure
to run it before `npm pack`
- this commit ensures it gets run, so the generated .tgz file is valid
refs 03cbc89a53
- this util was added to fix an issue with the types of columns in
MySQL, but the issue was back in 2014 (!!)
- we're long past doing it in this way so we'll likely never use it
again