Commit Graph

28923 Commits

Author SHA1 Message Date
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
Djordje Vlaisavljevic
f50857afaf Updated copy
refs https://github.com/TryGhost/Team/issues/1757
2022-08-09 16:54:19 +02:00
Kevin Ansfield
9b33587e73
🐛 Fixed Admin UI freezing when interacting with dropdown lists 2022-08-09 16:54:05 +02:00
Fabien "egg" O'Carroll
9dc6e9fcbc Bumped comments-ui version to 0.5.0
This includes fixes to the comment count, and updates it based on local actions.
2022-08-09 15:16:41 +01:00
Daniel Lockyer
cee420d884
Restored eslint plugin compatibility for Node 14.17.0
- `eslint-plugin-ghost` v2.15.0 bumped `eslint-plugin-unicorn` to a
  version that required Node 14.18.0
- we don't support that minimum right now so this commit bumps the Ghost
  plugin which contains a revert to that plugin
2022-08-09 16:01:52 +02:00
Daniel Lockyer
6dde5e40e3
Updated Eslint ECMAScript compatibility to 2022
refs https://github.com/TryGhost/Toolbox/issues/345

- this commit bumps `eslint-plugin-ghost`, which bumps compatiblity to
  2022
- this also removes a lot of the manually-added
  `parserOptions.ecmaVersion` that we had in imported packages, in favor
  of the value set in `eslint-plugin-ghost`
2022-08-09 15:51:40 +02:00
Rishabh
63fc06da28 Added trial info on member subscription
refs https://github.com/TryGhost/Team/issues/1724

- shows free trial info in member detail page for subscription
2022-08-09 19:20:38 +05:30
Fabien 'egg' O'Carroll
43d41e8b0e
Removed deleted and hidden comments from the comment count
refs https://github.com/TryGhost/Team/issues/1763

These should not be included in the count as they do not contain content.
2022-08-09 13:51:13 +01:00
Aileen Nowak
fd9e19ce07 Fixed limit service not allowing explore integration
no issue

- Don't run limit checks for the Ghost Explore integration
2022-08-09 13:15:00 +01:00
Fabien 'egg' O'Carroll
f34740d6d0
Added support for autowrap and class to the comment_count helper (#15203)
refs https://github.com/TryGhost/Team/issues/1760

This allows theme developers to wrap the output of the comment_count
helper in an element, which will only be shown when there is content
to output.

This makes styling a lot easier, as the default output for no comments
is nothing, meaning that separators defined with CSS will not be rendered.
2022-08-09 13:08:36 +01:00
Rishabh Garg
098f40bbe3
Added trial info to member subscription detail (#15193)
refs https://github.com/TryGhost/Team/issues/1757

- exposes trial start and end dates in member's subscription object
- allows portal and admin to show member's trial information in UI
2022-08-09 17:28:00 +05:30
renovate[bot]
ac2ddee8fb Update dependency postcss to v8.4.16 2022-08-09 12:54:15 +02:00