Commit Graph

15666 Commits

Author SHA1 Message Date
Renovate Bot
2c2bb13e2a Update dependency @tryghost/express-test to v0.6.1 2022-03-10 09:23:13 +00:00
Simon Backx
9ad45ee5be
Added tests for creating product benefits without name (#14217)
refs https://github.com/TryGhost/Team/issues/1188

The products API did return a 500 error when you tried to store product benefits with an empty name. This should throw a 422 Validation Error instead. This change includes some tests for this error. The error itself has been solved by updating the bookshelf-relations dependency earlier.

- Added test when creating a new product with an empty benefit name
- Added test when updating an existing product with new benefits, with an empty name
- Added a test that creates a tier with benefits
2022-03-10 10:10:35 +01:00
Naz
16e0736379 Removed Roon related importer code
no issue

- The support for the misformated roon imports was temporary anyway, based on the comments in code. It's also unecessary to keep around any code related to Roon as it's been _ages_ since anybody needed this kind of migration
2022-03-10 16:29:54 +08:00
Renovate Bot
169fa83781
Update dependency probe-image-size to v7.2.3 2022-03-09 20:44:38 +00:00
Renovate Bot
1825f408a5 Update dependency @tryghost/nodemailer to v0.3.14 2022-03-09 20:35:39 +00:00
Daniel Lockyer
9231a4c6f6 Updated probe-image-size options to reflect underlying change
refs https://github.com/nodeca/probe-image-size/blob/master/CHANGELOG.md#changed-1

- version 6 of `probe-image-size` switched from using `request` to
  `needle`
- this means we need to update our options to reflect the changes
- we still use request in this file so I've duplicated the options for now
- also adds a few extra error codes to the catches because needle
  reports different codes to request
2022-03-09 20:27:38 +00:00
Daniel Lockyer
8a7c7f08e9 Enabled fetching .ico dimension size via probe-image-size
refs https://github.com/nodeca/probe-image-size/blob/master/CHANGELOG.md#600---2020-11-04

- `probe-image-size` v6 now supports `.ico` files so we can
  allow probing of dimensions via this library rather than falling back
  to downloading the entire image via `image-size`
- also updates a test because .ico files no longer use the internal
  request lib, which simplifies things a little bit
2022-03-09 20:27:38 +00:00
Renovate Bot
5687fb9213 Update dependency probe-image-size to v7 2022-03-09 20:27:38 +00:00
Hannah Wolfe
833035d7be
Improved coverage of api serializer
- Have ensured we have 100% coverage of core/server/api/shared/serializers/handle.js
- This meant I had to swap around two validation clauses as one was unreachable
- I have done this as I want to make some changes in this area of the codebase, and want to ensure we have tests
  and a clear understanding of what this code does before I change it
2022-03-09 20:02:15 +00:00
Sanne de Vries
3a9f40845a Updated password protection page layout 2022-03-09 14:34:47 +00:00
Hannah Wolfe
e24209a84f
Changed c8 reporter html -> html-spa
- I might be the only person who uses these, but I like to dig into coverage reports so I can see where we've got holes
- In Ghost the reports is huge and unweildy, and it's hard to see what coverage is like for components grouped by folders
- html-spa reporter fixes this, it makes a beautiful nested tree view, but you can also switch to flat
- it's so much more useful for working on coverage in an area of the codebase!
2022-03-09 14:18:34 +00:00
Sanne de Vries
12ab0339c1 Updated password protection page
No issue
2022-03-09 13:35:09 +00:00
Kevin Ansfield
51e04c75ad
Added "contains" operator support to ?filter= query params (#14286)
refs https://github.com/TryGhost/Team/issues/1408

- switched from `@nexes/nql` to `@tryghost/nql` and bumped `@tryghost/bookshelf-plugins` to get access to the latest NQL version across the app
- adds "contains" operator support
  - `:~'string'` - contains
  - `:-~'string'` - does not contain
  - `:~^'string'` - starts with
  - `:-~^'string'` - does not start with
  - `:~$'string'` - ends with
  - `:-~$'string'` - does not end with
- enables `'` escaping in strings, eg `'O\'Nolan'`
2022-03-09 13:02:17 +00:00
Rishabh Garg
9794945549
Updated tests for custom welcome page redirects (#14288)
Welcome pages are now moved as a property of individual tiers instead of global property on settings. Since we removed the alpha flag for new welcome page behavior, tests had to be updated to test the flow against new behavior.
2022-03-09 17:49:25 +05:30
Rishabh
7c105d9669 Bumped new tiers beta features from individual flags
Tiers will soon go to GA, and these small features that were added as part of tiers beta are now ready to go live as well along with tiers GA, so we are removing their flags and bumping them as part of tiers beta.
2022-03-09 16:19:10 +05:30
Naz
9c64d7af81 Centralized base API path value across server codebase
refs https://github.com/TryGhost/Team/issues/1420

- This changeset makes the "/ghost/api" base path for the APIs centralized in one place and reused by dependent modules. There are couple benefits this refactor brings: easy way to spot where the API base path is used (was hard to find it in regexp) and makes it easy to change the hardcoded path to a configurable one in the future (e.g. host all APIs under `domain.tld/custom-path/awesome-apis/posts`)
- I hear that scream from the back of your head: "But hey! This introduced coupling to url-utils!". To that my unswer is: "No. This change only makes the coupling explicit, it's been there already and now can be addressed if we need to!".
- A neat thing about his change, making the API work on a custom path is one line away, by moving the hardcoded `/ghost/api` to a config ;)
2022-03-09 17:15:51 +08:00
Daniel Lockyer
6a25a0e0dd
Merged v4.38.1 into main
v4.38.1
2022-03-09 09:02:46 +00:00
Daniel Lockyer
11d028935f v4.38.1 2022-03-09 09:00:00 +00:00
Daniel Lockyer
7e4652a5f0 Updated Admin to v4.38.1 2022-03-09 08:59:59 +00:00
Naz
99ce8d1189
🐛 Fixed theme activation with capitalized names
closes https://github.com/TryGhost/Team/issues/1420
refs da0dee548c
refs https://github.com/TryGhost/Toolbox/issues/169

- After introducing non-versioned API urls the "isAPI" regex failed to pass the test as it was expecting a `canary/vX` in the API URL. This caused "uncapitalization" to stop working for API requests.
- Regex visualizer for quick reference: https://jex.im/regulex/#!flags=&re=%5E(.*%5C%2Fghost%5C%2Fapi(%5C%2F(v%5B%5Cd.%5D%2B%7Ccanary))%3F%5C%2F.*%3F%5C%2F)
2022-03-09 08:00:53 +00:00
Renovate Bot
773045cd5c Update dependency @tryghost/url-utils to v2.0.8 2022-03-09 07:43:15 +00:00
Renovate Bot
f08750e722 Update dependency cssnano to v5.1.1 2022-03-09 07:42:08 +00:00
Naz
da9f018c70 🐛 Fixed theme activation with capitalized names
closes https://github.com/TryGhost/Team/issues/1420
refs da0dee548c
refs https://github.com/TryGhost/Toolbox/issues/169

- After introducing non-versioned API urls the "isAPI" regex failed to pass the test as it was expecting a `canary/vX` in the API URL. This caused "uncapitalization" to stop working for API requests.
- Regex visualizer for quick reference: https://jex.im/regulex/#!flags=&re=%5E(.*%5C%2Fghost%5C%2Fapi(%5C%2F(v%5B%5Cd.%5D%2B%7Ccanary))%3F%5C%2F.*%3F%5C%2F)
2022-03-09 20:07:04 +13:00
Renovate Bot
cb42b0432f
Update dependency @sentry/node to v6.18.2 2022-03-08 14:53:17 +00:00
Matt Hanley
2110c65e47 Removed notification on theme install failure during setup step
refs https://github.com/TryGhost/Team/issues/1417

- we no longer want to display a notification if theme install fails
- the notification has been removed so we fail silently, but log the warning
2022-03-08 13:33:48 +00:00
Rishabh Garg
e6c9dadec2
Fixed tiers test with correct visibility (#14280)
refs https://github.com/TryGhost/Team/issues/1387
2022-03-08 18:00:30 +05:30
Rishabh
7c43191ca7 Fixed members endpoint not ignoring unknown includes
refs https://github.com/TryGhost/Team/issues/1415

Members browse endpoint was missing allowedIncludes validation, causing unknown includes to throw 500 on API request.
2022-03-08 16:59:51 +05:30
Rishabh
90ef822259 Updated test fixtures for tiers with new visibility property
refs https://github.com/TryGhost/Team/issues/1387

Test fixtures were missed while updating new visibility property for tiers.
2022-03-08 14:49:13 +05:30
Rishabh
9bab4439e5 Updated Portal to handle new tier visibility property
refs https://github.com/TryGhost/Team/issues/1387

Bumps portal with changes to handle new tier visibility property instead of portal plans/products setting. Also adds new UI refinements for tiers GA.
2022-03-08 11:33:51 +05:30
Rishabh
32ff722028 Added tier visibility to portal tier data
refs https://github.com/TryGhost/Team/issues/1387

We are moving away from using portal products/plans settings to visibility property on the tier object.
2022-03-08 11:33:51 +05:30
Renovate Bot
bca0e4ba05
Update dependency bookshelf-relations to v2.4.0 2022-03-07 20:53:10 +00:00
Peter Zimon
e2438a008e Udpated powered by badge 2022-03-07 17:36:01 +01:00
renovate[bot]
cbef892dc6
Fixed default value for Tier visibility (#14274)
refs https://github.com/TryGhost/Team/issues/1387

This fixes the Tier visibility property in the members-api so we do not
attempt to set it to a boolean.
2022-03-07 15:30:13 +00:00
Renovate Bot
e1920eba0c Update dependency @tryghost/color-utils to v0.1.10 2022-03-07 15:27:10 +00:00
Renovate Bot
8b32f2cf9c Update dependency @tryghost/helpers to v1.1.59 2022-03-07 15:27:00 +00:00
Fabien 'egg' O'Carroll
fa1165de6a
Support tier visibility editing Allowed Tiers Admin API to set visibility
refs https://github.com/TryGhost/Team/issues/1387

This will allow us to move from the portal_products and portal_plans
settings to using the visibility property on tiers to determine whether
or not a tier should be visible in Portal.

This also fixes a bug with the Tiers Admin API read method permissions.
2022-03-07 14:46:42 +00:00
Daniel Lockyer
1a3aa69c68 Re-throw error when attempting to create webhooks
- we catch error arising from creating webhooks and check for specific codes
- if our error does not match one of those codes, we don't propagate the
  error up
- this becomes a problem if saving a webhook fails for some other reason
  because upstream code assumes we return an error or model
- this commit re-throws the error and adds a test that would have caught
  this
2022-03-07 13:54:00 +00:00
Daniel Lockyer
a7074592c8 Configured CI to only calculate coverage for recommended Node version
- we seem to be getting some odd numbers when running c8 on Node 12, and
  it's causing our CI checks to fail
- even when we're adding tests, the coverage value goes down
- this is disrupting the team from shipping, so we need to change that
- this commit alters the setup to run unit tests w/ c8 for Node 16 unit
  tests, and without c8 for other versions
- `yarn test:unit` is kept the same for everyday use
2022-03-07 13:45:33 +00:00
Fabien 'egg' O'Carroll
cff033bb47
Migrated visibility column from portal settings (#14253)
https://github.com/TryGhost/Team/issues/1387

This is split into two migrations, one for the portal_products setting
and one for the portal_plans setting, as dealing with both of them in a
single migration led to too many branches.
2022-03-07 11:38:39 +00:00
Renovate Bot
390e1cac50 Update dependency postcss to v8.4.8 2022-03-07 11:18:03 +00:00
Daniel Lockyer
d47651b029 v4.38.0 2022-03-04 16:00:27 +00:00
Daniel Lockyer
76fa82447d Updated Admin to v4.38.0 2022-03-04 16:00:26 +00:00
Daniel Lockyer
ebc5d69a51 🎨 Updated Casper to v4.7.3 2022-03-04 16:00:26 +00:00
Rishabh Garg
3fa836690e
Updated to always invalidate cache on tier edit (#14267)
refs https://github.com/TryGhost/Team/issues/1240

We were selectively invalidating cache on tier/product edit which was consistent with pattern for other APIs, but in case of tier/product, the model changed method always returns false due to how its setup. This change updates the edit to always invalidate cache, similar to tier add, to ensure sites don't see old tier values.
2022-03-04 15:47:30 +00:00
Rishabh
b03862d08a Updated content cta helper to use new tiers helper
refs https://github.com/TryGhost/Team/issues/1004

Replaces {{products}} helper usage with updated {{tiers}} helper. Default output for {{tiers}} helper is the same as {{products}} helper.
2022-03-04 18:22:59 +05:30
Rishabh
665c30f255 Added new {{tiers}} theme helper
refs https://github.com/TryGhost/Team/issues/1004

- adds new `{{tiers}}` helper behind `multipleProducts` flag
- `{{tiers}}` outputs a string with list of tiers that have access to specific post when used in a post context in theme
- outputs empty string when used out of a post context and without access to `visibility` property
- uses tiers attached to post column for data
2022-03-04 18:22:59 +05:30
Rishabh
a328e3e88b Fixed include option not working for fetching tiers via #get helper
refs https://github.com/TryGhost/Team/issues/1004

The output serializer for product was not handling `include` option value as comma separated string, which is passed via `#get` helper to fetch related prices for tiers. This change fixes the handling to work with both array as well as comma-separated include values.
2022-03-04 18:22:59 +05:30
Rishabh
eac732f620 Added tiers data for posts with non tiers visibility
refs https://github.com/TryGhost/Team/issues/1004

The `tiers` column for a post/page only contained data if its visibility is set to `tiers`, otherwise its empty. This is because originally the purpose of `tiers` column on `post` was to capture specific tiers with access to post.
The best way to ensure a consistent behavior for `tiers` column data on post is to update it to always contain list of all `tiers` that have access to post, and not just when the visibility is `tiers`. This means the value is set to all tiers when visibility is one of public|members, and only paid tiers when visibility is `paid`.  This change also allows on frontend to get all relevant `tiers` information for a post locally within post context instead of relying on additional information from outside.

This change -

- updates the output serializer for post/page to add all desired tiers manually in case of visibility is not `tiers`
- updates tests
2022-03-04 18:22:59 +05:30
Kevin Ansfield
df27b1993f Removed membersTimeFilters labs flag
refs https://github.com/TryGhost/Admin/pull/2290

- feature has gone GA and is no longer used in Admin
2022-03-04 12:11:48 +00:00
Matt Hanley
cd081e46fb Removed migration requirement for sqlite 2022-03-04 11:27:04 +00:00