Commit Graph

13719 Commits

Author SHA1 Message Date
Fabien O'Carroll
4e47c63e73 Updated members serializer to handle POJO
no-issue

The @tryghost/members-api module is being updated to export a BREAD
service which will be used to move the logic from the controller into.
This service is currently designed to returns objects rather than
models, as it has to do manipulation of the returned data at the object
level. This update to the serializer will allow a seamless transition to
the use of the BREAD service and allow us to pull out the logic from the
controller sooner!
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
Daniel Lockyer
51d602d5b3
Removed unused internal request lib
refs 3f0bab4389

- the internal `request` lib we had was replaced with `@tryghost/request` in
  the referenced commit
- this lib was not deleted, so it's still lingering around
- this commit deletes that file to clean it up
2021-08-26 14:21:27 +02:00
Fabien 'egg' O'Carroll
c7a7828b57
Gave Administrators permission to connect to Stripe (#13228)
refs https://github.com/TryGhost/Team/issues/994

This adds the permission required to connect to Stripe to the
Administrator role, as required by the linked issue.
2021-08-26 11:00:40 +01:00
Fabien O'Carroll
611f696149 Removed bluebird import from migration utils
no-issue

The bluebird library is unecessary in this module, as all uses of it
were wrapped in `async` functions which will return a native Promise
rather than a bluebird one.

refs https://ghost.slack.com/archives/C02G9E68C/p1629822160273500
2021-08-25 23:30:14 +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
413b06d1b5 Fixed leading/trailing HR removal when rendering email content
refs https://github.com/TryGhost/Team/issues/1007

- `:root` selector wasn't working as expected and ended up matching HRs within content
- switched to wrapping the post html inside a `<body>` element before parsing so that we have a proper top-level element for direct child selectors to match against
2021-08-25 09:25:55 +01:00
Kevin Ansfield
946ae43a15 Removed leading/trailing HR's when rendering email content
refs https://github.com/TryGhost/Team/issues/1007

- the new `email-cta` card allows surrounding dividers to be added when rendering, however if the card is at the beginning or end of the post then these would double-up with the already existing dividers at the beginning and end of the post content in the email template
- not wanting leading/trailing HR's is specific to the email template so it made sense to adjust the renderer output in Ghost's email generating rather than forcing all mobiledoc->html rendering to remove leading/trailing HR's
2021-08-24 19:38:29 +01: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
Fabien O'Carroll
a6bfd61986 Passed MemberProductEvent model to @tryghost/members-api
refs https://github.com/TryGhost/Team/issues/873

The @tryghost/members-api module needs access to this model in order to
create events when members access to products are updated.
2021-08-24 14:46:02 +02:00
Fabien O'Carroll
55f249a328 Added MemberProductEvent model & relations
refs https://github.com/TryGhost/Team/issues/873

We need a relation between members and their product events so that we
can pull out the events for a particular member to generate the start
date of their comped access to a product.
2021-08-24 14:44:53 +02: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
Fabien O'Carroll
1835c22f3b Added getLabelRelations to Member Model
refs https://github.com/TryGhost/Team/issues/946

In order to bulk remove relations between members and labels we need a
way to get hold of all of the existing relations between a label and a
set of members.
2021-08-23 16:38:21 +02:00
Fabien 'egg' O'Carroll
2f33292600
Added members_product_events table (#13236)
refs https://github.com/TryGhost/Team/issues/873

This table is to track events related to members be given or having
removed access to products. It will allow us to provide start dates for
access for complimentary members, as well as being able to track access
to products over time, either for individual members or for aggregates.
2021-08-23 16:29:15 +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
04e7c9fca5 Refactored oembed service to async/await syntax
no issue

- The method was super hard to read with unintuitive catches in multiple places and lots of conditional logic. There's still more to reshuffle here, but that would be for the next time. At least now the data flow is clear within the method
2021-08-23 10:53:44 +04:00
Naz
0703596ace Fixed function comlexity lint warning in oembeds
no issue

- Logic with slightly more complex structure belongs to the service. Extracting it there also show's how little of an API the oembed service should actually expose
2021-08-23 10:36:18 +04:00
Renovate Bot
539145b0c6 Lock file maintenance 2021-08-23 05:03:43 +00:00
Naz
d6f3210fd2 Updated copy for email verification error
refs https://github.com/TryGhost/Team/issues/912

- The copy was changed in post members import email verification popup to have more consistent tone of voice.
2021-08-20 18:07:31 +04: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
Fabien 'egg' O'Carroll
26c3e77640
Ordered Products by their monthly price by default (#13234)
refs https://github.com/TryGhost/Team/issues/714

In order to order products by their monthly price we need to apply a
join with the stripe_prices table when querying so we have access to the
amount column of stripe_prices.

As this ordering is core to how the tiers feature is intended to work,
we have added it as the default order. But this can be overriden by
manually passing the order option.

Also ensured that we do not create duplicate products in test fixtures
2021-08-20 14:46:06 +02: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
5937fa5b92 Updated copy for email verification error
refs 5fd1ed5bcb
refs https://github.com/TryGhost/Team/issues/912

- The copy was changed to reflect the partial success of the import.
2021-08-19 13:35:55 +04:00
Naz
937d9e58d1 Switched post routing to uuid instead of slug
refs https://github.com/TryGhost/Team/issues/990

- Relying on uuid instead of slug makes the posts less discoverable and partially soves discoverability through overriden robots.txt files
2021-08-19 12:27:45 +04: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
Naz
ec841c0944 Renamed index.js file to a service
refs https://github.com/TryGhost/Team/issues/958

- The module contains a service class and not an api index as index.js file should. This rename also fixes an ESLint warning around index.js file being too complicated.
- The serivice should ideally be extracted into the member repository in the future iteration
2021-08-18 11:48:16 +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
1e712b9eab
Updated Admin to 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
Daniel Lockyer
1c2efb8731
Updated Admin to v4.12.0 2021-08-17 11:09:53 +01:00
Fabien 'egg' O'Carroll
26940bea3d
Fixed labs.enabledMiddleware isSet reference (#13227)
no-issue

The `this` used by enabledMiddleware is not bound to `module.exports`.
This updates the middleware to reference the `isSet` method correctly
2021-08-16 17:05:47 +01:00
Renovate Bot
e4d9c8daf2
Update metascraper to v5.24.2 2021-08-16 11:12:26 +00:00
Kevin Ansfield
23fe99e289 Added snippetReplacements to allowed labs flags
refs https://github.com/TryGhost/Team/issues/973

- alpha flag for Admin feature that allows for replacing a snippet's content without having to delete and recreate it manually
2021-08-16 10:40:57 +01:00
Renovate Bot
5eb654bb00 Lock file maintenance 2021-08-16 03:11:47 +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