refs: https://github.com/TryGhost/Team/issues/1599
- add an internal integration for Ghost's frontend to talk to the content API
- this is so that portal and future features can access our APIs through the correct mechanism of an API key
refs https://github.com/TryGhost/Toolbox/issues/325
- this was used for an alpha proof-of-concept for member activity data
collection but we're rethinking the strategy so this is the easiest
way to ensure it can't be enabled when the database table has been deleted
refs https://github.com/TryGhost/Toolbox/issues/292
- Providing user-defined Integration name instead of API client's UserAgent gives a lot more control to instance administrators identifying which integration is being used incorrectly.
- It's best practice to create an Integration with a set of API keys per API client - which should be enough to identify an outdated one.
refs https://github.com/TryGhost/Toolbox/issues/309
- this table was used an an experiment for member analytics
- as we rethink the strategy, we can take the opportunity to clean the table up
- we have these rules in place to force the developer to think about the
performance impact of their code
- unless they are enforced, it's easy for them to slip by and miss them
- this commit changes the warnings to errors, which will fail CI
- developers still have the ability to disable lines that flag the
linting in case there is a valid use-case
- if the table doesn't exist, it's not necessarily a failure that we
should be informing the user about
- this brings the message wording in line with other log lines of
similar operations
refs https://github.com/TryGhost/Toolbox/issues/309
- this column is now a calculated value based upon the relation of a
member to a newsletter
- we should no longer need `subscribed`, so this migrations cleans up
the column in the DB
refs https://ghost.slack.com/archives/C02G9E68C/p1651939076681719
Cause:
- When a scheduled post was published via the post scheduler, no `newsletter_id` option is passed when editing the post.
- When editing a post via the posts service, without the `newsletter_id` option, the `newsletter_id` option is automatically set to the default newsletter's id.
- Inside the post model, this new `newsletter_id` was not saved, because it was already set, and changing it is prevented.
- The `mega` service wasn't using the (unchanged) post's newsletter_id, but used the option instead, which contained the default newsletter's id.
Fix:
- Always using the newsletter_id from the post and requiring the newsletter associated with a post to exist.
- This behaviour can be/is tested by publishing a scheduled post without any option.
Also cleaned up some `Object.assign` usages.
refs https://github.com/TryGhost/Team/issues/1546
- allows newsletters API to work with Admin API keys
- updates fixtures to add permissions to admin integration role for new sites
- adds migration to update existing sites to have correct permissions for role
- whitelists add/edit/read/browse on newsletters API for integrations
refs https://github.com/TryGhost/Toolbox/issues/309
- this commit adds a validation array of valid user `status` values to
the schema
- this also includes a migration to update users with invalid statuses
to `inactive`, which I've seen with `invited` and `invited-pending`
statuses that pre-dated proper invitations
- this also deletes tests that were wrong and written 7 years ago before
invites was added
- `subscribed` will soon cease to be a column on a member and I get errors
in tests that stem from this block of code because it no longer exists
- AFAICT this block of code is only used to verify the filter is valid
to filter on, which we should be able to do even if we remove
`subscribed`
- this commit removes `subscribed` from the filter
refs https://github.com/TryGhost/Toolbox/issues/309
- I originally started looking at this because I wanted to change the default of
`emails.recipient_filter` for old DBs to `status:-free`
- we changed these columns to a `text` type, which doesn't support
defaults
- the tables already have defaults set in the model, so the only change
needed here is to delete the `defaultTo` in the schema to avoid
confusion
- on the way, I ended up fixing 51498abb5c too
refs https://github.com/TryGhost/Toolbox/issues/309
- we're removing the OAuth prototype and the table was never used, so we
should be good to drop it
- this commit adds a migration to drop the table
refs https://github.com/TryGhost/Toolbox/issues/309
- we started off with "free" and "paid" in these columns but since moved
to NQL strings
- there is code in Ghost to rewrite these values to NQL strings, but we
still have posts/emails in the DB with these old values so they need
to be updated
- once this migration is merged, we can probably clean a lot of that
aliasing up
- this commit migrates values in `posts.email_recipient_filter` and
`emails.recipient_filter` from `free` to `status:free` and `paid` to
`status:-free`
- I've left the down as a no-op because we don't want to translate
values back, and we don't know which ones we originally migrated in
the first place
refs https://github.com/TryGhost/Toolbox/issues/230
- The test fixtures should be using `authors: [{id:...}]` syntax instead of relyin on `author_id` or `author` - these are deprecated concepts that should go away from the codebase
refs https://github.com/TryGhost/Toolbox/issues/230
- The `author_id` would be ignored as a parameter in the API or Post model, so would produce a falsy results if specific fixtures were used to compare test results
refs https://github.com/TryGhost/Toolbox/issues/230
- The `author_id` column is gone, so is the support for filtering posts by single author's id. Using author's slug(s) is the closest alternative to achieve the same result
refs https://github.com/TryGhost/Toolbox/issues/230
- The fixture manager has to initialize User/Roles fixtures first to be able to insert multiple authors as a relation in post fixtures. Otherwise the posts could not find correct authors and were failing trying to assign default "owner user" to each post
- The order of running fixtures matters, and till now the order wasn't taken into account at all when populating the db
refs https://github.com/TryGhost/Toolbox/issues/230
- This is a first step to removal of `author_id` concept from the codebase. The aim is to see what parts break down from this changes an work backwards from there
refs https://github.com/TryGhost/Toolbox/issues/292
- The version mismatch notification emails were missing a URL of the endpoint that was being accessed by an outdated integraton
- Also squeezed in a refactor simplifying APIVersionCompatibilityService initialization
refs https://github.com/TryGhost/Team/issues/1571
- With the addition of multiple newsletters, all emails sent previously should be assigned to the default newsletter
- This will make sure that the sent count for the default newsletter displays correctly
- we needed to bump the major version so 5.0 migrations will run in CI
- I'm also switching the Migrations test to delete all 5.x migrations
and re-run them to test idempotency
refs https://github.com/TryGhost/Toolbox/issues/309
refs 2bfd8f8b7e
- we've previously had issues when dropping a column on `posts`
because it's a large table and it can take a veeeeeeery long time with
the default SQL produced by Knex
- we found a magic incantation that makes it super speedy (context in
commit above) => `, algorithm=copy`
- for that migration, we did it all manually but we can now change the
utility to always append this to the generated SQL so we don't have to
think about the specific table size when adding or dropping columns
- this changes the `addColumn` and `dropColumn` utilities to append the
string to SQL in MySQL, or just executes the SQL for SQLite