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
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.
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
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.
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
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
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
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.
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
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
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
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
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
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
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
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.
- 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