Commit Graph

76 Commits

Author SHA1 Message Date
Daniel Lockyer
85098e07d4 Configured all unit tests to use dot reporter
refs https://ghost.slack.com/archives/C02G9E68C/p1696490748701419

- this configures mocha to use the dot reporter because the default is
  way too verbose in CI
2023-10-05 12:24:24 +02:00
renovate[bot]
7dce046786 Update Test & linting packages 2023-07-11 15:26:07 +02:00
Hannah Wolfe
b80b90229f Added consistent linting pattern to all packages
refs: https://github.com/TryGhost/Toolbox/issues/188

- some of our older packages used a pattern for linting which missed using test config for linting tests
- we need this to be consistent so that we can add more eslint rules for testing
- two packages also didn't use the lib pattern, which made the lint pattern error - so this was fixed as well
2023-06-13 10:43:29 +01:00
renovate[bot]
83373e1751 Update Test & linting packages 2023-04-05 15:16:08 +02:00
renovate[bot]
2223db5379
Update Test & linting packages 2023-03-13 02:36:20 +00:00
Daniel Lockyer
6b1966ad9b Updated sinon dependency
- this is being done manually instead of merging the Renovate PR because
  the PR bundles another bump which doesn't pass yet
2023-03-02 12:43:42 +01:00
Simon Backx
923c522778
Implemented email analytics retrying (#16273)
fixes https://github.com/TryGhost/Team/issues/2562

New event fetching loops:
- Reworked the analytics fetching algorithm. Instead of starting again
where we stopped during the last fetching minus 30 minutes, we now just
continue where we stopped. But with ms precision (because no longer
database dependent after first fetch), and we stop at NOW - 1 minute to
reduce chance of missing events.
- Apart from that, a missing fetching loop is introduced. This fetches
events that are older than 30 minutes, and just processes all events a
second time to make sure we didn't skip any because of storage delays in
the Mailgun API.
- A new scheduled fetching loop, that allows us to schedule between a
given start/end date (currently only persisted in memory, so stops after
a reboot)

UI and endpoint changes:
- New UI to show the state of the analytics 'loops'
- New endpoint to request the analytics loop status
- New endpoint to schedule analytics
- New endpoint to cancel scheduled analytics
- Some number formatting improvements, and introduction of 'opened'
count in debug screen
- Live reload of data in the debug screen

Other changes:
- This also improves the support for maxEvents. We can now stop a
fetching loop after x events without worrying about lost events. This is
used to reduce the fetched events in the missing and scheduled event
loop (e.g. when the main one is fetching lots of events, we skip the
other loops).
- Prevents fetching the same events over and over again if no new events
come in (because we always started at the same begin timestamp). The
code increases the begin timestamp with 1 second if it is safe to do so,
to prevent the API from returning the same events over and over again.
- Some optimisations in handing the processing results (less merges to
reduce CPU usage in cases we have lots of events).

Testing:
- You can test with lots of events using the new mailgun mocking server
(Toolbox repo `scripts/mailgun-mock-server`). This can also simulate
events that are only returned after x minutes because of storage delays.
2023-02-20 16:44:13 +01:00
renovate[bot]
13abcf6c9d
Update dependency mocha to v10.2.0 2022-12-12 13:20:22 +00:00
renovate[bot]
8fa9f1e7e6
Update Test & linting packages 2022-11-07 20:39:48 +00:00
renovate[bot]
e9587e02d0
Update dependency mocha to v10.1.0 2022-10-17 08:41:28 +00:00
renovate[bot]
2c2ee81adb
Update Test & linting packages 2022-10-05 00:36:08 +00:00
Daniel Lockyer
f51226e5fb Organized package dependencies
- cleaned up unused dependencies
- adds missing dependencies that are used in the code
- this should help us be more explicit about the dependencies a package
  uses
2022-08-18 11:55:49 +02:00
Daniel Lockyer
54aa9f016b Fixed full Admin test suite running during unit tests
- because of how the npm scripts were set up, we were running the full
  Admin integration tests during the unit tests phase of CI
- this commit renames the majority of `test` to `test:unit` in the
  package.json files, and aliases `test` to `test:unit`
- special packages like Admin have no-op'd `test:unit` scripts so we
  don't end up running its tests
2022-08-15 15:34:52 +02:00
Daniel Lockyer
bf254b9c6a Extracted Mailgun client to separate package
refs https://github.com/TryGhost/Toolbox/issues/363

- this commit pulls all code involving the Mailgun client SDK into one
  new package called `mailgun-client`
- this means we should be able to replace `mailgun-js` (deprecated) with
  `mailgun.js` (the new, official one) without editing code all over the
  place
- this also lays some groundwork for better testing of smaller
  components
2022-08-10 17:12:37 +02:00
Simon Backx
82a3133ace
Added replies/likes count and limited replies to comments (#15206)
refs https://github.com/TryGhost/Team/issues/1723

- Added count.replies to comments
- Added replies endpoint
- Limited returned replies to 3.
- Replaced likes_count with count.likes in comments
- Instead of fetching all the likes of a comment to determine the total count, we'll now use count.likes
- Instead of fetching all the likes of a comment to determine whether a member liked a comment, we'll now use count.liked (which returns the amount of likes of the current member, being 0 or 1). This is mapped to `liked` to make it more natural to work with.

The `members.test.snap` file changed because we no longer include `liked: false` if we didn't fetch the liked relation. And in the comments events of the activity feed the liked property is therefore removed.

These changes requires an update to the `bookshelf-include-count` plugin:
- Updated to also work for nested relations
- This moves the count queries from the `bookshelf-include-count` plugin to the `countRelations` method of each model.
- Updated to keep the counts after saving a model (crud.edit didn't return the counts before)
2022-08-10 16:12:35 +02:00
Daniel Lockyer
a9cffd9550
Pinned all dependencies
- we should pin all dependencies so we know what is getting shipped in
  the application
2022-07-27 08:44:50 +02:00
Daniel Lockyer
61125d7605
Removed repository from component package.json files
refs https://github.com/TryGhost/Toolbox/issues/354

- these repository links made sense when they were in different repos
  and published to NPM but we don't publish these packages any more
- this commit deletes those keys from the files
2022-07-25 11:15:16 +02:00
Daniel Lockyer
17bf358b47
Pinned internal packages
- we're going to be pinning all dependencies within the monorepo
- this shouldn't change anything anyway because we're using the same
  version across all packages
2022-07-21 16:35:19 +02:00
renovate[bot]
d228144c27 Pin dependencies 2022-07-21 16:27:57 +02:00
Daniel Lockyer
48fd5ca8cb
Removed posttest linting step
- linting is done as a separate step in CI and it's a git hook upon
  pushing locally, so we don't need to run it after tests
2022-07-21 10:09:36 +02:00
Daniel Lockyer
08779bc977
Fixed version of email-analytics-service within email-analytics-provider-mailgun
- this was missed during the migration but needs to happen so the
  packages are linked and re-used
2022-07-20 18:00:17 +02:00
Daniel Lockyer
ed1bdac20c
Removed publicConfig from packages config
- this was leftover from the migration to the monorepo and won't be
  needed because we're not publishing the packages
2022-07-20 17:49:52 +02:00
Daniel Lockyer
9fa789159c
Reset Publishing packages version and visibility
refs https://github.com/TryGhost/Toolbox/issues/354

- these packages are here for development and will be bundled when
  published, so they don't need versioning nor publishing
2022-07-20 17:20:24 +02:00
renovate[bot]
0fdbba9dbd Update Test & linting packages 2022-07-19 20:05:27 +00:00
renovate[bot]
79b0e7a3a2 Update dependency nock to v13.2.8 2022-06-30 21:37:04 +00:00
Renovate Bot
fd118f1fe2 Update dependency nock to v13.2.7 2022-06-15 03:55:13 +00:00
Renovate Bot
47e3a3253f Update Test & linting packages 2022-06-03 23:36:05 +00:00
Matt Hanley
c11b0e822d Published new versions
- @tryghost/custom-theme-settings-service@0.3.3
 - @tryghost/email-analytics-provider-mailgun@1.0.9
 - @tryghost/email-analytics-service@1.0.7
2022-05-12 16:42:53 +01:00
Renovate Bot
a5174ff250 Update dependency sinon to v14 2022-05-09 02:31:27 +00:00
Renovate Bot
7d25bbec89 Update dependency mocha to v10 2022-05-02 00:44:17 +00:00
Renovate Bot
62af5754d0 Update dependency sinon to v13.0.2 2022-04-14 04:48:38 +00:00
Daniel Lockyer
3ecc15e02f Published new versions
- @tryghost/custom-theme-settings-service@0.3.2
 - @tryghost/email-analytics-provider-mailgun@1.0.8
 - @tryghost/email-analytics-service@1.0.6
2022-03-24 10:46:59 +00:00
Renovate Bot
1a1453dc34 Update dependency mocha to v9.2.2 2022-03-11 17:39:51 +00:00
Daniel Lockyer
f4e24a76e2 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:34:08 +01:00
Renovate Bot
171e15bd13 Update dependency mocha to v9.2.1 2022-02-21 00:48:38 +00:00
Renovate Bot
a08c253581 Update dependency nock to v13.2.4 2022-02-04 19:13:01 +00:00
Renovate Bot
73081dc561 Update dependency nock to v13.2.3 2022-02-03 20:27:52 +00:00
Renovate Bot
8b4be67e21 Update dependency sinon to v13.0.1 2022-02-01 15:42:48 +00:00
Renovate Bot
9223d9d1ae Update dependency sinon to v13 2022-01-31 00:29:57 +00:00
Renovate Bot
0da6639d63 Update dependency mocha to v9.2.0 2022-01-24 12:09:30 +00:00
Renovate Bot
1fd73d9429 Update Test & linting packages 2022-01-20 16:21:37 +00:00
Renovate Bot
6581561f55 Update dependency nock to v13.2.2 2022-01-20 14:22:41 +00:00
Renovate Bot
d8196129cb Update dependency mocha to v9.1.4 2022-01-14 20:50:48 +00:00
Joe Grigg
fc4fcfdcc3 Updated references to master branch to point to new default main branch
refs https://github.com/TryGhost/Toolbox/issues/162
2022-01-10 13:33:00 +00:00
Sam Lord
303ca79832 Published new versions
- @tryghost/email-analytics-provider-mailgun@1.0.7
2021-12-06 11:35:57 +00:00
Sam Lord
f477e88a0f Update @tryghost/logging in Mailgun provider to v2
refs: https://github.com/TryGhost/Toolbox/issues/146

This allows the mailgun provider to run inside a job and talk to the parent process for logging.
2021-12-06 11:33:52 +00:00
Sam Lord
a2a1144bf7 Published new versions
- @tryghost/email-analytics-provider-mailgun@1.0.6
 - @tryghost/email-analytics-service@1.0.5
2021-12-02 12:27:45 +00:00
Sam Lord
a96cf1a39a Use @tryghost/logging package instead of injected argument
refs: https://github.com/TryGhost/Toolbox/issues/146
2021-12-02 12:26:23 +00:00
Kevin Ansfield
8eeefab2e1 Published new versions
- @tryghost/custom-theme-settings-service@0.3.1
 - @tryghost/email-analytics-provider-mailgun@1.0.5
 - @tryghost/email-analytics-service@1.0.4
2021-10-26 10:15:36 +01:00
Renovate Bot
399e9e0239 Update dependency nock to v13.1.4 2021-10-21 15:25:16 +02:00