Ghost/ghost/milestones
Aileen Booker eeb7546abb
Added handling for initial and skipped Milestones (#16405)
refs
https://www.notion.so/ghost/Marketing-Milestone-email-campaigns-1d2c9dee3cfa4029863edb16092ad5c4?pvs=4

- When milestones will be activated we would send out emails to users
that are way above the achieved milestone, as we didn't record
milestones before
- The plan is to implement a 0 milestone and don't send an email for
achieving those and also add all achieved milestones in the first run
until a first milestone is stored in the DB, then increment from there.
- This change takes care of two cases:
1. Milestones gets enabled and runs initially. We don't want to send
emails unless there's already at least one milestone achieved. For that
we add a 0 milestone helper and add a `initial` reason to the meta
object for the milestone event, so we can choose not to ping Slack and
also disable email sending for all milestones achieved in this initial
run.
2. All achieved milestones will be stored in the DB, even when that
means we skip some. This introduces the `skipped` reason which also
doesn't send emails for the skipped milestones, but will do for
correctly achieved milestones (always the highest one).
- Added handling for slack notifications to not attempt sending when
reason is `skipped` or `initial`
2023-03-13 19:01:11 +02:00
..
lib Added handling for initial and skipped Milestones (#16405) 2023-03-13 19:01:11 +02:00
test Added handling for initial and skipped Milestones (#16405) 2023-03-13 19:01:11 +02:00
.eslintrc.js Renamed milestone-emails to milestones 2023-02-15 10:43:05 +02:00
index.js Renamed milestone-emails to milestones 2023-02-15 10:43:05 +02:00
package.json Update Test & linting packages 2023-03-13 02:36:20 +00:00
README.md Renamed milestone-emails to milestones 2023-02-15 10:43:05 +02:00

Milestones

Checking milestone defined milestone goals and sending events when achieved

Usage

Develop

This is a monorepo package.

Follow the instructions for the top-level repo.

  1. git clone this repo & cd into it as usual
  2. Run yarn to install top-level dependencies.

Test

  • yarn lint run just eslint
  • yarn test run lint and tests