Commit Graph

595 Commits

Author SHA1 Message Date
Simon Backx
e540344ef2
Added audience feedback service and storage (#15584)
fixes https://github.com/TryGhost/Team/issues/2049
fixes https://github.com/TryGhost/Team/issues/2053

- This adds a new audience feedback package to Ghost. 
- A new members API to give feedback on posts using the `/api/feedback` endpoint.
- Added a new authentication middleware that supports both uuid-based and session based authentication.
2022-10-11 16:32:28 +02:00
Elena Baidakova
1221ba5d1d
Added feedback_enabled to newsletters table (#15589)
closes TryGhost/Team#2042
- Added ability to enable audience feedback per newsletter (just on BE side).
2022-10-11 16:06:26 +04:00
Simon Backx
74d749fa63
Added members_feedback table (#15581)
fixes https://github.com/TryGhost/Team/issues/2041
2022-10-11 13:21:31 +02:00
Naz
714e108d40
Fixed typo 2022-10-11 17:24:11 +08:00
Naz
9b34bd70a2
Added test coverage for Subscription edit API
refs https://github.com/TryGhost/Team/issues/2047

- We anticipate upcoming changes in the PUT /members/:id/subscriptions/:subscription_id endpoint , so covered it with a snapshot test to track the differences more precisely.
- Note, the test case contains a more explicit outgoing HTTP request mocking.
2022-10-11 17:24:00 +08:00
Daniel Lockyer
9f04475918
Refactored JSON content importer handler to async-await
- this makes the code easier to read and removes an import of Bluebird
2022-10-11 10:22:13 +07:00
renovate[bot]
3b62e8c52f Update sentry-javascript monorepo to v7.15.0 2022-10-11 09:24:03 +07:00
renovate[bot]
aa29478057 Update dependency @playwright/test to v1.27.0 2022-10-11 09:23:33 +07:00
renovate[bot]
9f5ca0ede0 Update dependency jwks-rsa to v2.1.5 2022-10-11 09:23:12 +07:00
John Grisham
c41f431fc7
Added e2e tests for page.added webhook (#15548)
refs: https://github.com/TryGhost/Ghost/issues/15537

- snapshot test created to add confidence to webhook stability and increase overall test coverage.
2022-10-10 19:56:53 +01:00
Fabien 'egg' O'Carroll
dc8617a1e6
Added full flow test for click tracking (#15546)
refs https://github.com/TryGhost/Team/issues/1967

This tests the full flow of publishing a newsletter, and then checking
that clicked links will increase the click count, generate events for
the member which clicked the link as well as the redirects contain the
correct query params.
2022-10-10 10:15:31 -05:00
Daniel Lockyer
8ec071a47c
Update dependency eslint-plugin-ghost to v2.16.0 (#15551)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-10-10 10:23:24 +01:00
Daniel Lockyer
c80d6d5b1c
Updated .eslintignore list for core
- this file path no longer exists
2022-10-10 15:12:52 +07:00
Daniel Lockyer
a37b2cd24e Switched to Husky + lint-staged for git hooks
- up until this commit, git hooks were only used by a handful of people
  because they were a pain:
  - they'd only be set up when you did `yarn setup`
  - the existing hooks ran `yarn lint` on all projects, which was
    incredibly slow
- as a result, not many of us actually had them enabled, but this would
  cause issues in CI because people were pushing un-linted commits
- other JS projects tend to use husky to automate the git hook setup and
  lint-staged to speed up linting on changed files
- this commit switches to using them both
  - `lint-staged` only runs `eslint` on staged JS files that are about to
    be committed - if there's a linting error, it will stop the commit
  - I've configured the pre-commit hook to successfully exit in CI because we
    don't want to run pre-commit hooks right now
- this means we can remove Grunt - yay!
2022-10-10 15:10:48 +07:00
Simon Backx
73f5fd92eb Added audience feedback feature flag
closes https://github.com/TryGhost/Team/issues/2039
2022-10-10 09:27:45 +02:00
Naz
0125f51780
Fixed typo/reference in db schema
refs https://github.com/TryGhost/Team/issues/2030

- There was a typo and a reference to a wrong field in members_stripe_customers_subscriptions schema definition
2022-10-10 14:03:42 +08:00
Daniel Lockyer
75f83718f5
Fixed comment typos in schema definition 2022-10-10 10:58:51 +07:00
renovate[bot]
34439f2e28 Update dependency html-validate to v7.6.0 2022-10-10 10:33:10 +07:00
renovate[bot]
82441e943d Update dependency express to v4.18.2 2022-10-10 10:29:34 +07:00
Ghost CI
b5fd02c9e8 v5.18.0 2022-10-07 16:00:53 +01:00
Ghost CI
a6177b46b5 🎨 Updated Casper to v5.3.2 2022-10-07 16:00:52 +01:00
Aileen Booker
c4188c1a9e
Added Ghost Explore in Ghost as iframe app behind feature flag (#15495)
no issue

- Added Ghost Explore screen behind alpha flag
- Moved existing /explore route to /explore/connect which we'll redirect to for outside requests
- Added iframe communication with Ghost Explore App
2022-10-07 14:32:54 +01:00
Simon Backx
7e3b41f643
Removed emailClicks feature flag (#15556)
fixes https://github.com/TryGhost/Team/issues/2028

Since link clicks became GA, some older components and templates are no longer used.
2022-10-07 14:27:57 +02:00
Daniel Lockyer
9fc830e662
Removed patch from comments-ui version
- we only need to provide the patch if we want to force Ghost to use a
  specific version
- otherwise, we can just use major.minor because we use the tilde
  versioning method
- having the patch version here just encourages you to bump it
  unnecessarily, so removing it cleans up the usage for now
2022-10-07 16:22:16 +07:00
illiteratewriter
a0ec94fbfe
Added e2e test for member.added webhook (#15554)
refs https://github.com/TryGhost/Ghost/issues/15537

- this adds an e2e test and test snapshot for the `member.added` webhook so we can prevent regressions and bugs in the future
2022-10-07 15:54:24 +07:00
Shubhadeep Das
426168f73d
Added e2e test for tag.deleted webhook (#15553)
refs https://github.com/TryGhost/Ghost/issues/15537

- this adds an e2e test and test snapshot for the `tag.deleted` webhook so we can prevent regressions and bugs in the future
2022-10-07 15:50:16 +07:00
Naz
06f6fc11a7
Cleaned up tags e2e webhook test
refs https://github.com/TryGhost/Ghost/issues/15537
refs 4110ffaa2c

- The test had minor formatting issues not worth an extra back-forth during the PR review
2022-10-07 10:20:41 +08:00
Shubhadeep Das
4110ffaa2c Added e2e tests for tag.added webhook (#15537) 2022-10-07 09:46:21 +08:00
renovate[bot]
84549838a4 Update sentry-javascript monorepo to v7.14.2 2022-10-07 08:41:20 +07:00
renovate[bot]
0370dd258d
Update dependency body-parser to v1.20.1 2022-10-06 21:20:56 +00:00
Simon Backx
9d27014aff Reverted change in post email serializer
refs d4540012dc

This was committed by accident
2022-10-06 20:16:02 +02:00
James Morris
e871aabb70 Updated the comments to 0.10.2 2022-10-06 16:39:42 +01:00
Naz
1880c7c1ec
Updated webhook post.published test
refs https://github.com/TryGhost/Toolbox/issues/320

- Added more complex mobiledoc structure in the post.published test to check for correct transformation of special purpose `__GHOST_URL__`. The snapshot has a correct URL transformation, which gives confidence it works properly
2022-10-06 17:51:14 +08:00
Simon Backx
d4540012dc Added tests for click events in the activity feed
fixes https://github.com/TryGhost/Team/issues/2018

- Includes new test fixtures for redirects and click events
- Tests if post, and links are returned in the click events
2022-10-06 11:43:39 +02:00
Daniel Lockyer
7308bb9122
Switched to accessing config loader directly
- I lowered the code coverage on the repo to the point where
  it started failing because I added a new export to the config library
- this wasn't easy to add tests for because the existing config tests
  use the loader directly and not the library export
- instead, I'm just going to make the dev script access the loader, and
  make a note to clean this up in the future when we pull out the config
  module
2022-10-06 16:25:29 +07:00
Daniel Lockyer
0bfbee5523
Fixed yarn dev --stripe ignoring HTTPS configured sites
- because the cwd of `.github/dev.js` is not `ghost/core`, it doesn't
  pick up config.local.json files, so any configuration you set in there
  isn't applied
- this meant that developers with HTTPS configured locally couldn't use
  `--stripe` because it wouldn't configure the Stripe listening URL
  correctly
- this adds an exports to the config lib to allow passing options in,
  which I then utilize to pass the directory that config resides in
- this should fix the aforementioned problem with HTTPS
2022-10-06 15:58:51 +07:00
Naz
78c97d10a6
Improved post's webhook test annotations
refs https://github.com/TryGhost/Toolbox/issues/320

- There noe "roles" attached to the post's author when the 'post.added' event is fired. Webhooks function based of the model events and differ slightly with it's output comparing to the API response. For example, in case of Posts API, there'a an additional 'findOne' call (ref.: https://github.com/TryGhost/Ghost/blob/main/ghost/core/core/server/models/post.js#L1224-L1227) before returning the post to the endpoint handler and then passing that to the output serializer.
- If we want to have 1:1 copy of webhooks outputs and API outputs, we should rethink how we rely on model event data which is never the same as API controller level data.
2022-10-06 10:50:02 +08:00
Naz
4315b21d25
Fixed note copy 2022-10-06 10:26:23 +08:00
Naz
fe1d0e44b4
Moved Ghost agent matcher to common framework
refs a499f866f3
refs d817e5830d

- The user-agent used in outgoing Ghost requests (webhooks mostly) is dependent on the Ghost version - snapshots break if the matcher is not dynamic.
- There will be a few more webhooks tests coming soon, so makes sense to have this matcher moved to a common "framework matchers"
2022-10-06 08:56:10 +08:00
renovate[bot]
57f09fc8b7 Update dependency semver to v7.3.8 2022-10-05 23:34:22 +00:00
renovate[bot]
fa7a582c78
Update dependency knex-migrator to v5.0.7 2022-10-05 15:06:09 +00:00
Simon Backx
a499f866f3 Prevented posts webhook tests from breaking on every release 2022-10-05 14:25:00 +02:00
Simon Backx
f17934a5d2 Updated snapshots for latest release 2022-10-05 14:18:29 +02:00
Daniel Lockyer
c4981a71a2
Merged v5.17.2 into main
v5.17.2
2022-10-05 18:33:12 +07:00
Ghost CI
267f1530f0 v5.17.2 2022-10-05 12:32:04 +01:00
Simon Backx
8900db8614
Fixed snapshots for Portal update
refs e86e78fb6b
2022-10-05 18:11:06 +07:00
Simon Backx
811f37e18a
Bumped used Portal version to v2.14.x
refs eac8fbfdfd
refs e7378520a0
refs https://github.com/TryGhost/Ghost/issues/14508
2022-10-05 18:11:06 +07:00
Simon Backx
41a0945592
🐛 Prevented member creation when logging in (#15526)
fixes https://github.com/TryGhost/Ghost/issues/14508

This change requires the frontend to send an explicit `emailType` when sending a magic link. We default to `subscribe` (`signin` for invite only sites) for now to remain compatible with the existing behaviour.

**Problem:**
When a member tries to login and that member doesn't exist, we created a new member in the past.

- This caused the creation of duplicate accounts when members were guessing the email address they used.
- This caused the creation of new accounts when using an old impersonation token, login link or email change link that was sent before member deletion.

**Fixed:**
- Trying to login with an email address that doesn't exist will throw an error now.
- Added new and separate rate limiting to login (to prevent user enumeration). This rate limiting has a higher default limit of 8. I think it needs a higher default limit (because it is rate limited on every call instead of per email address. And it should be configurable independent from administrator rate limiting. It also needs a lower lifetime value because it is never reset.
- Updated error responses in the `sendMagicLink` endpoint to use the default error encoding middleware.
- The type (`signin`, `signup`, `updateEmail` or `subscribe`) is now stored in the magic link. This is used to prevent signups with a sign in token.

**Notes:**
- Between tests, we truncate the database, but this is not enough for the rate limits to be truly reset. I had to add a method to the spam prevention service to reset all the instances between tests. Not resetting them caused random failures because every login in every test was hitting those spam prevention middlewares and somehow left a trace of that in those instances (even when the brute table is reset). Maybe those instances were doing some in memory caching.
2022-10-05 18:11:06 +07:00
Simon Backx
b96ff6ae4a Fixed snapshots for Portal update
refs e86e78fb6b
2022-10-05 12:52:50 +02:00
Simon Backx
e86e78fb6b Bumped used Portal version to v2.14.x
refs eac8fbfdfd
refs e7378520a0
refs https://github.com/TryGhost/Ghost/issues/14508
2022-10-05 12:47:03 +02:00