Commit Graph

2043 Commits

Author SHA1 Message Date
Naz
623599af1e Moved DomainEvents to be injected to Collections
refs https://github.com/TryGhost/Team/issues/3169

- With the new architecture all possible dependencies should be  injected rather than required directly - this applies to the DomainEvents module as well.
2023-06-27 12:52:10 +07:00
Naz
1fb8fb9bd5 Reduced the amount of events Collections listens on
refs https://github.com/TryGhost/Team/issues/3169

- When a not yet mapped event is produced by Ghost model the posts belonging to a collection are recalculated in a brute-force way. This causes a lot of strain on the database and times out some of the tests. Right now we only care about a handful of events, so limited the ones we listen to and will be uncommenting the rest when we have an optimal mapping/handling for them.
2023-06-27 12:52:10 +07:00
Naz
f74588f9c2 Fixed date filtering in collections
refs https://github.com/TryGhost/Team/issues/3169

- To be able to apply NQL filtering on Collection Posts the dates should be serialized to be ISO Date Strings instead of raw Dates. Otherwise, NQL filtering fails to compare Date with a Date String.
2023-06-27 12:52:10 +07:00
Naz
58a18d37ea Introduced PostEvent classes to make event handling less generic
refs https://github.com/TryGhost/Team/issues/3169

- When handling a single generic event the code becomes riddled with if statements to detect correct "data" that is being passed with the event. Switching to have a domain event per model event helps solving this problem and makes code more readable.
2023-06-27 12:52:10 +07:00
Naz
e7a0462877 Added model event to domain event bridge
refs https://github.com/TryGhost/Team/issues/3169

- To make the coupling to Ghost's model events as loose as possible added a bridge that maps model events to domain events. These domain events it what the collections module can subscribe to to make necessary updates.
2023-06-27 12:52:10 +07:00
Naz
2eb7f7dd25 Updated collections event initialization
refs https://github.com/TryGhost/Team/issues/3169

- Ghost model events should not be crossing emitted to outside libraries. The wrapper code is a "glue code" that can still listen to model events but transforms them to specific format that is useful for the collections module
- This hooks up the Ghost model events and transforms them into a "CollectionEvent" format.
2023-06-27 12:52:10 +07:00
Daniel Lockyer
1bce363bd3
Updated linting and migration comment to improve practices
refs https://github.com/TryGhost/Toolbox/issues/602

- the new regex allows for the filename to contain seconds, which would have
  helped prevent a bug we had with migrations being in the wrong order
- mentioned filename ordering in the migration review comment to bring
  that to the forefront of the mind
2023-06-26 15:29:37 +02:00
Kuba
9601285c3d
Added bulkEmail.batchSize option to configure batch size
refs https://github.com/TryGhost/Ghost/issues/15725

This pull request adds a new configuration option for the Mailgun email
provider that allows the user to set the maximum number of recipients
per email batch via a new config option `bulkEmail.batchSize`
2023-06-26 12:57:44 +02:00
Ghost CI
f716e31122 v5.53.1 2023-06-23 17:50:26 +00:00
Daniel Lockyer
6b89522c76
🐛 Fixed ordering of Collections migrations
fixes https://github.com/TryGhost/Ghost/issues/17125

- both collections migrations have the same timestamp so they're ordered
  based upon their slug name, and the one that creates
  `collections_posts` is ordered before the one that created
  `collections`
- as a result, the migration fails because the table does not exist
- this commit pushes the `collections_posts` migration after the other
  one by bumping the timestamp
2023-06-23 19:36:02 +02:00
Ghost CI
4c72f45676 v5.53.0 2023-06-23 15:12:57 +00:00
Ghost CI
fb8689f10b 🎨 Updated Casper to v5.5.1 2023-06-23 15:12:56 +00:00
Ronald Langeveld
5247d28a80
Added beta of the new Signup Card (#17124)
no issue

Keep an eye on Ghost's changelog (https://ghost.org/changelog/) for the
full feature announcement.


<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at ee03e4d</samp>

This pull request removes the `signupCard` feature flag and enables the
signup card for all users in the Lexical editor. This is part of the
Lexical editor beta release, which is a new editor for Ghost that
provides a better writing experience and more features for content
creators.
2023-06-23 16:59:46 +02:00
Fabien "egg" O'Carroll
bd6e476c57 Added tables to persist Collections
refs https://github.com/TryGhost/Team/issues/3427
2023-06-23 16:11:55 +02:00
Simon Backx
24df9628db
Corrected signup card css for responsive images (#17122)
no issue

The padding for the background image was wrong on smaller devices
2023-06-23 15:36:26 +02:00
Simon Backx
da72f8998e
Updated @tryghost/kg-lexical-html-renderer and @tryghost/kg-default-nodes (#17121)
no issue
2023-06-23 14:35:07 +02:00
Simon Backx
78405a9cb8
Corrected image CORS (#17119)
refs
018f97e679
2023-06-23 14:33:00 +02:00
Sag
9085ae1266
Reduced boilerplate required when building a new Lexical card (#17118)
refs https://github.com/TryGhost/Team/issues/3365

- bumped koenig-lexical, kg-default-nodes and kg-lexical-html-renderer
to a new minor
2023-06-23 13:48:11 +02:00
Simon Backx
c7f5ea4560
Added CSS changes for signup card picture/img elements (#17117)
refs https://github.com/TryGhost/Team/issues/3523

Instead of background images, we now use picture elements (with img
tags).
2023-06-23 13:42:14 +02:00
Michael Barrett
6f5baca849
Add endpoint to record mail events (#16990)
refs https://github.com/TryGhost/Team/issues/3319
2023-06-23 12:22:01 +01:00
Simon Backx
018f97e679
Added Access-Control-Allow-Origin: * to image assets (#17115)
refs https://ghost.slack.com/archives/C025584CA/p1687506966658799
refs https://ghost.slack.com/archives/C04TMVA1D7A/p1687426009256949

This change is required because we otherwise hit CORS issues when admin
tries to load an image and calculate the average color (to determine the
text color).
2023-06-23 11:10:48 +02:00
Daniel Lockyer
55b7bef9ad Fixed disabling search via config
fixes https://github.com/TryGhost/Ghost/issues/16120

- if you set `sodoSearch.url` to `false` in config, it'll currently
  crash because we're not correctly handling the types correctly
- the first part of the fix is ensuring the value is a string so we can
  call `.includes` on it
- second, the `false` value is passed into the output as a string, so we
  should detect if we passed a false value and early return with an
  empty string if so
- credits to https://github.com/ltoinel for the fix inspiration
2023-06-23 10:51:43 +02:00
Sanne de Vries
710d2143c2
Updated signup card background image positioning (#17113)
No ref
2023-06-23 10:27:20 +02:00
Princi Vershwal
5a1dcbc9a5
Removed Bluebird Promise.map from user.js file (#17112)
refs https://github.com/TryGhost/Ghost/issues/14882

Co-authored-by: Princi Vershwal <princi.vershwal@Princis-MacBook-Pro.local>
2023-06-23 10:13:02 +02:00
Daniel Lockyer
08e2fbeacb Removed Bluebird from tests
refs https://github.com/TryGhost/Ghost/issues/14882

- we're moving away from using Bluebird in favor of native Promises, so
  this commit removes nearly all instances from tests
2023-06-23 10:03:03 +02:00
Princi Vershwal
2798d43663
Removed Bluebird Promise.each from db.utils (#17032)
refs https://github.com/TryGhost/Ghost/issues/14882

Co-authored-by: Princi Vershwal <princi.vershwal@Princis-MacBook-Pro.local>
Co-authored-by: Daniel Lockyer <hi@daniellockyer.com>
2023-06-23 09:46:41 +02:00
Princi Vershwal
cc95c39dbb
Removed Bluebird Promise.map from settings.js file (#17086)
refs https://github.com/TryGhost/Ghost/issues/14882

Co-authored-by: Princi Vershwal <princi.vershwal@Princis-MacBook-Pro.local>
2023-06-23 09:16:16 +02:00
Princi Vershwal
d9c739efb7
Removed Bluebird Promise.map from apps index.js file (#17073)
refs https://github.com/TryGhost/Ghost/issues/14882

Co-authored-by: Princi Vershwal <princi.vershwal@Princis-MacBook-Pro.local>
2023-06-23 09:13:29 +02:00
Princi Vershwal
308a3b286a
Replaced Bluebird Promise.mapSeries with sequence util (#17008)
refs https://github.com/TryGhost/Ghost/issues/14882

Co-authored-by: Princi Vershwal <princi.vershwal@Princis-MacBook-Pro.local>
2023-06-23 09:04:37 +02:00
renovate[bot]
c0d32080b7 Update dependency semver to v7.5.3 2023-06-23 07:08:38 +02:00
Simon Backx
9035a87e50 Updated @tryghost/kg-default-nodes and @tryghost/kg-lexical-html-renderer
no issue
2023-06-22 17:07:44 +02:00
Daniel Lockyer
2c067aa1bb Fixed hack to kill Ghost after boot in tests
- in the migration tests we need to boot Ghost and then kill it
  afterwards
- because there was no easy way to do this, the workflow waits for 20s
  and then kills the last process ID
- aside from being a terrible idea, it means we're also just arbitrarily
  waiting for 20s, which burns time when it takes shorter to boot Ghost
- this commit implements an environment variable that will kill the
  server once it has run the whole boot process, and then fixes the
  workflow to use that
2023-06-22 15:32:48 +02:00
Simon Backx
8d6fb51908 Added Playwright tests to comments-ui
refs https://github.com/TryGhost/Team/issues/3504

Not complete yet, but contains the basic structure and a few tests that work and should run in CI.
2023-06-22 15:06:13 +02:00
Simon Backx
ab86e0d901 Removed Sentry and unused data options from comments-ui
refs https://github.com/TryGhost/Team/issues/3504

- Sentry was never setup and we don't use it
- Styles have been moved to inline JS styles (no separate css file generated)
- App version was never used
- Improved current script tag detection
2023-06-22 15:06:13 +02:00
Sanne de Vries
64518d2ad4
Updated signup card frontend styles for contained split layout (#17078)
Refs https://github.com/TryGhost/Team/issues/3459
2023-06-22 12:41:45 +02:00
Ghost CI
caadf7235c Merged v5.52.3 into main 2023-06-21 15:37:59 +00:00
Ghost CI
b7cad4e8fb v5.52.3 2023-06-21 15:37:57 +00:00
Ronald Langeveld
543f3750a7
🐛 Fixed draft pages not saving on forced revisions (#17081)
closes https://github.com/TryGhost/Team/issues/3493

- Fixed pages not saving on force revision. As a side effect, it broke
admin navigation as it doesn't manage to create a new revision upon going back to the pages list.
- This was simply caused by a missing option in the API endpoint config.

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at b646916</samp>

This change enables the `pages` endpoint to handle page revisions by
adding the `save_revision` permission. This is part of a pull request
that adds page versioning and restoring functionality to Ghost.
2023-06-21 13:32:18 +02:00
Hannah Wolfe
6161f94910
Updated to use assert/strict everywhere (#17047)
refs: https://github.com/TryGhost/Toolbox/issues/595

We're rolling out new rules around the node assert library, the first of which is enforcing the use of assert/strict. This means we don't need to use the strict version of methods, as the standard version will work that way by default.

This caught some gotchas in our existing usage of assert where the lack of strict mode had unexpected results:
- Url matching needs to be done on `url.href` see aa58b354a4
- Null and undefined are not the same thing,  there were a few cases of this being confused
- Particularly questionable changes in [PostExporter tests](c1a468744b) tracked [here](https://github.com/TryGhost/Team/issues/3505).
- A typo see eaac9c293a

Moving forward, using assert strict should help us to catch unexpected behaviour, particularly around nulls and undefineds during implementation.
2023-06-21 09:56:59 +01:00
Simon Backx
0c28cebfd4 Updated rate limiting snapshot for updated copy
refs https://ghost.slack.com/archives/C02G9E68C/p1687303342271029
2023-06-21 10:36:53 +02:00
Ghost CI
5dadaea515 Merged v5.52.2 into main 2023-06-21 03:32:58 +00:00
Ghost CI
18a0e173fb v5.52.2 2023-06-21 03:32:56 +00:00
Chris Raible
2568c5898a
🐛 Fixed post scheduling for sites with transferred ownership (#17075)
refs TryGhost/Ghost#3494

- By default, the post scheduler runs as user_id = 1, which is the
original owner of the site
- If ownership has been transferred to a different user, it's possible
that there is no user with id = 1
- In this case, the scheduler would fail to publish a post, because
updating the post using user_id = 1 failed a foreign key constraint in
the post_revisions table
- This commit fixes the issue by checking if the contextUser exists, and
if not, replacing it with the current owner of the site
2023-06-20 19:51:13 -07:00
renovate[bot]
b1bcc2cb2d Update dependency luxon to v3 2023-06-20 15:22:54 +02:00
renovate[bot]
6623572c5b Update dependency socket.io to v4.6.2 2023-06-20 14:40:10 +02:00
Simon Backx
fd2ef61b3c 🎨 Improved copy on too many login attempts
fixes https://github.com/TryGhost/Team/issues/2391
2023-06-20 14:32:04 +02:00
renovate[bot]
d919a9024f Update dependency @extractus/oembed-extractor to v3.1.10 2023-06-20 12:18:09 +00:00
renovate[bot]
e81070762d Update dependency gscan to v4.37.0 2023-06-20 14:04:43 +02:00
Ghost CI
69fddf8abe v5.52.1 2023-06-20 06:54:10 +00:00
Fabien 'egg' O'Carroll
41cbc40353
Moved collections initialisation behind labs flag (#17057)
We ran into an issue where the large `published:true` query was
affecting the boot time of large sites which had knock-on effects with
availability.
2023-06-19 16:40:15 +02:00