Commit Graph

31945 Commits

Author SHA1 Message Date
Hannah Wolfe
62cd52ff98 Improved Sentry server side error reporting
refs: https://github.com/TryGhost/Team/issues/1121
refs: 54574025e0

- The previous change to fall back to a generic error on the server side is resulting in lots of much less useful Sentry reports
- For unexpected errors, change what's sent to Sentry back to context
- This is done by adding a specific code, so we don't have to match on a string that might change
- Also add the error type, id, code & statusCode as tags to the events - these are searchable structured data
- Adding code as a tag also makes it possible to find all errors that showed the generic message
2022-11-23 12:37:24 +00:00
Hannah Wolfe
36b80f2dda Updated sentry to use @tryghost/version
- As demonstrated by my comments in the boot file, I thought sentry was already depending on the version package
- IMO it's undesirable to require package.json directly esp when we have a tool setup and ready for tis
- Added a bunch of tests to show that Sentry does roughly what we think
2022-11-23 12:37:24 +00:00
Kevin Ansfield
d15f740a3f Fixed TaskCancelation errors
sentry issue: ADMIN-AY5

- added guards for cancelation errors where we're casting tasks to promises
- see http://ember-concurrency.com/docs/task-cancelation-help for full details
2022-11-23 10:42:40 +00:00
Elena Baidakova
8d9d22e5a7
Added member API for removing email from suppression list (#15867)
closes TryGhost/Team#2306
2022-11-23 14:41:00 +04:00
Simon Backx
4b4592630f
Added new email batch sending service (#15865)
fixes https://github.com/TryGhost/Team/issues/2284

New batch sending flow (still WIP). Logs the sent emails instead of actually sending them. Unit tests are coming in later commits.
2022-11-23 11:33:44 +01:00
Rishabh
9b0c21e0a2 Populated email table source with existing html data
refs https://github.com/TryGhost/Team/issues/2280

- updates `source` value for all existing rows to contain `html` data for future compatibility with new columns
2022-11-23 15:04:11 +05:30
Rishabh
5780fc2a93 Added new source and source type columns to emails table
refs https://github.com/TryGhost/Team/issues/2280

We are moving away from storing html and plaintext on email and instead will store the email data in source and source_type columns which allows us to store the email in other formats like mobiledoc and lexical. Storing in those formats allows greater flexibility for later html generation

- adds new `source` column that stores `mobiledoc`/`lexical`/`html` data for a newsletter
- adds new `source_type` column that stores one of `mobiledoc`/`lexical`/`html` to identify type of source
2022-11-23 15:04:11 +05:30
Rishabh Garg
d3267dd5b0
Added columns to store error information for email batches (#15859)
closes https://github.com/TryGhost/Team/issues/2290

Currently, if the whole batch of email fails to send we don’t capture
any errors directly tied to the batch. This makes it hard to debug which
and why a batch failed when debugging email errors. Going forward we'll
store the error information for a failing email batch directly that
allows easier debugging for batch.

- `error_status_code` : Captures statusCode returned by Mailgun,
available in error.status from the example batch error
- `error_message` : Captures short error message from Mailgun and
status, available in context object of batch error
- `error_data` : Captures while whole error json for a batch. As
mentioned in pitch, this will be huge data and we’ll figure out long
term how to best use this.
2022-11-23 13:13:49 +05:30
renovate[bot]
e4e8df44dd Update sentry-javascript monorepo to v7.21.0 2022-11-23 12:29:15 +07:00
Hannah Wolfe
682f3a2014 Downgraded express-hbs errors to 400
refs: https://github.com/TryGhost/Team/issues/2289
refs: https://github.com/TryGhost/express-hbs/issues/161

- Themes that resuse layouts as templates trigger horrible errors, which are thrown as 500s
- But there's nothing the server is doing wrong, it's a theme user, so we downgrade these to 400s
- There is more to do here to improve the errors shown, but this is just a first step to ensure that theme issues don't look like server failures
2022-11-22 18:20:33 +00:00
Sam Lord
f6870fa846 Added browser-based testing framework
refs: https://github.com/TryGhost/Toolbox/issues/479

Framework includes:
* command to run tests
* command to record tests
* mechanism for starting and stopping Ghost before and after each suite of tests
* mechanism for loading fixtures into Ghost before starting tests
* sample test for controlling Ghost Admin
2022-11-22 14:12:34 +00:00
Kevin Ansfield
3a9209b6a8 Fixed some minor formatting issues
no issue

- indented conditional template code
- grouped tracked properties together
2022-11-22 13:15:08 +00:00
Kevin Ansfield
f25cc00236 Fixed product card throwing "Cannot read properties of undefined (reading 'url')" errors
closes https://github.com/TryGhost/Team/issues/2295

Problem:
- `<GhUploader>` is not yet converted to an Octane component so it's arguments are not read-only
- when a file is selected it sets it's `files` property which in turn updates the tracked `files` property that was passed in, and then again updates it to an empty file list when the input field is cleared
- that tracked property was never cleared once the product image was uploaded resulting in a "re-upload" attempt with an empty file list every time the product card was put back into edit mode

Fix:
- added a guard in `<GhUploader>` so it doesn't try to upload an empty file list if one is passed in as an attribute
- added a reset of the tracked `files` property in the product card once the image upload is complete
2022-11-22 13:13:42 +00:00
renovate[bot]
955605572e Update dependency testem to v3.10.0 2022-11-22 17:38:30 +07:00
Fabien "egg" O'Carroll
f056614b45 Wired up EmailSuppressionList to MEGA
refs https://github.com/TryGhost/Team/issues/2269

This ensures that we do not send emails to members who's email is on
the email suppression list
2022-11-22 13:26:28 +07:00
Naz
1b526800f0
Added note on package/class naming
no issue

- The name of the "StaffService" is ambiguous and too generic. Lack of good naming makes one to dig into the implementation details figuring out what the service does.
- Should be named a more descriptive way
2022-11-22 11:25:11 +07:00
renovate[bot]
43f5547ae0
Update metascraper to v5.32.1 2022-11-21 15:31:26 +00:00
renovate[bot]
7978bf5a6f
Update dependency cron-validate to v1.4.5 2022-11-21 12:34:38 +00:00
Hannah Wolfe
54574025e0 Improved server-side error handling
refs: https://github.com/TryGhost/Team/issues/1121
refs: dfffa309a8

- This makes a fundamental change to Ghost's server side error handling, so that no unhandled errors are used as API responses
- Anything that has been handled and rethrown as a Ghost error cna be trusted
- We also already trust a couple of known errors from bookshelf and handlebars
- Everything else is assumed to be a code error, and should not be shown as the main message
- Instead we use our generic fallback message and use the OG error as context
2022-11-21 12:13:16 +00:00
Peter Zimon
b0ac096d94 Fixed content importer email on errors
no refs.

- the content importer didn't send emails on unhandled errors
2022-11-21 13:09:33 +01:00
Elena Baidakova
48a47a8289
Removed duplicate icons for events (#15854)
closes TryGhost/Team#2264
2022-11-21 14:50:39 +04:00
Simon Backx
44f189b56a
Added email service package (#15849)
fixes https://github.com/TryGhost/Team/issues/2282

Added a new email service package that is used when the email stability
flag is enabled. Currently not yet implemented so will throw an error
for all entry points (if flag enabled).

Removed usage of `labs.isSet.bind` across the code, because that breaks
the stubbing of labs by `mockManager.mockLabsEnabled` and
`mockManager.mockLabsDisabled`. `flag => labs.isSet(flag)` should be
used instead.

All email depending tests now disable the `emailStability` feature flag
to keep the tests passing + make sure we still run all the tests for the
old flow while the email stability package is being built.
2022-11-21 10:29:53 +01:00
renovate[bot]
96aa1c930c Update dependency @playwright/test to v1.28.0 2022-11-21 15:37:46 +07:00
renovate[bot]
c4e41909a6 Update dependency html-validate to v7.10.0 2022-11-21 15:36:36 +07:00
renovate[bot]
4443f505fe Update dependency concurrently to v7.6.0 2022-11-21 15:36:00 +07:00
Daniel Lockyer
0b386952fb
Deleted .gitignore file in members-api package
- this is no longer needed/wanted as we don't ship types files in the
  members-api package
2022-11-21 14:26:48 +07:00
Ronald Langeveld
c70a1f262d
Added image upload progress to Koenig-Lexical-Editor (#15852)
ref https://github.com/TryGhost/Team/issues/2237

- Adds an upload progress function, to be used with Koenig-Lexical.
2022-11-21 10:52:37 +07:00
renovate[bot]
0c2a62f47c
Update Test & linting packages 2022-11-18 23:04:37 +00:00
Peter Zimon
3cf3e5b5c4 Updated content importer to fail only on errors
no refs.

- the content importer sent an "Import failed" email even if only warnings occured during import
2022-11-18 19:07:03 +01:00
Ghost CI
a3376fe502 v5.23.0 2022-11-18 15:00:50 +00:00
Ghost CI
952df7070c 🎨 Updated Casper to v5.4.1 2022-11-18 15:00:49 +00:00
Simon Backx
6c84e10e46 Added email stability feature flag
no issue
2022-11-18 15:46:18 +01:00
Simon Backx
5c2f0b9a4b
Removed getCreatedEvents and added verification trigger test (#15832)
refs https://github.com/TryGhost/Team/issues/2266

This removes the deprecated `getCreatedEvents` method in the event
repository and adds tests to the verification trigger to see if we don't
break anything.

Changes extracted from https://github.com/TryGhost/Ghost/pull/15831
2022-11-18 15:05:15 +01:00
Simon Backx
2220686113 Sped up comments and feedback tests by reusing Ghost app instance
refs https://ghost.slack.com/archives/C02G9E68C/p1668777066462859

Added a duplicate method to the mmebers agent, so we can reuse the same app instance and options, whenever we need multiple agents (each with their own cookies).
2022-11-18 14:58:35 +01:00
Peter Zimon
bb91bfd1ee Fixed copy bug in content import email
no refs.

- the title and the preview text of the content import email contained the copy from the member import email
2022-11-18 12:58:35 +01:00
Elena Baidakova
696cdea4d9
Add member's email status on member page (#15844)
closes TryGhost/Team#2270
- Show emails status depending on the reason email was blocked
(spam/fail)
2022-11-18 15:55:21 +04:00
Peter Zimon
ab8f16ce79 Updated copy for content import emails
no refs.
2022-11-18 12:49:55 +01:00
Elena Baidakova
9d6bcdba47
Added spam event to feed in frontend admin (#15847)
closes TryGhost/Team#2248
2022-11-18 14:33:48 +04:00
Fabien 'egg' O'Carroll
8283de99c8
Wired up EmailSuppressionList to Members Admin API (#15848)
refs https://github.com/TryGhost/Team/issues/2268

The approach of using the service to lead email suppression data as
opposed to bookshelf relations allows us to wire things up without
having implemented the database. The getBulkSuppressionData allows us to
do this without much of a DB performance hit.
2022-11-18 16:28:13 +07:00
Ronald Langeveld
08232bd538
Cleaned up GA Flags (#15762)
closes https://github.com/TryGhost/Team/issues/2126

- Cleaned up the following GA flags: `newsletterPaywall`, `freeTrial`, `compExpiring`, `searchHelper`, `emailAlerts`, `fixNewsletterLinks`.
2022-11-18 16:09:25 +07:00
Rishabh
33b959257c Released Portal v2.20.1 2022-11-18 14:32:46 +05:30
Rishabh
2487a314f5 Added guard for missing portal plans in portal site data
refs https://github.com/TryGhost/Team/issues/2276

Portal died with an unintelligible error about portal plans/includes being undefined when there was another react error on the page. The other error somehow caused the `site` data to be empty object for Portal, and there was one place where we didn't check for the empty object while transforming the site data which caused the failure.

This change adds the guard for failing check so we don't throw the error in such cases and process as normal.
2022-11-18 14:31:35 +05:30
Fabien "egg" O'Carroll
dd256f3517 Fixed lint for @tryghost/email-suppression-list 2022-11-18 15:06:56 +07:00
Fabien "egg" O'Carroll
9add72ebb1 Fixed tests for @tryghost/email-suppression-list
These were missing and caused the build to fail
2022-11-18 14:59:06 +07:00
Fabien "egg" O'Carroll
cbe1573fd5 Added email-suppression-list service & mock implementation
refs https://github.com/TryGhost/Team/issues/2267

This will eventually be replaced by a Mailgun specific implementation,
but for now we're using mock one which responds with fake data for
local development.
2022-11-18 14:11:47 +07:00
Fabien "egg" O'Carroll
22fe3ec88b Added @tryghost/email-suppression-list package
refs https://github.com/TryGhost/Team/issues/2267

This package contains definitions for the public interface of the
email suppression list as well as an abstract implementation.
2022-11-18 14:06:11 +07:00
renovate[bot]
426c515f83
Update dependency ember-template-lint to v4.18.2 2022-11-18 01:29:10 +00:00
renovate[bot]
313c1788d9
Update dependency mailgun.js to v8.0.6 2022-11-17 22:31:28 +00:00
Hannah Wolfe
dfffa309a8
Improved member importer error handling (#15843)
refs: https://github.com/TryGhost/Team/issues/1121

- This makes several key changes to the way errors are handled in the member importer, to ensure that we only show error messages to users that we wrote.
- Fundamentally, we no longer trust all API errors, and instead only trust a set of very specific API errors. Anything outside of that is replaced with a generic error message.
- Also switches the server-side error generated for email verification (which can throw during member import) to be a HostLimitError, as that is a more appropriate class.
- Note: there are many other parts of Ghost admin that need a similar overhaul, and a similar change we need to introduce server side to fully resolve the underlying issue of bubbling up code errors to the UI.
2022-11-17 19:41:39 +00:00
Peter Zimon
5bb2b2c614 Added modal-import-content to lint todo 2022-11-17 18:15:17 +01:00