Commit Graph

861 Commits

Author SHA1 Message Date
Naz
e5d097fbae Published new versions
- @tryghost/adapter-manager@0.2.30
 - @tryghost/api-version-compatibility-service@0.1.2
 - @tryghost/bootstrap-socket@0.2.19
 - @tryghost/config-url-helpers@0.1.7
 - @tryghost/constants@1.0.4
 - @tryghost/database-info@0.3.4
 - @tryghost/email-content-generator@0.1.0
 - @tryghost/image-transform@1.0.31
 - @tryghost/job-manager@0.8.23
 - @tryghost/limit-service@1.1.1
 - @tryghost/minifier@0.1.14
 - @tryghost/moleculer-service-from-class@0.2.25
 - @tryghost/mw-api-version-mismatch@0.1.2
 - @tryghost/mw-error-handler@0.2.3
 - @tryghost/mw-session-from-token@0.1.31
 - @tryghost/mw-update-user-last-seen@0.1.5
 - @tryghost/package-json@1.0.20
 - @tryghost/pretty-cli@1.2.26
 - @tryghost/promise@0.1.17
 - @tryghost/release-utils@0.7.14
 - @tryghost/security@0.2.17
 - @tryghost/session-service@0.1.41
 - @tryghost/settings-path-manager@0.1.6
 - @tryghost/update-check-service@0.3.3
 - @tryghost/version-notifications-data-service@0.1.1
 - @tryghost/vhost-middleware@1.0.25
 - @tryghost/zip@1.1.24
2022-05-04 17:21:51 +08:00
Naz
81c6af77b5 Fixed unit test coverage
refs https://github.com/TryGhost/Toolbox/issues/292

- With the package being out of TryGhost/Ghost codebase the paths have changed and needed to introdude a concept of "fixtures" for the package to be able to funciton independently
2022-05-04 17:16:43 +08:00
Naz
393834ae4a Added html-to-text dependency
refs https://github.com/TryGhost/Toolbox/issues/292

- This dependency is needed for the package to function properly. Have pinned it to a lower major than is currently available to avoid a unnecessary rabbithole of dealing with breaking changes
2022-05-04 17:16:43 +08:00
Naz
b4682bf643 Bootstrapped email-content-generator package
refs https://github.com/TryGhost/Toolbox/issues/292
2022-05-04 17:16:43 +08:00
Naz
ca693f79f8 Reworked EmailContentGenerator to async/await
refs https://github.com/TryGhost/Toolbox/issues/292

- Makes the code more readable
2022-05-04 17:16:43 +08:00
Naz
0c2cc2af8a Refactored email utils to a class with DI params
refs https://github.com/TryGhost/Toolbox/issues/292

- There's a need to reuse these utils in the version mismatch notification service. Having loads of tightly coupled dependencies makes it super hard to rip out this module for reuse
- It's a groundwork for extraction of the email-utils package
- Rewrote the unit tests that were written for these utils previously - they weren't testing anything useful. The goal of this util is to generate specific content based on provided data and available templates - now the tests do test those specific things, not the mailer itself!
2022-05-04 17:16:43 +08:00
Hannah Wolfe
6119ccbe90 Moved server unit tests into the server folder
- this is a small part of a bit of cleanup of our test files
- the goal is to make the existing tests clearer with a view to making it easier to write more tests
- this makes the test structure follow the codebase structure more closely
- eventually we will colocate the tests as we break the codebase down further
2022-05-04 17:16:43 +08:00
Naz
ff4bdb5ff8 Made integration naming less technical
refs https://github.com/TryGhost/Toolbox/issues/292

- The audience of the notification emails for version missmatch could be less technical - site owneres are usually creators not programmers. Not using complex technical details in the email subject/body should make the incompatibility more approachable to deal with.
2022-05-04 11:05:48 +08:00
Renovate Bot
d7768efb40 Update dependency archiver to v5 2022-05-02 15:03:40 +01:00
Renovate Bot
6f93c82c5a Update Test & linting packages 2022-05-02 14:01:35 +00:00
Renovate Bot
9589755925 Update Test & linting packages 2022-05-02 13:58:34 +00:00
Hannah Wolfe
4938d33a65 Fixed eslint-warnings in vhost middleware
- this middleware is a fork/copy of expressjs/vhost
- right now I don't want to rewrite the code to meet our eslint rules, so disabling them
2022-05-02 14:47:37 +01:00
Hannah Wolfe
e4af12e5c0 Added additional ghostErrorCode note for the major
refs: https://github.com/TryGhost/Toolbox/issues/316

- getting ready to do a major bump
2022-05-02 14:45:16 +01:00
Renovate Bot
470f7b14d0 Update dependency csso to v5 2022-05-02 13:49:38 +01:00
Hannah Wolfe
fc9e61ff35 Fixed linting error
- trying to call new RequestNotAcceptableError with a variable triggers a lint warning in newer versions of eslint-plugin-ghost
- this workaround is worth it for the safety of not allowing single strings to be passed in!
2022-05-02 13:47:29 +01:00
Hannah Wolfe
a6e204b829 Deprecated handleJSONResponse
- this middleware block is used in v4 but not in v5
- we want to remove it and then rename handleJSONResponseV2 so that we have one single consistent error handling block
2022-05-02 13:43:48 +01:00
Renovate Bot
1ed9d1ef34 Update dependency express to v4.18.1 2022-04-29 20:53:08 +00:00
Fabien "egg" O'Carroll
918db79aa8 Published new versions
- @tryghost/limit-service@1.1.0
 - @tryghost/mw-error-handler@0.2.2
 - @tryghost/mw-session-from-token@0.1.30
 - @tryghost/session-service@0.1.40
 - @tryghost/vhost-middleware@1.0.24
2022-04-27 11:24:20 +01:00
Fabien "egg" O'Carroll
9a3bb767f5 Added newsletter flag to limits service
refs https://github.com/TryGhost/Team/issues/1549

Adding the name of the flag to config.js is a requirment for using the flag
2022-04-27 11:22:34 +01:00
Renovate Bot
57b00c5ec6 Update dependency supertest to v6.2.3 2022-04-27 00:17:55 +00:00
Renovate Bot
764d570da7 Update dependency @tryghost/errors to v1.2.12 2022-04-26 18:07:55 +00:00
Renovate Bot
70c6263ea1 Update dependency express to v4.18.0 2022-04-25 20:53:02 +00:00
Naz
e67595fe51 Published new versions
- @tryghost/api-version-compatibility-service@0.1.1
 - @tryghost/database-info@0.3.3
 - @tryghost/mw-api-version-mismatch@0.1.1
 - @tryghost/version-notifications-data-service@0.1.0
2022-04-22 14:48:16 +08:00
Naz
48c7c9b73a Implemented a version notification data service
refs https://github.com/TryGhost/Toolbox/issues/292

- The version notification data service serves as data manger for version compatibility service
- There's not much logic mostly fetching data from proficed services and filtering/serializing it into a needed format
2022-04-22 14:47:18 +08:00
Naz
38dc003258 Added scaffolding for version notification data service
refs https://github.com/TryGhost/Toolbox/issues/292

- This will be filled up with version nofitication data access logic
2022-04-22 14:47:18 +08:00
Renovate Bot
12f823c677 Update dependency knex to v2 2022-04-21 20:54:58 +00:00
Renovate Bot
e3b7a15d30 Update dependency c8 to v7.11.2 2022-04-21 12:59:13 +00:00
Naz
014fafbafb Published new versions
- @tryghost/adapter-manager@0.2.29
 - @tryghost/api-version-compatibility-service@0.1.0
 - @tryghost/bootstrap-socket@0.2.18
 - @tryghost/config-url-helpers@0.1.6
 - @tryghost/constants@1.0.3
 - @tryghost/database-info@0.3.2
 - @tryghost/image-transform@1.0.30
 - @tryghost/job-manager@0.8.22
 - @tryghost/limit-service@1.0.11
 - @tryghost/minifier@0.1.13
 - @tryghost/moleculer-service-from-class@0.2.24
 - @tryghost/mw-api-version-mismatch@0.1.0
 - @tryghost/mw-error-handler@0.2.1
 - @tryghost/mw-session-from-token@0.1.29
 - @tryghost/mw-update-user-last-seen@0.1.4
 - @tryghost/package-json@1.0.19
 - @tryghost/pretty-cli@1.2.25
 - @tryghost/promise@0.1.16
 - @tryghost/release-utils@0.7.13
 - @tryghost/security@0.2.16
 - @tryghost/session-service@0.1.39
 - @tryghost/settings-path-manager@0.1.5
 - @tryghost/vhost-middleware@1.0.23
 - @tryghost/zip@1.1.23
2022-04-21 20:58:17 +08:00
Naz
d5d594c72a Added test coverage to mw-api-version-mismatch
refs https://github.com/TryGhost/Toolbox/issues/292

- There's no good reason to not write tests!
2022-04-21 20:29:52 +08:00
Naz
f21a403538 Fixed incompatibility subject line
refs https://github.com/TryGhost/Toolbox/issues/292

- This is the subject line with the latest proposed copy
2022-04-21 16:01:56 +08:00
Naz
8414e927f9 Added handling of multiple owners to notify
refs https://github.com/TryGhost/Toolbox/issues/292

- There can be multiple users in the Ghost instance that should be notifiied about version mismatch. Following the logic of the security notifications these are users with 'Owner' and 'Administrator' roles. To have the most up to date list of the emails to notify the emails fetching was made dinamic and is now passed in as a 'fetchEmailsToNotify' function.
- Also fixed the subject of the email to match the final copy
2022-04-21 15:57:43 +08:00
Naz
258b0acc51 Added specific 'code' properties for RequestNotAcceptableError
refs https://github.com/TryGhost/Toolbox/issues/292

- There's a need to distinguish different types of RequestNotAcceptableError erros by their code. The code is also having an instructional name to give it more explicit utility (nice clue for a developer seeing the error)
2022-04-21 15:57:43 +08:00
Naz
4873303658 Added handling for version missmatch as a midleware
refs https://github.com/TryGhost/Toolbox/issues/292

- This middleware is meant to deal with version missmatch erros and call a service that does all the business logic. Having this handling in a separate module allows for thisngs to be loosely coupled
2022-04-21 15:57:43 +08:00
Naz
a7fccf1bf8 Fixed email sending
refs https://github.com/TryGhost/Toolbox/issues/292

- The standard sendEmail function used in Ghost accepts three non-optional parameters: to, subject, and html. Have extended the usage with these three required fields
2022-04-21 15:57:43 +08:00
Naz
786f5429db Bootstrapped api version mismatch middleware
refs https://github.com/TryGhost/Toolbox/issues/292

- Fresh package out of Super Slimer and removed outdated patters, like using "should"
2022-04-21 15:57:43 +08:00
Naz
188707c5bb Added previously handled checking logic
refs https://github.com/TryGhost/Toolbox/issues/292

- Added additional logic needed to check if the passed in `Accept-Version` header has been handled
2022-04-21 15:57:43 +08:00
Naz
a009616206 Removed useless code 2022-04-21 15:57:43 +08:00
Naz
a8333f22d8 Added bare bones functionality sending an email
refs https://github.com/TryGhost/Toolbox/issues/292

- Super happy path scenario which handles sending information with some basic incompatibility information
- It's meant to be built up upon! More to follow :)
2022-04-21 15:57:43 +08:00
Naz
e66ef401bd Removed boilerplate test suite 2022-04-21 15:57:43 +08:00
Naz
e247c6b9a7 Removed should dependency 2022-04-21 15:57:43 +08:00
Naz
178856cf82 Bootstrapped api version compatibility package
refs https://github.com/TryGhost/Toolbox/issues/292

- Fresh package out of Super Slimer
2022-04-21 15:57:43 +08:00
Renovate Bot
430608c9c3 Update dependency c8 to v7.11.2 2022-04-20 18:23:57 +00:00
Renovate Bot
59795bb312 Update dependency @tryghost/errors to v1.2.11 2022-04-18 21:03:51 +00:00
Renovate Bot
8a29c2d8d9 Update dependency knex to v1.0.7 2022-04-13 12:20:36 +00:00
Renovate Bot
65b91e4895 Update dependency @sinonjs/fake-timers to v9.1.2 2022-04-13 10:09:23 +00:00
Naz
ebc8881d65 Renamed variables to match their content
refs https://github.com/TryGhost/Toolbox/issues/280

- The naming of variables should've been vice-versa. Should make the code less confusing now
2022-04-13 13:30:16 +08:00
Renovate Bot
6804e5d2c6 Update dependency knex to v1.0.6 2022-04-12 11:28:36 +00:00
Naz
129bf04b0e Published new versions
- @tryghost/database-info@0.3.1
 - @tryghost/mw-error-handler@0.2.0
2022-04-08 14:30:50 +08:00
Naz
ee7655213e Added 406 response for outdated Ghost instance
refs https://github.com/TryGhost/Toolbox/issues/280

- When an outdated client receives a 404 as a response there's no clear way to act on it. Plain 404 says nothing about need to update.
- In such cases the resourceNotFound handler should return a 406 error indicating the Ghost instance needs an update.
2022-04-08 12:52:41 +08:00
Naz
88500e0704 Added 406 response for outdated API clients
refs https://github.com/TryGhost/Toolbox/issues/280

- When an outdated client receives a 404 as a response there's no clear way to act on it. Plain 404 says nothing about need to update.
- In such cases the resourceNotFound handler should return a 406 error indicating the client need to update.
2022-04-08 12:40:37 +08:00