Commit Graph

1246 Commits

Author SHA1 Message Date
Rishabh
ad226f85b3 Added newsletter data to member BREAD service
refs https://github.com/TryGhost/Team/issues/1469

With multiple newsletters, members can now have one or more newsletter subscriptions that is attached to them. This change updates the member BREAD service to handle attaching newsletter data to member, based on the newsletter flag.

- if newsletter flag is disabled, add/edit methods delete any newsletter data attached to member
- sets `newsletters` as a default relation for read/browse methods so a member always has newsletter data attached to them
2022-04-04 20:07:37 +05:30
Simon Backx
aaff165a21 Fixed 'labels is not defined on the model' error (#378)
no issue

- When a new member is added via the API, with a stripe_customer_id, the member bread service is passed also with a default option: `withRelated: ['labels']`.
- This option is passed along to the member repository, and further and is also passed when loading relations that don't have a relationship called 'labels'.
- This results in a `labels is not defined on the model` error when you try to create a new member with a stripe customer id.
- Test that found this issue will be added to the Ghost repo.
2022-03-31 16:15:53 +02:00
Daniel Lockyer
b84e54b0cf Unpinned dependencies
- libraries should have dependencies unpinned so we can rely on
  lockfiles and reduce duplicates
- this commit unpins a handful of dependencies
2022-03-24 11:06:57 +00:00
Simon Backx
7e556d84de Fixed adding same redirect multiple times throws an error on removal (#379)
refs https://ghost.slack.com/archives/C02G9E68C/p1647599592576139

When you add a redirect multiple times, and remove it afterwards, an error is thrown:
`Cannot destructure property 'fromRegex' of 'this.redirects[redirectId]' as it is undefined.` 
This was caused by `redirectIds` that contained the same id multiple times.

* Added a test for adding a redirect multiple times and removing it once
* Fixed adding same redirect multiple times throws an error on removal
2022-03-24 09:54:19 +01:00
Thibaut Patel
84bbcbb057 Published new versions
- @tryghost/members-api@5.4.1
 - @tryghost/members-csv@1.2.9
 - @tryghost/members-importer@0.5.6
 - @tryghost/members-stripe-service@0.9.2
2022-03-23 11:26:35 +01:00
Thibaut Patel
f9ed212431 Added the missing requires to the stripe package
refs https://github.com/TryGhost/Team/issues/1437

- This enables this package to declare the version of all its dependencies
- It avoids using a different `@tryghost/domain-events` version, which ends up creating a new underlying EventEmitter than the one used with the other packages in this monorepo.
- The long term fix to avoid to have multiple EventEmitters is to make domain-events an injected dependency, so that it's only a dependency of Ghost core.
2022-03-23 11:22:36 +01:00
Simon Backx
2cab543473 Published new versions
- @tryghost/members-api@5.4.0
 - @tryghost/members-csv@1.2.8
 - @tryghost/members-importer@0.5.5
2022-03-18 16:38:42 +01:00
Kevin Ansfield
e8b8fef985 🐛 Fixed member responses not including complimentary subs when canceled subs exist
refs https://github.com/TryGhost/Team/issues/1141

- when a member had canceled subscriptions the check we have to match products to subscriptions to determine whether to insert the hardcoded complimentary subscription was incorrectly matching against the canceled subscriptions
- updated to match only active subscriptions
2022-03-18 10:47:24 +00:00
Renovate Bot
e1d6fc4ed4 Update dependency papaparse to v5.3.2 2022-03-15 13:08:41 +00:00
Thibaut Patel
c37021c575 Published new versions
- @tryghost/domain-events@0.1.9
 - @tryghost/express-dynamic-redirects@0.2.7
 - @tryghost/magic-link@1.0.21
 - @tryghost/member-analytics-service@0.1.11
 - @tryghost/member-events@0.4.1
 - @tryghost/members-analytics-ingress@0.1.12
 - @tryghost/members-api@5.3.0
 - @tryghost/members-csv@1.2.7
 - @tryghost/members-events-service@0.3.2
 - @tryghost/members-importer@0.5.4
 - @tryghost/members-ssr@1.0.23
 - @tryghost/members-offers@0.10.9
 - @tryghost/members-payments@0.1.11
 - @tryghost/members-stripe-service@0.9.1
 - @tryghost/verification-trigger@0.1.6
2022-03-11 22:45:26 +01:00
Thibaut Patel
8b7d9281d3 Added MemberCancelEvent
refs https://github.com/TryGhost/Team/issues/1302

- This event is triggered on subscription cancellation
2022-03-11 22:44:28 +01:00
Renovate Bot
0ad973c8b5 Update dependency mocha to v9.2.2 2022-03-11 18:04:58 +00:00
Renovate Bot
5b6fe29293 Update dependency @tryghost/errors to v1.2.5 2022-03-11 15:44:50 +00:00
Thibaut Patel
45401097f7 Published new versions
- @tryghost/members-api@5.2.0
2022-03-10 09:59:58 +01:00
Thibaut Patel
a0001df1ad Added the product name property in member reads
refs https://github.com/TryGhost/Team/issues/1141

- The goal is to retrieve the product name for canceled subscriptions
- The property is located at `member.subscriptions.price.product.name`
- We can't easily get the full product as products are retrieved using a join through `members_products`, and there is only a `members_products` row when the subscription is active
2022-03-10 09:50:10 +01:00
Fabien "egg" O'Carroll
688a5c9241 Published new versions
- @tryghost/members-api@5.1.2
 - @tryghost/members-stripe-service@0.9.0
2022-03-09 14:43:15 +00:00
Fabien 'egg' O'Carroll
633dc08c11 Added migration to update Stripe Product names (#376)
refs https://github.com/TryGhost/Team/issues/1289

We had a bug where Tiers would have a name of 'Default Product', and a
Stripe Product would be created with the same name. This migration will
fixes those broken Stripe Products
2022-03-09 14:41:59 +00:00
Renovate Bot
e45f85ce41 Update dependency @tryghost/errors to v1.2.4 2022-03-09 10:31:57 +00:00
Fabien "egg" O'Carroll
cc576bb130 Published new versions
- @tryghost/members-api@5.1.1
2022-03-07 14:09:51 +00:00
Fabien 'egg' O'Carroll
480a22d6ac Fixed visibility changes in product repository (#375)
refs https://github.com/TryGhost/Team/issues/1387

First, this default value didn't make sense as it was written when we
had a boolean visible column, second, we don't need to add defaults here
- this implementation is super tied to the models anyway, so we may as
well rely on the model defaults - if we do pull it out similar to
Offers, then it may make sense to add a default there.

We also update the JSDoc to match the updated data structure.
2022-03-07 14:09:07 +00:00
Fabien "egg" O'Carroll
f3c79ebc9d Published new versions
- @tryghost/members-api@5.1.0
2022-03-07 11:46:41 +00:00
Fabien "egg" O'Carroll
9658306a19 Allowed Tier visibility to be set via repository
refs https://github.com/TryGhost/Team/issues/1387

This will allow the API to set the visibility property for Tiers.
2022-03-07 11:42:51 +00:00
Thibaut Patel
64e2f49bab Published new versions
- @tryghost/members-events-service@0.3.1
2022-03-01 17:35:27 +01:00
Thibaut Patel
30681319b5 Fixed the model update method
refs https://github.com/TryGhost/Ghost/pull/14197

- Uses the right method to update a model (`edit`)
- Also fixes the `updateLastSeenAt` comment that wasn't reflecting the code
2022-03-01 17:35:02 +01:00
Thibaut Patel
0ad1e65ff6 Published new versions
- @tryghost/members-events-service@0.3.0
2022-03-01 17:20:14 +01:00
Thibaut Patel
c12c638974 Fixed typo in members-events-service dependency
refs https://github.com/TryGhost/Ghost/pull/14197

- `domainEvents` should be plural
2022-03-01 17:19:34 +01:00
Thibaut Patel
7f9e407d75 Published new versions
- @tryghost/members-events-service@0.2.0
2022-03-01 17:13:39 +01:00
Thibaut Patel
88f8b622f1 Moved the DomainEvents service as a dependency of members-events-service
refs https://github.com/TryGhost/Ghost/pull/14197

- Using the package directly was creating a second instance and was never triggering the subscriber
- Passing DomainEvents as a dependency solves this issue
2022-03-01 17:12:59 +01:00
Thibaut Patel
88fb84027c Published new versions
- @tryghost/members-events-service@0.1.2
2022-03-01 15:28:19 +01:00
Thibaut Patel
9fb03e8f09 Updated dependencies to an exact version
no issue

- The members-events-service dependencies where not pinned to an exact version, it's fixed.
2022-03-01 15:07:38 +01:00
Thibaut Patel
d7d29544ad Published new versions
- @tryghost/members-events-service@0.1.1
2022-03-01 13:08:12 +01:00
Thibaut Patel
36bb014fc0 Simplified time comparison in last-seen-at-updater
no issue

- The code had un-needed complexity
- Removing the extra complexity led to the same behavior, as validated by the unit tests
2022-03-01 13:07:37 +01:00
Thibaut Patel
dafda42e0a Published new versions
- @tryghost/domain-events@0.1.8
 - @tryghost/express-dynamic-redirects@0.2.6
 - @tryghost/magic-link@1.0.20
 - @tryghost/member-analytics-service@0.1.10
 - @tryghost/member-events@0.4.0
 - @tryghost/members-analytics-ingress@0.1.11
 - @tryghost/members-api@5.0.4
 - @tryghost/members-csv@1.2.6
 - @tryghost/members-events-service@0.1.0
 - @tryghost/members-importer@0.5.3
 - @tryghost/members-ssr@1.0.22
 - @tryghost/members-offers@0.10.8
 - @tryghost/members-payments@0.1.10
 - @tryghost/members-stripe-service@0.8.4
 - @tryghost/verification-trigger@0.1.5
2022-03-01 10:36:48 +01:00
Thibaut Patel
bc5b8109e6 Moved the last-seen-at-updater to use the publication timezone
refs https://github.com/TryGhost/Team/issues/1306

- This removes the limitation described in commit ff46449ad6
- The only edge case is that when a publication changes their timezone, it will have maximum 24 hours where the member last_seen_at could be incorrect
2022-03-01 10:28:45 +01:00
Thibaut Patel
d2d7fb3fe7 Moved from a floating 24h window to a UTC-aligned window
refs https://github.com/TryGhost/Ghost/pull/14197

- Moved from updating the last_seen_at value "at most every 24h" to "at most every UTC day".
- It will simplify explaining the following behavior: a publication is set in UTC-10, a user visits at 2pm on Monday and at 1pm on Tuesday, the last_seen_at value is still Monday.
- There is no way to go around the above issue due to the technical constraint of updating the `last_seen_at` value at most once a day.
- This might create database write spikes at midnight UTC
2022-02-28 14:42:17 +01:00
Thibaut Patel
161c0d7330 Added the members-events-service package
refs https://github.com/TryGhost/Team/issues/1306

- Contains all services that listen on member events
- Only contains the last-seen-at-updater service for now
- Listens for `MemberViewEvent` events to update the `member.last_seen_at` timestamp
- Updates after 24hours of the last timestamp to avoid too many writes
- Also updates when the value is NULL
- This is using the existing `last_seen_at` value to avoid an SQL query when no writes are required
2022-02-28 14:42:17 +01:00
Thibaut Patel
c6e98e67c0 Added the new MemberPageViewEvent event
refs https://github.com/TryGhost/Team/issues/1306

- This event will be triggered by logged-in members visiting any page of the publication (page, post, tag, author...)
2022-02-28 14:42:17 +01:00
Renovate Bot
9cc2cb8b87 Update dependency @tryghost/errors to v1.2.3 2022-02-21 17:48:55 +00:00
Daniel Lockyer
db696a9272 Added --all to c8 command
refs https://github.com/TryGhost/Toolbox/issues/203

- without `--all`, c8 ignores files that should be included in the
  coverage score but aren't used in tests
- this means we have artificially high scores in places where this isn't
  used
- this commit adds `--all` where previously missing
- where this fails `--check-coverage`, that has been removed for now
2022-02-21 13:08:55 +01:00
Renovate Bot
d813510a07 Update dependency mocha to v9.2.1 2022-02-21 00:05:27 +00:00
Naz
7fdd210739 Published new versions
- @tryghost/members-api@5.0.3
 - @tryghost/members-stripe-service@0.8.3
2022-02-18 16:23:21 +07:00
Naz
27fe7ed61c 🐛 Fixed StripeAPI disconnection
refs https://github.com/TryGhost/Toolbox/issues/214

- After disconnecting Stripe API the `_configured` flag stayed as `true`, causing behaviors as if Stripe was still connnected.
- The `api.configure` method was never reachable when disconnecting Stripe API, thus causes hanging "configured === false" state inside of the StripeAPI wrapper
2022-02-18 22:21:56 +13:00
Fabien "egg" O'Carroll
6c1081df23 Published new versions
- @tryghost/magic-link@1.0.19
 - @tryghost/members-api@5.0.2
 - @tryghost/members-csv@1.2.5
 - @tryghost/members-importer@0.5.2
 - @tryghost/members-ssr@1.0.21
 - @tryghost/members-stripe-service@0.8.2
2022-02-17 14:05:22 +02:00
Fabien "egg" O'Carroll
f452df7e92 Fixed error handling webhook for unknown member
refs https://github.com/TryGhost/Team/issues/1374

We cannot update payment details for members which we don't know about,
so returning and giving a successful response to Stripe is the correct
thing to do.
2022-02-17 13:51:47 +02:00
Renovate Bot
e400b4d8f4 Update dependency @tryghost/errors to v1.2.2 2022-02-17 03:05:28 +00:00
Daniel Lockyer
f229d1077d Fixed repository link in old packages
- these are some of our first packages here and use `master` in their
  repository link
- we've since switched the repo to use `main` but these links were not
  updated
- this commit updates the links
2022-02-16 09:32:32 +01:00
Daniel Lockyer
a0f716f475 Published new versions
- @tryghost/domain-events@0.1.7
 - @tryghost/express-dynamic-redirects@0.2.5
 - @tryghost/magic-link@1.0.18
 - @tryghost/member-analytics-service@0.1.9
 - @tryghost/member-events@0.3.5
 - @tryghost/members-analytics-ingress@0.1.10
 - @tryghost/members-api@5.0.1
 - @tryghost/members-csv@1.2.4
 - @tryghost/members-importer@0.5.1
 - @tryghost/members-ssr@1.0.20
 - @tryghost/members-offers@0.10.7
 - @tryghost/members-payments@0.1.9
 - @tryghost/members-stripe-service@0.8.1
 - @tryghost/verification-trigger@0.1.4
2022-02-15 13:42:23 +01:00
Renovate Bot
463317eb76 Update dependency sinon to v13 2022-02-15 13:39:43 +01:00
Renovate Bot
a0f9070b49 Update dependency @tryghost/errors to v1.2.1 2022-02-15 13:39:33 +01:00
Renovate Bot
5e91609abb Update Test & linting packages 2022-02-15 13:35:28 +01:00