Commit Graph

31744 Commits

Author SHA1 Message Date
Daniel Lockyer
876100e80b
Disabled code coverage check on @tryghost/data-generator
- this package is not used as part of Ghost's code and we shouldn't be
  enforcing a minimum coverage on it whilst it's in development
2022-11-02 15:45:12 +07:00
e.baidakova
93c6abcad5 Add ability to pass stale-while-revalidate option to cache control
closes TryGhost/Team#2094
This value can be used for non-crucial data with a `public` option. For example: `public, max-age=1, stale-while-revalidate=9`.
The idea behind this option is that the browser would cache the value for the number of seconds in `max-age` and would use it for the number of seconds in `stale-while-revalidate` until it gets a "validated response" from the server. The behaviour should be almost unnoticeable for the end user but would make a big difference in the amount of requests to server.
2022-11-02 10:54:12 +04:00
e.baidakova
81e6a7c5bd 🐛 Add ability to cache comments count endpoint
closes TryGhost/Team#2094
- Comment counts request was changed from `post` to `get` to enable request caching.
2022-11-02 10:54:12 +04:00
Naz
26b0bbc623 Added a test suite for OPTIONS requests
refs https://github.com/TryGhost/Toolbox/issues/461

- The codebase has ambiguous behavior with OPTIONS request. Adding tests covering edge cases for all possible variations of OPTIONS responses is the first step to solving cahceability of these requests.
- The obvious question if you look into the changeset itself would also be: "WTF did you do with test suite naming? What are these changes in admin and click tracking suites? You having a bad day Naz?". The answer is "yes"  (╯°□°)╯︵ ┻━┻
- On a serious note. I've introduced multiple hacks here that should be fixed:
1. Forced test suite execution order for options request - extreme blasphemy. This was last resort decision. I went deep into trying to fixup the server shutdown in the "admin" test suite, which cascaded into failing "click tracking" suite, which has shortcomings on it's own (see notes left in that suite)
2. Exposed "ghostServer" from the e2e-framework's "getAgentsWithFrontend" method. Exposing ghostServer to be able to shut it down (or do other manipulations) was one of the pitfalls we had in the previous test utils, which ended up plaguing the test codebase. Ideally the framework should only be exposing the agents and the rest would happen behind the scenes.
- To fix the hacks above I've raised a cleanup issue (https://github.com/TryGhost/Toolbox/issues/471). I'm very sorry for this mess. The issue at hand has very little to do with fixing the e2e framework, so leaving things "as is".
2022-11-02 13:43:30 +08:00
Naz
5fe80c82c5 Exposed Content API agent in e2e test utils
refs https://github.com/TryGhost/Toolbox/issues/461

- When testing OPTIONS requests there is a need to get all possible agents available in the system. The "getAgentsWithFrontend" serves exactly this purpose - create all possible agents while starting Ghost instance only once
- This is groundwork for OPTIONS request caching tests and improvements
2022-11-02 13:43:30 +08:00
Daniel Lockyer
ab678c3a90
Merged v5.22.4 into main
v5.22.4
2022-11-02 07:09:23 +07:00
Djordje Vlaisavljevic
2cd106ba02 Fixed scrollable table data showing outside of table
no ref
2022-11-01 22:45:30 +01:00
Ghost CI
13c6204197 v5.22.4 2022-11-01 19:19:31 +00:00
Fabien 'egg' O'Carroll
1ff1b75a69
🐛 Fixed errors with Stripe Checkout (#15749)
refs https://github.com/TryGhost/Ghost/commit/1f300fb781f0

The full customer object was not being passed to the StripeAPI service
when it already exists, this was resulting in inconsistent behaviour when
sending the customerEmail param to the API, causing `invalid_email`
errors to be thrown from Stripe and breaking the checkout.
2022-11-02 02:18:30 +07:00
Fabien "egg" O'Carroll
be66078a31 Released Portal v2.19.5 2022-11-02 00:32:35 +07:00
Hannah Wolfe
85c5a19f33
Merged v5.22.3 into main
v5.22.3
2022-11-01 17:29:16 +00:00
Ghost CI
7fda360799 v5.22.3 2022-11-01 17:12:38 +00:00
Fabien "egg" O'Carroll
743228ff1c 🐛 Fixed Portal showing paid Tiers when Stripe not connected
closes https://github.com/TryGhost/Team/issues/2197

Portal was relying on monthlyPrice or yearlyPrice being undefined as a
proxy to determine whether or not to show paid plans, this fixes it to
check for whether or not stripe is enabled.

I did consider using the portal_plans array to filter out unselected
Tiers, but wasn't sure of the repercussions, though it does seem like
the correct fix long term.
2022-11-02 00:11:33 +07:00
Fabien "egg" O'Carroll
ba41f308c7 🐛 Fixed upgrading to a paid plan
closes https://github.com/TryGhost/Team/issues/2196

We were incorrectly assuming that all requests would have the
`customerEmail` passed in the body. Instead we were incorrectly
passing `undefined` or `''` as the `customerEmail` property to stripe,
which resulted in a validation error.

We've updated the code to pass `null` in the case of a falsy value,
which the Stripe API handles without error.
2022-11-02 00:11:33 +07:00
Fabien "egg" O'Carroll
1f300fb781 🐛 Fixed checkout sessions when using Offers
closes https://github.com/TryGhost/Team/issues/2195

The issue here is two-fold, and specific to using Offers so was not
caught by any automated tests. First, we were incorrectly comparing
the tier.id to the offer.tier.id - this is because the Tier objects id
property is an instance of ObjectID rather than a string.

Secondly we were passing through the cadence parameter from the
request body, but when using Offers this is not including in the
request, so we must pull the data off of the Offer object instead and
pass that to the payments service.
2022-11-02 00:11:33 +07:00
Kevin Ansfield
2d2ac0102a Refactored signin controller to Octane patterns
refs https://github.com/TryGhost/Ghost/issues/14101

- migrated to native class syntax and glimmer component patterns
- removed use of jQuery, the workaround to trigger change events no longer appears necessary
2022-11-01 14:12:23 +00:00
Daniel Lockyer
498bec08cf
Merged v5.22.2 into main
v5.22.2
2022-11-01 18:24:58 +07:00
Ghost CI
3c71d07dfb v5.22.2 2022-11-01 09:28:14 +00:00
Fabien 'egg' O'Carroll
a0ebb9a6f3
🐛 Fixed Tier description not being set (#15741)
closes https://github.com/TryGhost/Ghost/issues/15740

The validation function for a Tier description was not returning the
validated value, which meant we were unable to set the Tier
description.
2022-11-01 16:25:55 +07:00
Fabien "egg" O'Carroll
f761bd36b4
Fixed verification trigger usage of Event Repository
refs https://github.com/TryGhost/Team/issues/2192

The method signatures of the Event Repository have been updated to
take mongo filter objects, but this call-site was not updated.

Long term we should really be using NQL filter strings for our
filtering API and the mongo filter objects should be an implementation
detail, however we don't have time right now to rectify this.
2022-11-01 13:00:42 +07:00
Fabien "egg" O'Carroll
63fe013606 Fixed verification trigger usage of Event Repository
refs https://github.com/TryGhost/Team/issues/2192

The method signatures of the Event Repository have been updated to
take mongo filter objects, but this call-site was not updated.

Long term we should really be using NQL filter strings for our
filtering API and the mongo filter objects should be an implementation
detail, however we don't have time right now to rectify this.
2022-11-01 12:06:11 +07:00
Daniel Lockyer
68689917e6
Merged v5.22.1 into main
v5.22.1
2022-11-01 06:11:24 +07:00
Robin Cussol
e7e12aba09
Added e2e tests for page.published.edited webhook (#15724)
refs: https://github.com/TryGhost/Ghost/issues/15537

- snapshot test created to add confidence to webhook stability and increase overall test coverage.
2022-10-31 19:51:04 +00:00
Halldor Thorhallsson
79c80f28cc
Removed bluebird from api-framework module (#15685)
refs: https://github.com/TryGhost/Ghost/issues/14882

- Removing bluebird specific methods in favour of the Ghost sequence method so we can remove the bluebird dependency
2022-10-31 19:30:18 +00:00
Ghost CI
b2ad52fbf5 v5.22.1 2022-10-31 17:49:43 +00:00
renovate[bot]
8cde26f986 Update dependency ember-template-lint to v4.17.0 2022-10-31 17:37:40 +00:00
James Morris
8537239548 Moved the audience feedback setting into the footer
refs https://github.com/TryGhost/Team/issues/2191
2022-10-31 17:17:52 +00:00
Kevin Ansfield
b272b34a44 Fixed linter error 2022-10-31 12:12:58 +00:00
James Morris
21bf020e4e Moved the audience feedback setting into the footer
refs https://github.com/TryGhost/Team/issues/2191
2022-10-31 12:10:36 +00:00
Kevin Ansfield
5bf3fe9cb8 🐛 Fixed error preventing admin area being usable by staff users with Contributor role
closes https://github.com/TryGhost/Team/issues/2190

- added a guard around the tier fetches in `membersUtils` service so the fetch doesn't occur unless we have a logged in user and they aren't a contributor
- extracted the `withPermissionsCheck` mirage util function and added role checks around the mocked tiers endpoints
- added an acceptance test that loads the content screen and creates a draft post as a contributor to help catch regressions
2022-10-31 12:01:39 +00:00
Daniel Lockyer
92740e8967
Merged v5.22.0 into main
v5.22.0
2022-10-31 17:49:27 +07:00
Ghost CI
44722efe38 v5.22.0 2022-10-31 10:41:31 +00:00
Fabien "egg" O'Carroll
f878e84707 Fixed Tiers importer not correctly mapping price data
refs https://github.com/TryGhost/Toolbox/issues/464

Bceause the import does not use the API, any backwards compat code we put in the
API does not get run for imports, this means we need to update the importer to
map the stripe_prices data onto the products table so that we have valid data in
the database.
2022-10-31 17:30:16 +07:00
Daniel Lockyer
d59909941c Backfilled missing columns in products table
refs https://github.com/TryGhost/Toolbox/issues/464

- due to a bug with the content importer, importing a JSON file where
  the `products` do not contain price info will store null values in the
  table instead of the defaults
- this ends up causing further issues because we're not populating the
  table for paid products
- this commit is a copy of the 5.19 migration
  `2022-09-02-20-52-backfill-new-product-columns.js`, but adds a check
  for a null `t.currency`, which combined with the `t.type === paid`,
  should identify the rows we want to update
2022-10-31 16:36:57 +07:00
Naz
49e97829d0
Added auto-mapping for complimentary_plan column
closes https://github.com/TryGhost/Team/issues/1076
refs f068e40723
refs 7fe9e06c4d

- The Members CSV importer was not auto-detecting and mapping the `complimentary_plan` column when it was present in CSV. This was to improve user-experience and NOT start the import as a "background job" by default.
- With resent (see refs) changes having "complimentary_plan" column in the imported file does not send the import into the background. We can now safely include it as auto-detected field, without compromising user experience.
2022-10-31 16:47:14 +08:00
Naz
7fe9e06c4d
Fixed rule for import background job detection
refs https://github.com/TryGhost/Team/issues/1076

- The members CSV import would go into background job (longer running and resulting with an email) when it contained a complimentary_plan column.
- With recent members codebase decoupling Ghost does not make any connection to Stripe as "complimentary plan" data is saved purely in native data structures. Making no need for a background job for complimentary plans
2022-10-31 16:31:55 +08:00
Naz
4d26c50e0b
Fixed data type of hasStripeData in member importer
refs https://github.com/TryGhost/Team/issues/1076

- What appeared to be a "boolean" by nature and name, the hasStripeData was holding a result of "find" method - and object or an undefined value
- Fixed the typing, to avoid ambiguity in the future
2022-10-31 16:31:35 +08:00
renovate[bot]
ac01fc5e42 Update dependency @babel/plugin-proposal-decorators to v7.20.0 2022-10-31 10:38:05 +07:00
renovate[bot]
5d49ce269a Update dependency cssnano to v5.1.14 2022-10-31 09:50:23 +07:00
Hannah Wolfe
25d5839e96
Added shouldCompileToError test util
refs: a8b1676734

- Extended the newly created handlebars test utils with a shouldCompileToError method
- Updated the price helper tests tp use shouldCompileToExpected and shouldCompileToError
- This allows us to test our handlebars helpers in a much more conisstent way
2022-10-30 16:55:53 +00:00
Barno
a24eb06179
Replaced Promise.map() with .all() in importer (#15616)
refs: https://github.com/TryGhost/Ghost/issues/14882

- Removing bluebird specific methods in favour of the Ghost sequence method so we can remove the bluebird dependency

Co-authored-by: Carol-Barno <cbarno@innovexsolutions.co.ke>
2022-10-30 16:51:29 +00:00
leonyangela
7df2b7625f
Added e2e tests for page.tag.attached webhook (#15648)
refs: https://github.com/TryGhost/Ghost/issues/15537

- snapshot test created to add confidence to webhook stability and increase overall test coverage.
2022-10-30 16:45:51 +00:00
Barno
3f0713fbc4
Replaced Promise.each() with .all() in models/relations/author (#15614)
refs: https://github.com/TryGhost/Ghost/issues/14882

- Removing bluebird specific methods in favour of the Ghost sequence method so we can remove the bluebird dependency

Co-authored-by: Carol-Barno <cbarno@innovexsolutions.co.ke>
2022-10-30 16:06:01 +00:00
Hannah Wolfe
a8b1676734
Refactored shouldCompileToExpected into shared util
no issue

- There are currently two patterns in our handlebars helper unit tests:
  1. Treating the helper as a function, and doing a function call
   - This is the original way the tests were done, and they're not great as they're approximating how the helpers are really used
  2. Using a template string, and rendering the string using a method called shouldCompileToExpected
   - These tests are more realistic and powerful and also easier to read

- The new method is only being used in a few places so far, and each place had re-created the `shouldCompileToExpected` method
- Therefore I've moved this method into a util that should make it easier to write unit tests for handlebars helpers
- I also renamed the method in the excerpt tests, because it doesn't do the same thing, it's just a wrapper around a function call rather than compiling a string

The aim is to refactor all of our handlebars helper tests to use `shouldCompileToExpected`
2022-10-30 15:26:29 +00:00
Halldor Thorhallsson
5a94cc8039
Removed bluebird from misc packages (#15676)
refs: https://github.com/TryGhost/Ghost/issues/14882

- Removed bluebird from members-csv package-json and update-check-service 
- Removing bluebird specific methods in favour of the Ghost sequence method so we can remove the bluebird dependency
2022-10-30 15:16:10 +00:00
Vedant Bhamare
3f289edc26
Added e2e tests for page.tag.detached webhook (#15651)
refs: https://github.com/TryGhost/Ghost/issues/15537

- snapshot test created to add confidence to webhook stability and increase overall test coverage.
2022-10-30 14:59:12 +00:00
Hannah Wolfe
5fe6687c2a
Skipped slow activity feed tests temporarily
- These tests are very slow, and make the build fail about 2/3 times
- Temporarily skipping until we can fix, as I want to get all our outstanding hacktoberfest PRs merged
2022-10-30 14:52:30 +00:00
Hannah Wolfe
3ec0057567
Removed accidentally committed file
- This was accidentally included in a fixup commit
2022-10-30 14:38:59 +00:00
Arjuna Kristophe Sankar
096dffb817
🐛 Fixed missing active theme breaks design screen (#15602)
closes: https://github.com/TryGhost/Ghost/issues/15505

When starting Ghost with a missing active theme, the design settings screen and change theme screen both end up in a broken state with the user unable to select a new theme as the active one.

The design screen has no default (or blank) slate, and so shows a preview of an empty theme.
- First added a new default screen to serve as a placeholder for when the state contains no active theme.
- Added a check for when there was no active theme, then redirects the user to the default screen .

The change theme screen wants to set an active property on the theme that should be active in the theme list.
- Added a check to see whether there is an active theme set.
- If there isn't one, don't bother trying to add the active property.
2022-10-30 14:14:11 +00:00
Ghost CI
7724d29afd v5.21.0 2022-10-28 16:00:39 +01:00