Commit Graph

10661 Commits

Author SHA1 Message Date
Daniel Lockyer
e3223cd9a7 Updated Admin to v5.2.1 2022-06-02 12:34:53 +01:00
Naz
c9758112b3 🐛 Fixed an error when updating a user
closes https://github.com/TryGhost/Team/issues/1655
refs https://github.com/TryGhost/Ghost/commit/4bc14d2c4

- The API should always accept the input it returns. In this case it did not accept the input when it contained an unchanged roles property
- The problem here came from the referenced commit where we can now end up in the situation when the `roleToAssign` is just empty. It was an optimization to prevent a need to do ANY DB operation when none was needed.
2022-06-02 12:13:27 +01:00
Daniel Lockyer
06868f81c6 Updated Admin to v5.2.0 2022-06-01 16:28:51 +01:00
Simon Backx
c32b1baa9b
Added support for publishing email only posts by setting status to sent (#14950)
no issue

If you try to publish a draft email only post by setting the status to sent, you won't receive an error but the email won't get sent. This is because we don't support this behaviour. This is very counter-intuitive when writing the documentation, so I've patched this behaviour and added some more tests.
- When setting the status to `sent` for not email only posts, the post status will be set to `published` without warning
- Also published_by was not set correctly in the past. This is also fixed and has new tests.
2022-06-01 14:53:55 +02:00
Naz
4bc14d2c4b 🐛 Fixed invalid user role assignment
closes https://github.com/TryGhost/Toolbox/issues/351

- When an invalid value was passed in `roles` parameter when editing a user it resulted in incorrect database state (all roles appeared to be unassigned from the user).
- The fix includes ability to set user role by an allowed name, one of:  'Administrator', 'Editor', 'Author', 'Contributor'.
- Also added a validation in case a non-ObjectID value is passed in roles to the users edit method.
2022-06-01 17:48:08 +08:00
Hannah Wolfe
6271e2f5f3 Increased body parser limit to 50mb
refs: https://github.com/TryGhost/Ghost/issues/5998#issuecomment-928981043

- Starting to see more people using long form content and otherwise exceeding the 1mb internal limit
- Setting it to 50mb matches Ghost-CLI's max body for nginx
- It might be ideal at some point to make this configurable, but I think increasing the limit solves the problem very simply for the foreseeable future
2022-06-01 10:12:23 +01:00
Rishabh
c6c64c3aeb Updated single tier labels and subscription error messages
- bumps portal to refine single tier labels
- portal handles/shows custom error messages for failed checkout session creation
2022-06-01 13:44:08 +05:30
Simon Backx
a30e42404b
Added getLazyRelation model helper method (#14943)
closes https://github.com/TryGhost/Team/issues/1626

- getLazyRelation is a safer shorthand for `model.related('relationName').fetch()`
- prevents doing a `fetch` operation on a relation that is already loaded, which can cause issues when `formatOnWrite` has a custom implementation
- uses the already loaded relation if it exists, or loads the relation
- doesn't reload if already loaded
- reload is forceable using the forceRefresh option
2022-05-31 13:21:53 +02:00
Daniel Lockyer
82a60ae155 Fixed detection of Windows environment when connecting to SQLite temp DB
fixes https://github.com/TryGhost/Toolbox/issues/284

- this section of code rewrites `/tmp` in the SQlite filename to the
  temp dir
- the fix was only intended for Windows environments, because they
  typically don't have a `/tmp` dir
- this commit adds a `process.platform` check for Windows
- it also moves the code into the DB connection file instead of the
  config lib
2022-05-30 17:42:34 -04:00
Simon Backx
9d21a14b4b
Added integration test for MEGA.sendEmailJob (#14944)
closes https://github.com/TryGhost/Team/issues/1632
2022-05-30 15:41:02 +02:00
Daniel Lockyer
d9e5092ec5 Updated Admin to v5.1.1 2022-05-30 13:54:28 +01:00
Daniel Lockyer
b86756c36b Updated Admin to v5.1.0 2022-05-27 16:10:19 +01:00
Simon Backx
a051ab3b69
🎨 Reduced favicon requirements and added image formatting (#14918)
fixes https://github.com/TryGhost/Team/issues/1652
fixes https://github.com/TryGhost/Ghost/issues/13319

**Image formatting**
Added support for changing the format of images via the `handle-image-sizes` middleware (e.g. format SVG to png, jpeg, webp)

This change was required:
- Not all browsers support SVG favicons, so we need to convert them to PNGs
- We can't fit image resizing and formatting in the `serve-favicon` middleware: we need to store the resized image to avoid resizing on every request. This system was already present in the `handle-image-sizes` middleware.

To format an uploaded image:
- Original URL: https://localhost/blog/content/images/2022/05/giphy.gif
- To resize: https://localhost/blog/content/images/size/w256h256/2022/05/giphy.gif (already supported)
- To resize and format to webp: https://localhost/blog/content/images/size/w256h256/format/webp/2022/05/giphy.gif
- Animations are preserved when converting Gifs to Webp and in reverse, and also when only resizing (https://github.com/TryGhost/Ghost/issues/13319)

**Favicons**
- Custom favicons are no longer served via `/favicon.png` or `/favicon.ico` (only for default favicon), but use their full path
- Added support for uploading more image extensions in Ghost as a favicon: .jpg, .jpeg, .gif, .webp and .svg are now supported (already supported .png and .ico).
- File extensions other than jpg/jpeg, png, or ico will always get transformed to the image/png format to guarantee browser support (webp and svg images are not yet supported as favicons by all browsers).

For all image formats, other than .ico files:
- Allowed to upload images larger than 1000px in width and height, they will get cropped to 256x256px.
- Allowed uploading favicons that are not square. They will get cropped automatically.
- Allowed to upload larger files, up to 20MB (will get served at a lower file size after being resized)

For .svg files:
- The minimum size of 60x60px is no longer required.

For .ico files:
- The file size limit is increased to 200kb (coming from 100kb)
2022-05-27 16:36:53 +02:00
Hannah Wolfe
03b0139ef9
Allow page to be used as post in dynamic routing
closes: https://github.com/TryGhost/Ghost/issues/10042
closes: https://github.com/TryGhost/Ghost/issues/14206

- the fact that pages are exposed as .page in dynamic routing has never played nicely
- this fix changes nothing in the tests - which shows this was never a covered case
- ideally I should add some tests, but for now this tiny change should prevent a lot of dynamic routing pain
- note, it doesn't remove .page, it just adds .post, so both work
2022-05-27 15:11:34 +01:00
Hannah Wolfe
17bb55118a
Removed completed TODO:
refs: 4fa412c880

- this was done in the referenced commit
2022-05-27 15:11:34 +01:00
Matt Hanley
96ca5252ba Added inviting user's email address as the reply-to address for staff invites
closes https://github.com/TryGhost/Team/issues/1501

- Staff invites previously came from the default site from-address, which is often a noreply
2022-05-27 13:05:29 +01:00
Matt Hanley
2a84712d85 Merged v5.0.2 into main
v5.0.2
2022-05-26 15:24:09 +01:00
Daniel Lockyer
f10f764861 Updated Admin to v5.0.2 2022-05-26 15:17:25 +01:00
Simon Backx
ad349bb3a5
Removed GA feature flags (#14915)
refs https://github.com/TryGhost/Team/issues/1616

- Removed all GA feature flags
- Removed `tweetGridCard` alpha flag
- Changes to `members-api` and `members-importer` packages: https://github.com/TryGhost/Members/compare/%40tryghost/members-api%408.1.1...%40tryghost/members-api%408.1.2
2022-05-26 09:54:30 +02:00
Naz
2a0c1f9fb6 Removed outdated usecase from documentation
no issue

- There is no concept of single author in the codebase, so having it documented doesn't make sense
2022-05-26 10:59:29 +08:00
Naz
783cd1001a Fixed typo 2022-05-26 10:59:29 +08:00
Matt Hanley
648e0894d8 Removed unused getNewsletterRelations method
refs https://github.com/TryGhost/Ghost/pull/14870
refs https://github.com/TryGhost/Members/pull/400

- Since the ref'd PRs, this method is no longer used
2022-05-25 16:51:43 +01:00
Daniel Lockyer
eddd3c36e2 Updated Admin to v5.0.1 2022-05-24 18:21:40 +01:00
Fabien 'egg' O'Carroll
4217e2571f
Included monthly_price,yearly_price&benefits defaults for Content API (#14912)
We have to update the output serializer to only clean includes for the
Admin API, so that these includes aren't stripped for not being in the
original include query param.

This also rejigs the other Content API only logic to sit together in
the input serializer.
2022-05-24 16:38:25 +01:00
Simon Backx
c052652559
Updated settings API to return all settings in edit endpoint (#14889)
refs https://github.com/TryGhost/Team/issues/1650

Since we introduced calculated settings, we need to return all settings when editing a setting, because those calculated settings can change.

- When editing settings, return all the settings. Previously we didn't include the calculated settings (which caused issues with admin not having up to date values for those)
- Updated Stripe <head> script to be injected based on the calculated settings

Required for https://github.com/TryGhost/Admin/pull/2405
2022-05-24 16:42:15 +02:00
Kevin Ansfield
c46303cb2b
🐛 Fixed email analytics crashing when processing unsubscribe/complaint events (#14883)
refs https://github.com/TryGhost/Team/issues/1649

The event handlers for `unsubscribed`/`complained` events originating from Mailgun were still using the now-deleted `member.subscribed` field resulting in errors and aborted attempts at processing the Mailgun event log.

- `member.subscribed` no longer exists, replaced that part of the query with a delete of member<->newsletter association rows from the `members_newsletters` pivot table
- kept the member `updated_at` bump so we have some timestamp record of an update
- added creation of `member_subscribe_event` records for the newsletter unsubscribes to keep stats and history in check
  - the unsubscribed/complained events do or at least should originate from a member action so "member" is more appropriate than "system" even though the event is being handled by an internal system
2022-05-24 12:38:42 +01:00
Hannah Wolfe
cdb365c29d Fixed minor weirdnesses with excerpts
- remove HRs ---- and blockquote > symbols from excerpts
- we want the excerpt to not contain "markdown-like" symbols, but just be plaintext
2022-05-24 12:35:59 +01:00
naz
6cc0c2b76b
🐛 Fixed signing key identificaiton in JWKs
refs https://github.com/TryGhost/Team/issues/1640

- The signing key returned by `GET /ghost/.well-known/jwks.json` was missing an OPTIONAL `use: "sig"` attribute needed to identify it as a signing key in client libraries. E.g. pyton lib: "pyjwt" or node lib: "jwks-client"
- More about the "use" attribute at RFC7515 - https://www.rfc-editor.org/rfc/rfc7515#section-4.1.4
2022-05-24 12:20:30 +01:00
Naz
5569844019 🐛 Fixed page vs post preview template picking
refs 0c097f6532

- When viewed in "preview" context pages resolved to a "post" template instead. The bug was introduced with the referenced commit during post resource's `page` property migration
2022-05-24 15:33:47 +08:00
Naz
4fa412c880 🐛 Fixed page vs post context calculation
closes https://github.com/TryGhost/Ghost/issues/14886
refs 0c097f6532

- The context calculation after referenced change was adding a stray "post" entry into the context, causing the `{{#is "post"}}` helper to fail.
2022-05-24 15:33:47 +08:00
Daniel Lockyer
3e140eb21b Updated Admin to v5.0.0 2022-05-23 13:20:52 +01:00
Hannah Wolfe
8dd009ffa0
🐛 Fixed member exports timing out for large sites (#14876) (#14878)
refs TryGhost/Team#1641

This commit adds a custom query for the members export, to improve the performance and to prevent any timeouts from happening when exporting large amounts of members.

Co-authored-by: Simon Backx <simon@ghost.org>
Co-authored-by: Matt Hanley <git@matthanley.co.uk>
2022-05-20 21:25:23 +01:00
Matt Hanley
eae0a6a3b9
Added products and Stripe data to exports and imports (#14873)
- The migration path from 4.x on SQLite to 5.0 on MySQL requires an export/import
- Exports don't include the Stripe info required to map members to tiers correctly on import. This change fixes that.

Co-authored-by: Simon Backx <simon@ghost.org>
Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
2022-05-20 21:13:58 +01:00
Hannah Wolfe
d6d6841186
Added benefits, offers and snippets to exporter
- These are more things that we should write an importer for
2022-05-20 20:30:55 +01:00
Matt Hanley
f64577b4ce
Added products and Stripe data to exports
- we need to ensure we have this data when exporting so that we can import it later
2022-05-20 20:30:55 +01:00
Simon Backx
b9e520c657
Added bulk destroy options (#14870)
refs https://ghost.slack.com/archives/C02G9E68C/p1652980792270029

- When bulk unsubscribing members, the number of deleted newsletter relations are returned instead of the number of members with newsletters that were cleared
- This commit adds options to the bulk destroy methods.
- You can pass the column on which you want to delete rows in a bulk destroy operation via the `column` option.

Required for https://github.com/TryGhost/Members/pull/400
2022-05-20 12:24:36 +02:00
Simon Backx
def8f83894
Fixed missing products in members export (#14867)
refs https://github.com/TryGhost/Team/issues/1642

- Updated `members-csv` (dependency via `members-importer`, shouldn't this be a separate dependency too?)  package to use the `tiers` field instead of the (removed) products field.
- Added basic test to see if products and labels are returned in the csv.
2022-05-19 18:26:29 +02:00
Rishabh Garg
998584f6e1
Fixed members list filtering on tiers (#14859)
- filtering member list on `tier:tier-slug` was failing as it only accepted member.product column
- member table needed to expand the tier filter to use product naming for filtering to work
2022-05-18 20:58:00 +05:30
Fabien 'egg' O'Carroll
09a516a179
Fixed Stripe Connect (#14857)
refs https://github.com/TryGhost/Team/issues/1637

The `stripe_connect_integration_token` setting is required for the Stripe
Connect flow to work. The existing `stripe_connect_*` settings are also not able
to be edited. So we've updated the allow list to remove those, and add the one
required for the Stripe Connect flow.
2022-05-18 13:27:50 +01:00
Kevin Ansfield
71aa1c58e6 Revert "Cleaned up membersActivityFeed labs flag"
This reverts commit ae3a0e93fc.

- flag is still used in the `@tryghost/members-api` package
- reverting for now pending a more complete commit with a bumped members-api package
2022-05-18 10:31:51 +01:00
Kevin Ansfield
ae3a0e93fc Cleaned up membersActivityFeed labs flag
refs https://github.com/TryGhost/Admin/pull/2309

- the flag was only used in Admin and was cleaned up there a while ago
2022-05-18 10:23:53 +01:00
Kevin Ansfield
227548f004 Cleaned up improvedOnboarding labs flag
closes https://github.com/TryGhost/Team/issues/1421
refs 28ead208b8

- all conditionals in Admin have been removed so the forced-GA flag is no longer required
2022-05-18 10:15:31 +01:00
Matt Hanley
48f1dbc7a5 Added docs for writing new commands 2022-05-17 17:16:44 +01:00
Matt Hanley
99a4e1ea48 Added missing log alias to command 2022-05-17 17:16:44 +01:00
Matt Hanley
236d07c90a
Added CLI command structure (#14821)
Added CLI commands for REPL and timetravel functionality

- Added TimeTravel command for updating test data with a date offset
- Added REPL command for access to models and knex in development
- Added pattern for creating new CLI commands, including
  - User input
  - Output
  - Validation of `NODE_ENV`
- TimeTravel command is in the main Ghost repo because it requires the schema
2022-05-17 15:40:12 +01:00
Simon Backx
8b973dcfaa
Added subscription.price.tier mapping (#14849)
refs https://ghost.slack.com/archives/C02G9E68C/p1652781104970769
refs https://github.com/TryGhost/Team/issues/1145

- subscription.price.product was not mapped yet, but already used in the admin app.
- removes products property from members
2022-05-17 16:38:25 +02:00
Naz
acb3e25ef0 Removed redundant page attribute deletion
refs https://github.com/TryGhost/Toolbox/issues/332

- 'page' property has been dropped completely from the database schema, so there's no need to clean up this model property in the output serializer
2022-05-17 17:21:38 +08:00
Naz
214949fe8c Fixed comment 2022-05-17 17:21:38 +08:00
Naz
1cc3f66d5f Reworked preview controller output
refs https://github.com/TryGhost/Toolbox/issues/332

- With 'page' property being gone from page/post resources we need consistency across internal "preview API" too
- the handling is still hacky as we are exposing the "type" property to the preview pages, which is not exposed through Content API. this a long outstanding issue will have to be handled separately
2022-05-17 17:21:38 +08:00
Hannah Wolfe
8ec8a21b71
Renamed "client" references to "admin"
refs: https://github.com/TryGhost/Toolbox/issues/299

- renamed lots of things that reference Ghost admin as "client"
- these things make even less sense in a post core/client world
2022-05-17 09:05:44 +01:00