Commit Graph

28934 Commits

Author SHA1 Message Date
Daniel Lockyer
348924d431 Updated API framework debug and test names
- these tests have moved from `core/` so the names are no longer
  relevant
2022-08-11 17:44:59 +02:00
Daniel Lockyer
687e68d5de Extracted shared API framework to separate package
refs https://github.com/TryGhost/Toolbox/issues/363

- this API framework is standalone and should be pulled out into a
  separate package so we can define its boundaries more clearly, and
  promote better testing of smaller parts
2022-08-11 17:44:59 +02:00
Daniel Lockyer
9aa5eab5ed Fixed internal shared framework requires
- these requires go outside of the shared folder, and then back in to
  the index.js
- this is confusing and won't work when we pull this code out of core
- this commit cleans up the requires to make them more explicit
2022-08-11 17:44:59 +02:00
Daniel Lockyer
dc0cec56ea Moved settings mappers from shared frame to endpoints
- I'm still not sure where these are meant to be but they don't really
  belong in shared and I'm about to pull that folder out into a separate
  package
2022-08-11 17:44:59 +02:00
Djordje Vlaisavljevic
8daa4afc34 Updated tier preview price terms design
refs https://github.com/TryGhost/Team/issues/1726
2022-08-11 17:13:36 +02:00
Djordje Vlaisavljevic
49abd41af8 Updated button group design
refs https://github.com/TryGhost/Team/issues/1726
2022-08-11 17:06:12 +02:00
Daniel Lockyer
7d52ae52cf Deleted concept of external user
refs https://github.com/TryGhost/Toolbox/issues/363

- AFAICT, this is an outdated and unused concept from when subscribers
  were a thing, but members are now how we do things, and this is causing code
  to linger around that we don't need
2022-08-11 16:05:00 +02:00
Daniel Lockyer
120dee86b3
Refactored permissions.canThis to class structure
- updates the file to modern classes given that Ghost/Node supports them
2022-08-11 15:35:56 +02:00
Djordje Vlaisavljevic
28a69ec5c6 Switched word to lowercase
refs https://github.com/TryGhost/Team/issues/1726
2022-08-11 14:30:22 +02:00
Djordje Vlaisavljevic
2a8c414717 Revert "Switched word to lowercase"
This reverts commit fd69f7fbcc.
2022-08-11 14:27:10 +02:00
Djordje Vlaisavljevic
fd69f7fbcc Switched word to lowercase
refs https://github.com/TryGhost/Team/issues/1726
2022-08-11 14:19:58 +02:00
Daniel Lockyer
42e722d627
Moved Cache-Control middleware to separate package
refs https://github.com/TryGhost/Toolbox/issues/363

- this middleware is standalone and I suspect we're going to be touching
  it further when we work on Ghost's caching in the near future
2022-08-11 14:14:20 +02:00
Rishabh
18cd104510 Updated default trial days on new offer
refs https://github.com/TryGhost/Team/issues/1726

- updates default trial days to 7 for new offers
2022-08-11 17:40:56 +05:30
Rishabh
ae7f39168b Refined member free trial details for canceled subs
refs https://github.com/TryGhost/Team/issues/1726

- shows canceled info for free trial subscriptions on member detail page
2022-08-11 15:47:39 +05:30
Daniel Lockyer
6fc4aa8c4b
Reworked testing and documentation for email-analytics-provider-mailgun
- the tests here were no longer relevant because they were more testing
  things that have been moved to `mailgun-client`
- this commit cleans up the tests to ensure we're passing the correct
  parameters to the mailgun client package
- also adds jsdoc on all the functions and maintains 100% code coverage
2022-08-11 10:30:12 +02:00
Simon Backx
ea86191d1e Bumped comments-ui to v0.6 2022-08-11 10:05:14 +02:00
renovate[bot]
74f1d9240b Update dependency @playwright/test to v1.25.0 2022-08-11 10:04:32 +02:00
renovate[bot]
4daee2a002 Update dependency csso to v5.0.5 2022-08-11 09:30:13 +02:00
Daniel Lockyer
b226065c04
Added mailgun-client test to ensure config values are prioritised over settings
- this is the current functionality of the code, as it has always been,
  but this test ensures we prioritise the values in the config over
  those in settings
2022-08-11 09:10:49 +02:00
Daniel Lockyer
f9b90a3cfe
Added test to check sending emails when Mailgun is not configured
- this tests the early-return path linked to Mailgun not being
  configured
2022-08-11 09:10:49 +02:00
Daniel Lockyer
ddbee90c1c
Fixed bug when checking email batch size
- even though we don't do anything yet, the code was calling `.length`
  on an object, which is `undefined`
- this fixes that by checking the length of the keys
- also moves the code block down so we can early-return if mailgun is
  not configured
2022-08-11 09:10:49 +02:00
Daniel Lockyer
5d177c2a11
Added optional chaining to mailgun-client package
- this helps keep the code clean
2022-08-11 09:10:49 +02:00
Rishabh
f200eeb1ec Wired free trial offers UI in Portal
refs https://github.com/TryGhost/Team/issues/1726

- adds offer page for free trial offers in Portal
2022-08-11 12:09:56 +05:30
Rishabh
c51edc19d9 Fixed lint 2022-08-11 12:03:38 +05:30
Rishabh
728b2d36e1 Updated trial duration validation for new offers
refs https://github.com/TryGhost/Team/issues/1726

- handles negative trial duration to show inline errors in offer creation UI
2022-08-11 12:03:38 +05:30
Rishabh
52e3ae2058 Handled mapping offer to subscription for free trials
refs https://github.com/TryGhost/Team/issues/1726

Free trial offers don't have a Stripe coupon created for them, as the trial is directly added to checkout session. So for mapping a subscription to offer, we pass the offer id directly from checkout metadata to link the subscription in backend with right offer data. This also handles the case where the offer id against a subscription can get overwritten for a subsequent subscription event, as the sub event from Stripe doesn't has the trial offer info.

- handles storing an offer id for a subscription
- updates member detail in Admin to show the offer info for a subscription
2022-08-11 12:03:38 +05:30
Rishabh
7130fc2833 Wired free trial offer UI in offers list
refs https://github.com/TryGhost/Team/issues/1726

- refines UI for a trial offer in offer list
2022-08-11 12:03:38 +05:30
Rishabh
b8acc9ef19 Wired trial offer UI to data
refs https://github.com/TryGhost/Team/issues/1726

- wires creating new trial offers in the Admin UI
2022-08-11 12:03:38 +05:30
Djordje Vlaisavljevic
530da36a9c Added static HTML for free trial offer variant in offers list
refs https://github.com/TryGhost/Team/issues/1726
2022-08-11 12:03:38 +05:30
Djordje Vlaisavljevic
5cf6d212a9 Added static HTML for free trial option to offer creation
refs https://github.com/TryGhost/Team/issues/1726
2022-08-11 12:03:38 +05:30
Daniel Lockyer
3e6416431e
Added test to ensure events are only fetched if configured
refs https://github.com/TryGhost/Toolbox/issues/363

- this adds coverage for a branch in the code, and ensures we don't
  fetch any events if mailgun is not configured
2022-08-11 08:19:03 +02:00
Rishabh
843bbfa55d Handled stripe setup for free trial offers
refs https://github.com/TryGhost/Team/issues/1726

- free trial offers don't need a stripe coupon created for them
- checkout sessions for free trial offers ignore stripe coupon and directly pass the trial days value
- trial days of an offer take precedence over trial days added as default to a tier
2022-08-11 11:04:39 +05:30
Rishabh
66970e5002 Updated offers setup to allow trial values
refs https://github.com/TryGhost/Team/issues/1726

- updates offer setup to allow new `trial` as discount type, was prev only `fixed` and `percent`
- updates offer setup to allow `amount` as free trial days value
- updates offer setup to allow `trial` as discount duration value for trial offers, was prev only `once`/`forever`/`repeating`
2022-08-11 11:04:39 +05:30
Rishabh
27a89d4b0e Updated offers schema to allow free trials
refs https://github.com/TryGhost/Team/issues/1726

- updates offer type validation to include `trial`
- add offer duration validation which includes `trial` for free trial offers
2022-08-11 11:04:39 +05:30
Daniel Lockyer
8a32efac1f
Added further tests to mailgun-client package
refs https://github.com/TryGhost/Toolbox/issues/363

- this copies over tests from `email-analytics-provider-mailgun` that
  are more relevant here
- there is now duplication in tests across the two packages but this
  will be resolved soon
2022-08-10 19:02:53 +02:00
Hannah Wolfe
8e062e22ed
Revert "🐛 Fixed iframe's appearing weirdly in excerpts"
This reverts commit 27d1457a5b.
2022-08-10 17:40:46 +01:00
Hannah Wolfe
27d1457a5b
🐛 Fixed iframe's appearing weirdly in excerpts
- A few users had noticed they get weird content in their excerpts when using e.g. an html block with an iframe
- This use case is common for people embedding podcasts at the top of their posts
2022-08-10 17:38:15 +01:00
Daniel Lockyer
9401d835ce
Moved Mailgun settings test to mailgun-client
- this test checks that the mailgun client respects the changes in
  settings, which is something that we used to ask
  `email-analytics-provider-mailgun` to do when the mailgun client was
  made in that package
- since then, we've pulled it out, so we should move the test to the
  `mailgun-client` library
2022-08-10 18:24:35 +02:00
Daniel Lockyer
98bd5423fa
Added private getConfig function to Mailgun client lib
- the code to get the mailgun info from the config/settings will be used in
  multiple places so this pulls it out into a function
2022-08-10 17:43:19 +02:00
Simon Backx
7414c4dbb7 Added publication attribute to comments helper script
refs https://github.com/TryGhost/Team/issues/1776
2022-08-10 17:34:05 +02:00
James Morris
40d5b213f9 Tweaked the email notifications in the staff profile to look a little less weird
refs https://github.com/TryGhost/Team/issues/1774
2022-08-10 16:13:32 +01:00
James Morris
be7fa97144 Updated the text for emails and followed the same styling as other emails
- Needs some careful testing as emails are a little tricky code wise

refs https://github.com/TryGhost/Team/issues/1770
2022-08-10 16:13:32 +01: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
41d228a1ae
Added copied release assets into .gitignore
- these files are copied into the `ghost/core` folder by monobundle so
  they can be included with NPM, but they shouldn't be in git because
  they'd just be duplicates of the top-level files
2022-08-10 14:19:16 +02:00
Daniel Lockyer
89106bce1c
Added monobundle as a prepack step
- in order to pack the tarball correctly, we need monobundle to run
  beforehand
- up until now, it's the responsibility of the release script to make sure
  to run it before `npm pack`
- this commit ensures it gets run, so the generated .tgz file is valid
2022-08-10 14:19:16 +02:00
Ronald Langeveld
0a03164fe4
Added uploadUrl props to React component (#15208)
no issue
- passes `uploadUrl` to React component as a prop.
2022-08-10 11:57:49 +02:00
Daniel Lockyer
e000c6cca6
Deleted unused schema util
refs 03cbc89a53

- this util was added to fix an issue with the types of columns in
  MySQL, but the issue was back in 2014 (!!)
- we're long past doing it in this way so we'll likely never use it
  again
2022-08-10 10:53:47 +02:00
Rishabh
58f13517d2 Updated member's free trial detail on Portal
refs https://github.com/TryGhost/Team/issues/1724

- refines design for free trial detail for a member on Portal
2022-08-09 21:37:38 +05:30
Daniel Lockyer
509662b52b v5.8.3 2022-08-09 16:02:55 +01:00