Commit Graph

2828 Commits

Author SHA1 Message Date
Fabien O'Carroll
a39dd7255d Fixed updating products inside of a transaction
no-issue

When updating products we make many reads and writes to the database,
some of these reads were not happening inside of a transaction which was
causing issues when loading the members setting page. This bumps the
@tryghost/members-api dependency to ensure that all of the database
operations happen inside of the transaction
2021-09-01 19:14:21 +02:00
Naz
4f78bf01a2 Moved default settings population test to regression suite
closes https://github.com/TryGhost/Team/issues/860
refs 5405b6ca7c

- The slow test was running slow because it's not a "unit test" it is testing much more. Moved it to a correct suite - regression which simplified the logic a lot (no need to mock db calls).
- Brought back the 2000ms limit as the bottleneck has been solved
2021-09-01 15:23:57 +04:00
renovate[bot]
f52d0136ef
Update dependency @tryghost/kg-mobiledoc-html-renderer to v5.1.1 (#13251)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-01 09:12:09 +01:00
renovate[bot]
2f2939ec1b
Update dependency @tryghost/color-utils to v0.1.2 (#13269)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-01 09:11:21 +01:00
Naz
5405b6ca7c Temporarily lifted unit test timeout threshold
refs https://github.com/TryGhost/Team/issues/860

- Lifting it slightly just so the timeout doesn't waste team's time on false-positive failures. A follow up commit should put the threshold back to the original value and solve the slow test
2021-09-01 11:12:17 +04:00
Naz
75744041c1 Allowed for a 'sent' status in canary Admin Post API
refs https://github.com/TryGhost/Team/issues/892

- When a published email-only post is edited on the client it sends through a "sent" status over to the backend over PUT endpoint. It's a valid new status that should be accepted by the validation
2021-09-01 10:55:13 +04:00
Renovate Bot
966f167fd9
Update dependency @sentry/node to v6.12.0 2021-08-31 16:25:51 +00:00
Renovate Bot
ac57c1b364
Update dependency mocha to v9.1.1 2021-08-30 00:13:33 +00:00
Fabien O'Carroll
b895b87add Errored when creating products if any error occurs
refs https://github.com/TryGhost/Team/issues/982

When creating a Product with invalid data for Stripe, e.g. a price of
one gazillion dollars - the Stripe API requests would fail, but we would
end up with a broken product created in the database. This updates
@tryghost/members-api to wrap these calls in a database transaction, and
will roll back any operations if one of them fails.
2021-08-26 20:10:31 +02:00
Fabien 'egg' O'Carroll
9a1417c8b9
Exposed dummy subscriptions to theme layer (#13257)
refs https://github.com/TryGhost/Team/issues/986

This updates the @tryghost/members-api module to return the full member
object from getMemberIdentityData, which is used to populate req.member
used by themes to construct the `@member` template data.

The full object is read from the service which handles all additional
properties and logic for retrieving members, including the dummy
subscriptions for comped members.
2021-08-26 16:03:32 +01:00
Fabien O'Carroll
e05fa6af38 Fixed subscription handling to remove old products
refs https://github.com/TryGhost/Team/issues/979

This bump to @tryghost/members-api includes a fix for handling a
subscription updating to a new price. Previously we would add the new
product to the member, but the old one would still be attached. Now we
check that there are no other active subscriptions for the product
associated with the old price, and remove it.
2021-08-26 15:55:22 +02:00
Fabien O'Carroll
76311484df Added dummy subscription to comped members
refs https://github.com/TryGhost/Team/issues/873

This includes the update to @tryghost/members-api which includes the new
MemberBREADService which is used to handle the logic for controller
methods outside of the controller.

With it, we've introduced the concept of a dummy subscription for comped
members. This gives API consumers a way to get the created_at date for a
comped members access to a product.
2021-08-26 15:28:55 +02:00
Daniel Lockyer
c7f45f5580 Renamed coverage:unit command to cov:unit
no issue

- this is slightly quicker to type and cleaner to read
2021-08-26 15:06:45 +02:00
Daniel Lockyer
070a6ac13c Configured c8 to use all source files
no issue

- by default, `c8` will only show stats for files that were loaded during execution
- this means the coverage stats are too high because we're not taking
  into account all the files not loaded by tests
- this commit append the `--all` flag to `c8` which fixes this
2021-08-26 15:06:45 +02:00
renovate[bot]
b2aa2dd7e1
Update dependency @tryghost/members-importer to v0.3.1 (#13231)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-08-25 13:43:13 +01:00
Renovate Bot
789773ae8a Update dependency nock to v13.1.3 2021-08-25 12:08:30 +02:00
Kevin Ansfield
5e83d87ab9 Updated email-cta card rendering to match editor
refs https://github.com/TryGhost/Team/issues/1007

- bumped `@tryghost/kg-default-cards` with updated rendering
  - aligns text as well as button
  - has single payload toggle for divider display
  - adds toggle for button display
- bumps other @tryghost/kg-*` packages that had minor dependency bumps
2021-08-24 18:10:07 +01:00
Fabien O'Carroll
3a6e71a2b6 Wired up MemberProductEvents to member product changes
refs https://github.com/TryGhost/Team/issues/873

This version of @tryghost/members-api handles creating
MemberProductEvents when a member is created, updated or has their
subscription updated. This populates the members_product_events table
and can be used to determine when a member was given access to a
product, which is useful with the concept of comped access to a product,
where we do not have a subscription as a record.
2021-08-24 15:22:10 +02:00
renovate[bot]
2ed9529fa0
Update dependency @tryghost/members-csv to v1.1.5 (#13246)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-08-24 14:17:02 +01:00
renovate[bot]
734f1c4422
Update dependency @tryghost/members-ssr to v1.0.11 (#13247)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-08-24 11:55:51 +02:00
renovate[bot]
0cc64fc5f2
Update dependency @tryghost/magic-link to v1.0.10 (#13245)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-08-24 11:55:42 +02:00
Renovate Bot
17fd1b3c7d Update dependency nock to v13.1.2 2021-08-24 11:17:28 +02:00
Fabien O'Carroll
e71114bb8f Added Members bulk actions endpoint
refs https://github.com/TryGhost/Team/issues/946

This adds the initial bulk actions endpoint used for the members
filtering feature. The idea is to eventually move bulk destroy into this
endpoint to and provide a consistent interface for applying bulk actions
to members.

The @tryghost/members-api package has been bumped to include the new
bulkEdit method.

The sinon.restore in tests was moved to an afterEach so that stubs did
not effect other tests.
2021-08-23 16:38:21 +02:00
renovate[bot]
4266bb751f
Update dependency @tryghost/magic-link to v1.0.9 (#13237)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-08-23 11:06:21 +01:00
renovate[bot]
47f89f56c8
Update dependency @tryghost/members-csv to v1.1.4 (#13238)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-08-23 10:35:10 +01:00
renovate[bot]
6ca8eb2d23
Update dependency @tryghost/members-ssr to v1.0.10 (#13239)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-08-23 10:35:03 +01:00
Naz
7f09beb2a8 Moved email list check to GA
refs https://github.com/TryGhost/Team/issues/906

- The feature has moved to GA from behind alpha flag. It's skipping the beta phase as it's not needed in this specific situation
2021-08-20 18:07:31 +04:00
Daniel Lockyer
70bea3ddf8 Added c8 coverage to unit tests
no issue

- coverage allows us to see how much of our code we're hitting in tests
  and it's time we started to get visibility on this in Ghost
- we can then make informed decisions on which well-tested internal libraries
  can be pulled out into their own packages
- this commit:
  - adds the c8 dev dependency to Ghost
  - prepends the `test:unit` command with c8 with the `text-summary` reporter
  - adds a `coverage:unit` command to get the `text` report
    - you can do `yarn coverage:unit --reporter html` to get a HTML report etc
  - uses this new test coverage reporter command in CI tests
2021-08-20 12:42:11 +02:00
Renovate Bot
53c5cd5428
Update dependency mocha to v9.1.0 2021-08-20 08:16:37 +00:00
Renovate Bot
b1fa774a56 Update dependency cssnano to v5.0.8 2021-08-19 10:40:51 +01:00
Naz
2f2fe16944 Added floating threshold to member import
closes https://github.com/TryGhost/Team/issues/958

- The change allows to dynamically adjust import threshold based on current member count
2021-08-18 18:39:43 +04:00
Renovate Bot
858a8d685a Update dependency supertest to v6.1.6 2021-08-18 08:45:42 +01:00
Daniel Lockyer
fa19ef7f0b v4.12.1
-----BEGIN PGP SIGNATURE-----
 
 iHQEABYIAB0WIQTqYa7kNs8D7Oo9dgLSEYbwtHKVrQUCYRviGQAKCRDSEYbwtHKV
 rfxSAPi1I0TdH6rbtpNCqaAmm0kAShomDM0IOajwm2bSwFIGAQDYgzablHFGAhv7
 fsFe7t66zHs2fGZ7jakF+vC/NEsMBw==
 =ci9A
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQTqYa7kNs8D7Oo9dgLSEYbwtHKVrQUCYRvi/wAKCRDSEYbwtHKV
 rdv+AP9sExkMA4Yqn13vs8Lh6vApLi5BmAYipbVZr7/htx9XVAEA2sd4iQBLvS7H
 KRxwT/4YMvT985cdPrsYL39hRa0ltwc=
 =dpmX
 -----END PGP SIGNATURE-----

Merged v4.12.1 into main

v4.12.1
2021-08-17 17:25:28 +01:00
Daniel Lockyer
b482f76d62
v4.12.1 2021-08-17 17:21:45 +01:00
Daniel Lockyer
f8aa065891 v4.12.0
-----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQTqYa7kNs8D7Oo9dgLSEYbwtHKVrQUCYRuK8QAKCRDSEYbwtHKV
 rXv7AP9tKQEpGwis3ZjVpWcE7EWkYfrwzTmTGnFMAOrqeCPlNQEAyaROjVd2qiGc
 xzHsLOu8fIHjhlbQtkbc0fh4ZMiZ2gw=
 =kec3
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQTqYa7kNs8D7Oo9dgLSEYbwtHKVrQUCYRuL4wAKCRDSEYbwtHKV
 rdLcAQCYNn+jTXH+QaBu2XBPLfwQltXuhTKe0oMoZA8YUFtC1gEA3tGWtXgZNIGH
 BoG+GubHsjSAxpMnxZjQ2dbaUMlZiQo=
 =xy1l
 -----END PGP SIGNATURE-----

Merged v4.12.0 into main

v4.12.0
2021-08-17 11:13:49 +01:00
Daniel Lockyer
019161cad3
v4.12.0 2021-08-17 11:09:53 +01:00
Renovate Bot
e4d9c8daf2
Update metascraper to v5.24.2 2021-08-16 11:12:26 +00:00
Renovate Bot
67cf73074b Update dependency supertest to v6.1.5 2021-08-13 14:14:53 +01:00
Renovate Bot
4fe0535236 Update dependency @tryghost/members-csv to v1.1.3 2021-08-13 14:14:23 +01:00
Renovate Bot
13e148bf08 Update dependency @tryghost/magic-link to v1.0.8 2021-08-13 14:14:16 +01:00
Renovate Bot
762b7a467e Update dependency @tryghost/members-ssr to v1.0.9 2021-08-13 14:14:08 +01:00
Fabien O'Carroll
e208b1a8f3 Updated bulkDestroy method to handle search correctly
no-issue

The first implementation of bulkDestroy did not pass the search option
unless the filter was also passed. This was incorrect and has been
fixed.
2021-08-13 13:35:58 +02:00
Fabien 'egg' O'Carroll
235597a5e4
Refactored Members controller bulkDestroy (#13221)
no-issue

This moves the logic out of the controller and into the members-api
member repository. Removing complexity from the controllers and
out into services is desirable to reduce code in the Ghost codebase
and move logic into modules which can be tested easier.
2021-08-12 15:26:25 +01:00
Renovate Bot
19fd16649a
Update dependency express-jwt to v6.1.0 2021-08-11 22:56:50 +00:00
Renovate Bot
8623e8de8b Update dependency knex to v0.21.21 2021-08-10 17:33:28 +01:00
Renovate Bot
6719aa4e57
Update metascraper to v5.24.1 2021-08-09 11:56:34 +00:00
Renovate Bot
b17bbe3ead
Update dependency multer to v1.4.3 2021-08-09 10:32:38 +00:00
Renovate Bot
5c8fe195d6
Update dependency @sentry/node to v6.11.0 2021-08-06 14:30:33 +00:00
Renovate Bot
b20c88b3e3 Update dependency @tryghost/html-to-mobiledoc to v0.7.17 2021-08-06 13:31:28 +01:00
Renovate Bot
1a89986323 Update dependency @tryghost/social-urls to v0.1.26 2021-08-06 11:39:14 +01:00