Commit Graph

10258 Commits

Author SHA1 Message Date
Kevin Ansfield
00195b5bc4 Merged v4.36.3 into main 2022-02-22 10:28:55 +00:00
Daniel Lockyer
7a9c80a771 Updated Admin to v4.36.3 2022-02-22 10:25:09 +00:00
Djordje Vlaisavljevic
2c5643623d Added the "selectablePortalLinks" feature flag
refs https://github.com/TryGhost/Team/issues/1096
2022-02-21 16:46:15 +01:00
Hannah Wolfe
5bf12939e4
Updated eslint-plugin-ghost & fixed resulting failures
- I recently added a bunch of strict rules to our eslint plugin around returns: ca9af37866
- These mostly are issues that occur whilst writing code, that you spot and fix as you're developing, but they're annoying to notice/find and eslint can be used to flag them quickly
- There are of course, edge cases where you don't need to return from array fns, but this rule also suggests better patterns might be available
- For our excert helper and new assertEvent helper, I've updated the code to use simpler patterns that are easier to read, so as to avoid the warnings
- For our old API I've simply disabled the rule as we're about to delete this code
2022-02-21 12:30:12 +00:00
Kevin Ansfield
2f7456790e Added membersLastSeenFilter labs flag
refs https://github.com/TryGhost/Team/issues/1307

- flag for gating `members.last_seen_at` API property and associated filtering in Admin
2022-02-21 11:48:23 +00:00
Daniel Lockyer
ddaa4ee5e1 Removed unnecessary checks during initial DB init
refs https://github.com/TryGhost/Toolbox/issues/202

- during DB init, we have to create all the tables
- right now we loop over all tables and call the `createTable` command
  - this command checks if the table exists and if not, creates the table
  - this works fine but it means we query the database for every table
  - in MySQL, we query the information_schema table, which we've seen
    issues with before because it doesn't have indexes
- the smarter thing to do here is to get all the tables that already exist,
  remove them from the list, and just straight up create them without
  further checks
- this entire thing should be protected by the migration lock so we
  shouldn't encounter issues from multiple processes initializing the DB
  and tables existing after the initial check
- this commit also removes the check from `createTable` because this isn't
  really needed. We should be using the migration utils, which do
  check for existing tables. I've added a note to the function and
  audited anywhere we still call the function
- this commit removes (- 49 tables + 1 initial check) 48 queries from
  the initial DB init
2022-02-21 08:44:40 +01:00
Naz
8f17c1683d Added test-specific default-settings.json configuration
refs https://github.com/TryGhost/Toolbox/issues/214

- Having this config for test environment allows to pre-populate default settings values in the settings table
- Right now the default-settings.json is an exact copy of the original "/data/schema/default-settings/default-settings.json". Having a starter file as an exact copy, allows to track the differences between environments as they are introduced easier
2022-02-21 20:06:20 +13:00
Naz
4700b14d93 Made default settings file location configurable
refs https://github.com/TryGhost/Toolbox/issues/214

- The values configuration for the settings table need to become configurable to be able to run our test environment with a pre-defined set of configurations (e.g Stripe-related values).
- This change makes it possible to define the default settings file location (currently a JSON)
- A new key is now exposed through the "paths.defaultSettings" key in settings, which can be overloaded for the needs of the environment
2022-02-21 20:06:20 +13:00
Naz
7f0bf62ec9 Renamed defaultSettings to defaultRouteSettings
refs https://github.com/TryGhost/Toolbox/issues/214

- The `defaultSettings` path name in the config (one pointing to routes yaml file) creates confusion with the `defaultSettings` which populate defaults for  in the database settings table.
- Furthermore, the name collision creates a problem when trying to make database default settings dynamic - being able to load them from configurable file path.
- Rename makes "routing" explicit to avoid ambiguity and free up the name for the database defaults
- The value seems to be safe to be renamed as all keys used in `overrides.json` are taking priority - the name "defaultRouteSettings" hasn't surfaced at any point in the git history
2022-02-21 20:06:20 +13:00
Fabien 'egg' O'Carroll
9c5c41b927
🐛 Fixed welcome pages not working for "subscribe" links (#14176)
- Fixed test fixtures so that members with subscriptions also have products/tiers
- Fixed test fixtures so that default&free tiers can be updated for tests
- Added tests for the signin functionality and welcome page redirects
- Extended `setupStripe` to setup other Members settings - this needs some more
  thought around how we proceed
2022-02-20 16:02:42 +02:00
Daniel Lockyer
2e9d15d115 Updated Admin to v4.36.2 2022-02-18 16:00:29 +00:00
Daniel Lockyer
3ad871b21e
Added handler for unhandled rejections
refs https://github.com/TryGhost/Toolbox/issues/163

- as of Node 15, unhandled rejections will exit the process so if
  Ghost is running on Node 15+ and encounters one, it will kill Ghost
- if Sentry is enabled, it will add a handler for the event that will
  send it to Sentry but the logging is sent to stdout/stderr, which means
  we lose it in Ghost logs
- this commit adds a process handler for the `unhandledRejection` event
  which will log the reason to Ghost logs and prevent Ghost from
  exiting
2022-02-18 10:35:36 +01:00
Hannah Wolfe
d1e5ccae14
💡 Pinned frontend API version to canary
- Ghost themes are allowed to define the API version they want to use, but this concept has never really worked correctly
- We have a theory that it doesn't ever do quite what people want, and so always loading latest would not really break anything - this commit tests that theory
- We're pinning to canary, as we're aiming to get rid of the concept of versions altogether
- I could have done return config.get('api:versions:default');, but this actually returns v4 (although the same as canary, conceptually different)
  and it also seemed like an unnecessary level of indirection. This change should be easy to understand and to revert if we are wrong
2022-02-17 17:55:55 +00:00
Matt Hanley
4b47d376ec Merged v4.36.1 into main
v4.36.1
2022-02-16 15:25:03 +00:00
Daniel Lockyer
95371ee71a Updated Admin to v4.36.1 2022-02-16 15:23:42 +00:00
Fabien "egg" O'Carroll
f88b6bd02f 🐛 Fixed Stripe checkout session urls being invalid
refs https://github.com/TryGhost/Team/issues/1322

Since the Members service is no longer started when Stripe is
reconfigured the url config used for checkout sessions was not updated.

This moves all of the default Stripe urls into the Stripe service, where
they will be updated as/when Stripe is connected/disconnected.
2022-02-15 12:50:07 +02:00
Thibaut Patel
e59ee38d21 Updated the authentication test
no issue

- Mocked the github url with nock to avoid network usage during regression testing
- Added logging when the theme install fails during setup
2022-02-14 18:22:53 +01:00
Djordje Vlaisavljevic
82eec9f6a5 Added membersTableStatus feature flag
refs https://github.com/TryGhost/Team/issues/1035
2022-02-14 13:00:04 +01:00
Hannah Wolfe
0ab2f36c22
Added settingsCache handling to e2e-framework
refs: https://github.com/Ghost/Ghost/commit/b5ee17b25

- When moving the site tests into e2e-api they broke because they were getting the changed settings value from the settings test
- The solution is to ensure the settingsCache is reset between tests, which is what this commit does
- This commit also renames the shutdown method to reset, because this is not a permanent operation
- It also renames the resetDb method to resetData, because the concept is we want the internal data to be reset, not just the DB
2022-02-11 16:24:24 +00:00
Daniel Lockyer
4026150062 Updated Admin to v4.36.0 2022-02-11 16:00:27 +00:00
Hannah Wolfe
9375a1701a
Revert "Fixed theme storage getting confused between tests"
This reverts commit 3e7039c47d.
2022-02-11 11:09:21 +00:00
Fabien "egg" O'Carroll
46db240bf9 🐛 Fixed welcome pages for paid signups
no-issue

The way we choose which email to send is too tightly coupled with the
magic link generation, which meant that when we added the new paid
signup email, the magic link looked like <url>?action=signup-paid rather
than <url>?action=signup - our welcome page logic was working off of
only using welcome pages for action=signup and so this broke.
2022-02-11 13:08:07 +02:00
Fabien "egg" O'Carroll
3a0fa8d7d8 🐛 Fixed welcome pages when Tiers is enabled
no-issue

The welcome pages feature was moved behind a separate flag and this part
of the code was not updated.
2022-02-11 13:08:07 +02:00
Hannah Wolfe
3e7039c47d
Fixed theme storage getting confused between tests
- When starting ghost for e2e tests we create a content folder in the os tmp dir
- This means that the folder can change between suites as ghost is started and restarted
- For the most part this is fine, but theme storage caches the path to config (which makes sense, it's not meant to change whilst Ghost is in-memory)
- This is a quick-n-dirty fix that just makes it possible to update that path in the tests, so we know it's in sync
- Ideally we'd not cache the path, use a function to fetch it etc, or fully reset the theme storage layer, but this is the fix I have working today
     and so it's going in to unblock things for now
2022-02-11 10:37:37 +00:00
Rishabh
3ccd3601b3 🐛 Fixed post content gating error for themes using old api
refs https://github.com/TryGhost/Team/issues/1071

We switched to using tiers pivot table that stores list of tiers with access to post when visibility is set to `tiers`. For themes using v3 API while having posts restricted to specific tiers visibility, the post data will not include the list of tiers, which caused an unexpected error while trying to determine post access from tiers list. This change blocks access to post if specific tiers visibility is enabled without data available for list of tiers on post.
2022-02-11 12:26:19 +05:30
Thibaut Patel
a1edff4b0c Fixed linting issue
refs 26c6238c3b
2022-02-10 12:25:57 +01:00
Thibaut Patel
26c6238c3b Released to GA the theme parameter in the /authentication/setup route
refs daeb06e835

- This is an additive change, and the parameter is optional so it's better to ship it right away (testing was hard as it's a chicken and an egg problem to have a feature flag in the setup route).
2022-02-10 12:21:28 +01:00
Djordje Vlaisavljevic
c308d00235 Added tierName feature flag
refs https://github.com/TryGhost/Team/issues/1069
2022-02-10 11:40:28 +01:00
Thibaut Patel
479df36a48 Added the last_seen_at column to members
refs https://github.com/TryGhost/Team/issues/1304

- This migration adds a column to store when a members was last seen
- The utils.js e2e test file was refactored according to the commit 06dd9bac59
2022-02-09 11:57:45 +01:00
Kevin Ansfield
59c0d4b4e4 Added Sentry error capture for failed email update after sending is complete
refs https://github.com/TryGhost/Team/issues/1321

- when updating the Email record after submitting all email batches we have a `catch` call but it was only logging the error
- added a call to Sentry so there's more visibility if those saves fail
2022-02-08 18:36:14 +00:00
Daniel Lockyer
94f5add1c0 Refactored default settings population to reduce unnecessary DB queries
refs https://github.com/TryGhost/Toolbox/issues/202

- this code suffers from two problems:
  - when we don't have any new settings to insert, we still end up
    fetching the columnInfo and owner info, even though we only need
    them if we're inserting data. This results in 3 extra queries upon
    boot
  - secondly, we insert every setting with a separate query - MySQL and
    SQLite both support batch inserts and knex has a utility to help us
    that I've [used
    before](38821c5242).
    With 95 settings at the time of writing, this adds 94 extra queries
    during the DB init
- this commit refactors the code so that we only fetch the columnInfo and
  owner data if we've got new settings to insert, and batches the
  inserts using knex's batchInsert util
- this query results in ~95 less queries during DB init and saves a
  couple of queries during boot
2022-02-08 10:11:00 +01:00
Torsten Zander
f1b71f7fd7
🐛 Fixed AssetHelper not working with svg (#13978)
loses TryGhost#13971

This fixes an issue with links containing # anchor. It makes sure the # part is at the end of the url like url?v=hash#anhor

Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
2022-02-07 15:07:18 +00:00
Daniel Lockyer
af240816d8 Added eslint exemption for camelcase line
no issue

- the new eslint bump seems to flag this line up for using camelcase
- i'm not sure why this hasn't flagged before but it seems we want to
  keep the naming because the function name has the same linting exemption
2022-02-07 13:16:05 +01:00
Thibaut Patel
daeb06e835 Added a theme parameter to the /authentication/setup route
refs https://github.com/TryGhost/Team/issues/1296

- The `theme` must be a github `org/repo` string
- This uses the internal API instead of the services because the API has extra implementation details not present in the services.
2022-02-07 12:03:40 +01:00
Daniel Lockyer
54829a4bb8 Updated Admin to v4.35.0 2022-02-04 16:00:26 +00:00
Rishabh Garg
f3119cbf77
Handled default value in post for specific tier content visibility (#14121)
refs https://github.com/TryGhost/Team/issues/1071

Default visibility for a post when set to specific tiers needs special handling as data for specific tiers is stored as an array of tiers on a pivot table. This change handles the default visibility for a new post when set to specific tiers to generate the right default values in model.
2022-02-04 21:00:08 +05:30
Rishabh Garg
744e5e57a0
Fixed missing portal product data (#14115)
closes  https://github.com/TryGhost/Team/issues/1311

For some sites, the `portal_products` array was created without any value and due to a possible bug in older version of Ghost, it also didn't get filled on Stripe connect with default product. This causes a side-effect of sites not showing the prices in Portal when tiers beta is enabled or is out as GA. This change populates the missing product data in `portal_product` for sites that have a single tier (haven't enabled tiers beta), as they right now don't have an option to hide the tier.
2022-02-04 19:57:38 +05:30
Rishabh
c99ee980af Added migration to transform default tiers visibility from nql string
refs https://github.com/TryGhost/Team/issues/1071

Default content visiblity for specific tiers is now stored split between `default_content_visiblity` and `default_content_visibility_tiers` setting, with former storing the value as `tiers` and the latter stores the list of tiers that the visibility is restricted to. This migration transforms all existing sites that have default visibility stored as an NQL string from previous versions to follow the new model and store correctly on the new setting.
2022-02-04 19:56:11 +05:30
Rishabh
6f89ccf901 Added default_content_visibility_tiers setting for default tiers visibility
refs https://github.com/TryGhost/Team/issues/1071

Default content visibility for a post can be one of `public|members|paid|tiers`, where `tiers` denotes visibility restricted to specific tiers. This change adds a new setting to store the tier ids when default content visibility is set to `tiers`. This closely matches how the visibility is stored on `posts` table as well, with `visibility` stored as `tiers` and tiers data is stored on tiers pivot table.
2022-02-04 19:56:11 +05:30
Fabien 'egg' O'Carroll
d60d24e744
Migrated email filter columns from VARCHAR to TEXT (#14091)
refs https://github.com/TryGhost/Team/issues/1287

Currently we have a hard limit of how large an email filter can be,
which is very restrictive once a site starts using Tiers - by moving
toward a TEXT column, we essentially give the filters unlimited size.

This currently doesn't handle SQLite as there are no limits on VARCHARS
in SQLite.

The down migration is a loop so we don't have to handle values larger than
50 characters
2022-02-04 16:09:35 +02:00
Daniel Lockyer
a1166d575f
Updated migration logging string for correctness
no issue

- we check the presence of `members_free_signup_redirect` here but the
  log line said `members_paid_signup_redirect`
- this must have been missed in review but it's simple enough to fix
2022-02-04 12:54:11 +01:00
Sam Lord
92c3e8d7ca Added source to the verification trigger
no issue

Helps us to tell the difference between a verification trigger caused by import vs API
2022-02-03 16:20:37 +00:00
Matt Hanley
48bcb36adc Merged v4.34.3 into main
v4.34.3
2022-02-02 16:02:54 +00:00
Daniel Lockyer
2b5986c2bd Updated Admin to v4.34.3 2022-02-02 15:42:32 +00:00
Matt Hanley
6d4538cc2b Updated wording on unsubscribe confirmation with paid conditional
refs https://github.com/TryGhost/Team/issues/1228

- We were displaying a message referencing paid subscriptions to all users, which was causing confusion
- We don't have the `member.paid` flag in this context, so we use the match helper on member.status not free
2022-02-02 12:36:41 +00:00
Daniel Lockyer
fd69899b9f
Merged v4.34.2 into main
v4.34.2
2022-02-01 16:08:47 +00:00
Daniel Lockyer
4714a95748 Updated Admin to v4.34.2 2022-02-01 15:30:00 +00:00
Sam Lord
c7e0cc0bf2
Fixed the TPL variable name used for verification trigger
no issue

- not nice but it get the job done for now
2022-02-01 15:20:20 +00:00
Daniel Lockyer
805bb0b87a
Fixed variable scoping issue with email verification
no issue

- `this` isn't referring to the correct `this` in this scope, and the
  library is an import of the file anyway, so this fixes the undefined
  function call as a result
2022-02-01 13:54:13 +00:00
Sam Lord
c3eb3cd567 Fix imports triggering verification when below threshold
no issue

Swapped the variable names for importSize and importThreshold
2022-02-01 12:07:37 +00:00
Sam Lord
77f2acaf65 Fix usage of "ghostMailer" in email verification trigger
no issue

Introduced bug when refactoring the verification trigger by referencing an undefined member.
2022-02-01 12:07:32 +00:00
Sam Lord
c9ac6deb9b Fix imports triggering verification when below threshold
no issue

Swapped the variable names for importSize and importThreshold
2022-02-01 12:04:39 +00:00
Sam Lord
6d38a66662 Fix usage of "ghostMailer" in email verification trigger
no issue

Introduced bug when refactoring the verification trigger by referencing an undefined member.
2022-02-01 12:00:01 +00:00
Nicholas Scalf
da799997c2
Added alt tag for logo image on emails (#13953)
fixes: https://github.com/TryGhost/Ghost/issues/12871

- This Ghost recommended email scanner, mail-tester.com, reports not having this alt as having an impact of -0.5 out of 10 on your email score.
2022-02-01 11:29:17 +00:00
Fabien 'egg' O'Carroll
155ee6055d
Migrated redirect settings to welcome_page_urls (#14083)
refs https://github.com/TryGhost/Team/issues/1168

This migrates the existing settings onto the Tier objects, so that users
with Tiers enabled can seamless move from global settings to Tier level
settings - without losing/modifying data/functionality.
2022-02-01 11:00:13 +02:00
Daniel Lockyer
dd7227d622
Merged v4.34.1 into main
v4.34.1
2022-02-01 08:58:24 +00:00
Daniel Lockyer
c317b22005 Updated Admin to v4.34.1 2022-02-01 08:50:37 +00:00
Rishabh
93596a1375 Updated frontend routing to include products for page/post
refs https://github.com/TryGhost/Team/issues/1071

- `products` relation is needed on post/page to tackle custom tiers visibility, this change attaches `products` as default include for frontend controllers
2022-02-01 11:13:51 +05:30
Rishabh
15d692dc01 Updated frontend helpers to handle tiers visibility
refs https://github.com/TryGhost/Team/issues/1071

- visibility handling for posts/pages with restricted tiers access has changed, this change updates frontend helpers
2022-02-01 11:13:51 +05:30
Rishabh
b259bb2431 Updated content gating to use new tiers visibility
refs https://github.com/TryGhost/Team/issues/1071

- `tiers` are now attached as a list on post with restricted tiers access
2022-02-01 11:13:51 +05:30
Rishabh
d461525978 Updated validation for post/page
refs https://github.com/TryGhost/Team/issues/1071

- ignores `tiers` as its a valid visibility filter
2022-02-01 11:13:51 +05:30
Rishabh
bc5c00ba05 Updated post model to attach products relation
refs https://github.com/TryGhost/Team/issues/1071

- attaches products relation for post/pages to include tiers with access when applicable
2022-02-01 11:13:51 +05:30
Rishabh
7ab4c44475 Updated serialization for handling tiers visibility
refs https://github.com/TryGhost/Team/issues/1071

Going forward, if the visibility of a page/post is set for specific tiers, we send a `tiers` array in API response that contains list of tiers with access. This change -

- updates post/page mapper to transform existing data where `visibility` is a custom nql string to tiers array
- updates default include for post/pages to include `products`, which allows attaching relevant tiers from the pivot table
- cleans up usage of `visibility_filter` in serialization
2022-02-01 11:13:51 +05:30
Peter Zimon
209aab12e9
Remove Editor card settings panel alpha flag (#14087) 2022-01-31 14:12:05 +01:00
Fabien "egg" O'Carroll
a75908bb8a Added alpha flag for Tier welcome pages
refs https://github.com/TryGhost/Team/issues/1168
2022-01-31 13:40:33 +02:00
Kevin Ansfield
a0da017ab6 Added "improvedOnboarding" labs flag
refs https://github.com/TryGhost/Team/issues/1294

- used for working on changes to the setup flow and launch wizard
2022-01-31 11:23:14 +00:00
Rishabh Garg
eeafc8603b
Added pivot table to store tiers on post (#14038)
refs https://github.com/TryGhost/Team/issues/1071

We used `posts.visibility` originally to store visibility as `free|paid` with a character limit of 50. This same field was repurposed to store an NQL filter when member tiers is enabled. The NQL filter uses the slug of the tier name, which can easily create a filter longer than 50 characters, adding an unwanted limitation on number of tiers that can be added to post's visibility.
Going forward, we'd like to store the visibility of posts for tiers in a separate pivot table and instead store the value of `visibility` as `tiers` when restricting post access to specific tiers. This change -

- adds a new pivot table fixture for storing relation between posts and tiers
- adds a migration for creating the new table
- updates tests
2022-01-31 15:33:58 +05:30
Fabien "egg" O'Carroll
3d9e4b4c6c Synced Tiers welcome_page_urls with Settings
refs https://github.com/TryGhost/Team/issues/1168

Because Tiers is still behind a flag - any users which are not using
Tiers will still be editing their settings, and when they switch to
Tiers - the redirects will not necessarily be correct, unless we keep
the Tier columns up to date with any settings changes.
2022-01-30 17:41:57 +02:00
Fabien "egg" O'Carroll
0e866aaa1e Updated redirect logic to handle tier based urls
refs https://github.com/TryGhost/Team/issues/1168

This makes the actual switch to use a Tiers redirect URL rather than the
settings when the Tiers feature is enabled.
2022-01-30 17:41:57 +02:00
Fabien "egg" O'Carroll
4f5257859d Added welcome_page_url to Products API
refs https://github.com/TryGhost/Team/issues/1168

This updates the JSON API Schema to allow for the welcome_page_url
property, as well as including the new column in API responses, so that
we can both read and write the value via the API.
2022-01-30 17:41:57 +02:00
Daniel Lockyer
a6154938b8 Updated Admin to v4.34.0 2022-01-28 16:00:27 +00:00
Sam Lord
08829a6f0c
Trigger email verification workflow on API usage
refs: TryGhost/Toolbox#166

The new VerificationTrigger listens to events form the members repository, and will cause the verification workflow to be triggered if the number of events is greater than the configured threshold in a rolling 30 day window.

The importer also no longer depends on the import threshold, so the threshold testing is now done in the processImport method in Ghost - seems sensible since we already had this wrapper and the logic is now tiny, since it's just relying on @tryghost/verification-trigger to handle the real stuff.
2022-01-27 14:06:29 +00:00
Peter Zimon
5713dfe7f7
Updated support email address redirect (#14075)
refs. a488b93465

- Updates redirect to member settings page after changing the support email address
2022-01-27 12:43:01 +01:00
Daniel Lockyer
b79ca4188d
Merged v4.33.2 into main
v4.33.2
2022-01-27 10:29:30 +00:00
Daniel Lockyer
3275f0f07d Updated Admin to v4.33.2 2022-01-27 10:20:51 +00:00
Fabien 'egg' O'Carroll
8393c1e90a
Added welcome_page_url column to products table
refs https://github.com/TryGhost/Team/issues/1168

Rather than using a single url for paid signup redirects, we want to
support setting a welcome page on a tier by tier basis. This column will
be used to store the URL. A text column of length 2000 is how we have
stored URL's elsewhere in the schema.
2022-01-26 11:44:40 +02:00
Fabien "egg" O'Carroll
60777ac7fb Cleaned up Products API add & edit
refs https://github.com/TryGhost/Team/issues/1291

This is cleanup from the initial implementation.
2022-01-25 15:45:20 +02:00
Daniel Lockyer
a2c44efa6a
Merged v4.33.1 into main
v4.33.1
2022-01-24 16:03:16 +00:00
Daniel Lockyer
1559961f66 Updated Admin to v4.33.1 2022-01-24 15:59:59 +00:00
Fabien "egg" O'Carroll
91df910dbb 🐛 Fixed crashing on boot with revoked Stripe keys
no-issue

The refactor of Stripe boot logic missed catching any errors from the
migrations running or the webhooks initialising. This adds try/catches
to the services so that we can log the errors.
2022-01-24 17:50:55 +02:00
Fabien 'egg' O'Carroll
01f30eb632
Included benefits with theme product data (#14051)
refs https://github.com/TryGhost/Team/issues/1079

These were missing when benefits were added to products, and will allow
theme developers to make more useful custom subscribe pages.
2022-01-24 13:55:25 +02:00
Fabien 'egg' O'Carroll
db4da54265
Removed archived Tiers from theme data (#14049)
refs https://github.com/TryGhost/Team/issues/1252

In order to allow existing subscribe pages to continue working without
an extra flag, we're going to filter out the archived tiers.
2022-01-24 12:47:24 +02:00
Hannah Wolfe
9d8089a748
Removed deprecated routes.yaml data format
refs: https://github.com/TryGhost/Ghost/issues/10434
refs: https://github.com/TryGhost/Ghost/pull/10449
refs: https://github.com/TryGhost/Ghost/pull/10559

- We originally had a weird structure returned for data keys in routes.yaml.
- To the best of my knowledge this was never desired or really used
- I'm removing it now simply because I'm trying to remove all references to v2/v3 in tests, and this had a comment saying it was deprecated in v3
- I could have changed the comment to be a proper @deprecated comment and leave this til we rewrite dynamic routing
- However it's weird and confusing and I believe entirely unused - so getting rid is way way better
2022-01-21 20:16:43 +00:00
Thibaut Patel
817e556ea6 Updated the /members/event filtering logic
refs https://github.com/TryGhost/Team/issues/1277

- Enabled the `filter` attribute on the route.
- The events are now filtered in-memory instead of in the database.
- This fixes a wrong logic where the API user would have to know the internal event structure.
2022-01-21 18:35:02 +01:00
Daniel Lockyer
1bd0df3905 Updated Admin to v4.33.0 2022-01-21 16:00:31 +00:00
Fabien "egg" O'Carroll
26ef4afdb9 🐛 Fixed config API not returning boolean
no-issue

The mailgunIsConfigured config should be a boolean, rather than a string/undefined/null.
2022-01-20 18:25:41 +02:00
Fabien 'egg' O'Carroll
231a7b9bf4
Added active flag to products API (#14021)
refs https://github.com/TryGhost/Team/issues/1252

This flag is used to determine whether a Tier (currently product) as
active or archived
2022-01-20 17:46:53 +02:00
Fabien "egg" O'Carroll
1d73c17d5b Fixed unparsed booleans for "boolean" type columns
no-issue

Knex.js aliases "bool" -> "boolean" - this means that you can use either
one in our schema.json file and it'll correctly create the column. Our
model plugin however would only handle columns which used the "bool"
alias. This fixes the plugin to handle both strings.
2022-01-20 17:00:16 +02:00
Fabien 'egg' O'Carroll
534ebecc19
Added active column to products table (#14016)
refs https://github.com/TryGhost/Team/issues/1252

We need a way to signal whether or not a Tier is active or archived, and
we'll be using the active flag in the same way we do for Offers.
2022-01-20 15:50:18 +02:00
Marat Vyshegorodtsev
74b97e99cd
Added timezone and locale to the options of the date helper (#13892)
fixes https://github.com/TryGhost/Ghost/issues/13832

The `date` handlebars helper has only one option currently — `format`. It assumes the locale and timezone from the `options.data.site` object which is not always desired behavior.

The helper sometimes is used, for example, in custom RSS template where we always need the `en-US` locale, not the one that we have configured for the website globally. This change makes the two options configurable, and defaults to the `options.data.site` object values, if not specified in the helper (keeps the backwards compatibility with the current behavior).
2022-01-19 14:43:53 +00:00
Thibaut Patel
a1af064f79 Added three email delivery events to the member/event endpoint
refs https://github.com/TryGhost/Team/issues/1277

- The new events types are: `email_delivered_event`, `email_opened_event` and `email_failed_event`.
- This makes existing data accessible to the admin dashboard
2022-01-19 14:43:29 +01:00
Fabien 'egg' O'Carroll
8a81cd0a36
Removed duplicate offer redemptions (#14011)
refs https://github.com/TryGhost/Team/issues/1257

As well as fixing the code so that we do not create duplicate offer
redemptions going forward, we need to clean up the existing database.

We loop in code because the query to find and delete duplicates is complicated,
and will introduce more risk
2022-01-19 14:36:30 +02:00
Fabien 'egg' O'Carroll
a565da06b2
🐛 Fixed Offer Redemptions being over counted (#13988)
refs https://github.com/TryGhost/Team/issues/1257

Offer Redemptions were being overcounted due to the way we were updating
Stripe configuration for the Members service. We would create a new
instance of the members-api, which would have event handlers for
creating Offer Redemptions - by creating a new instance each time Stripe
config changed, we would overcount them.

Here we've pulled out Stripe related logic into the Stripe service, and
updated it internally - rather than creating a new instance. This means
that we've been able to remove all of the logic for re-instantiating the
members-api.

- Bumped members-api & stripe-service
- Removed reinstantiation of members-api
- Used stripe service to execute migrations
- Updated Stripe Service to handle webhooks & migrations
- Used webhook controller from stripe service
- Used disconnect method from stripe service
- Removed unused stripe dependency
- Removed Stripe webhook config from members-api
2022-01-18 17:56:47 +02:00
Daniel Lockyer
eb68e8d339 Added library for extracting database information
refs https://github.com/TryGhost/Toolbox/issues/175

- we're going to be making some changes in v5 wrt supported databases
- we needed a way of detecting the difference between MySQL 5 + 8,
  MariaDB etc
- I've created `@tryghost/database-info`, which is a small wrapper
  around `knex`, which returns this information
- this commit:
  - adds the library to Ghost
  - initializes the DB info library upon boot
  - updates the Admin API /config/ endpoint and UpdateCheck to return
    the new string - `mysql5`, `mysql8` etc
2022-01-18 09:31:08 +00:00
Rishabh
1f9edcefec Updated Portal to show free tier description and benefits
refs https://github.com/TryGhost/Team/issues/1037

- bumps portal to show free tier description and benefits when tiers beta is enabled
2022-01-17 23:26:58 +05:30
Rishabh
62777d7f26 Handled default product to use first paid product
Since we now have 2 products by default for all ghost sites, free and default paid, the usage of default product which so far was using first product needs to be updated to use the first paid product.

- updates default product usage to use first paid tier
- updates tests
2022-01-17 22:59:34 +05:30
Rishabh
345eb5828c Added tier type in API response
refs https://github.com/TryGhost/Team/issues/1037

Tiers now have a `type` column to differentiate between `free` and `paid` tiers. This change allows `type` data for a tier in Admin and Portal API output.
2022-01-17 22:59:34 +05:30
Rishabh
e54395eab5 Added new default free tier
refs https://github.com/TryGhost/Team/issues/1037

Free tier is now setup the same way as other tiers, to allow custom description/benefits. This change:

- adds a migration to add a default free tier for all sites
- adds a default fixture to insert a free tier for all new sites
2022-01-17 22:59:34 +05:30
Rishabh
761a330e16 Added new type column for tiers
refs https://github.com/TryGhost/Team/issues/1037

- adds new `type` column for tiers to differentiate between free and paid tiers
- all existing tiers are updated to be `paid` tiers
2022-01-17 22:59:34 +05:30
Kevin Ansfield
d77948540a Added membersActivityFeed alpha labs flag
refs https://github.com/TryGhost/Team/issues/1277

- used for prototyping a separate activity feed screen that can show all members activity, combining the events shown in the dashboard with the email events shown on the member screen
2022-01-17 12:23:38 +00:00
Fabien 'egg' O'Carroll
10c214c148
Switched AMP to be 'off' by default in all new Ghost instances (#13907)
refs https://github.com/TryGhost/Team/issues/1189

Support for AMP is slowly in decline, and makes developing new cards trickier,
since AMP no longer has an effect of SEO we're going to disable it by default
as a first step toward moving away from it.

Co-authored-by: Thibaut Patel <thibaut@ghost.org>
2022-01-14 18:55:48 +02:00
Daniel Lockyer
f370d10401 Updated Admin to v4.32.3 2022-01-14 16:00:28 +00:00
Kevin Ansfield
96ec60e393
🐛 Fixed "Create Post" action error in Zapier when assigning new tags (#13972)
closes https://github.com/TryGhost/Zapier/issues/56

- fixes tag creation when creating posts with `tags: [{slug: 'new'}]` which should be supported
  - assigning tags with only `{slug: 'new'}` was triggering our validation for the required `name` property then bubbling up to the `bookshelf-relations` library resulting in a 500 error
  - the fix applied here is to set the `name` field to the same as the `slug` field if a name is not provided
2022-01-14 13:37:20 +00:00
Fabien "egg" O'Carroll
f58b5984cb Updated caching policy for /members/.well-known
refs https://github.com/TryGhost/Team/issues/1273

This endpoint currently only serves the members public key, which should
never change. A 24 hours cache will drastically reduce the number of
requests for the key, with little to no impact on functionality.
2022-01-14 14:04:23 +02:00
Fabien "egg" O'Carroll
5d8f491823 Updated caching policy for /members/api/site
refs https://github.com/TryGhost/Team/issues/1240

As this endpoint is hit on every page load when Portal is enabled, it
can cause a lot of traffic to Ghost. The data does not change very
frequently so we've added a 30s cache policy to alleviate load on servers.
2022-01-14 14:04:23 +02:00
Fabien "egg" O'Carroll
76b33b6e77 Added JSDoc to cache control middleware
no-issue
2022-01-14 14:04:23 +02:00
Daniel Lockyer
dbd6e31fc0
Merged v4.32.2 into main
v4.32.2
2022-01-12 10:02:33 +00:00
Daniel Lockyer
98ac844ee4 Updated Admin to v4.32.2 2022-01-12 10:00:20 +00:00
Fabien 'egg' O'Carroll
0aec18deee Stopped reconfiguring MemberAPI on settings change (#13943)
refs https://github.com/TryGhost/Team/issues/1257
refs https://github.com/TryGhost/Team/issues/1261

Certain event listens are being added twice due to the way we "reload"
the MembersAPI which can cause duplicate counts of Offer Redemptions.

Rather than creating multiple instances of the MembersAPI we're moving
toward being able to reload the config in place or passing getters for
the config which will allows us to use the MembersAPI as a singleton,
and remove any bugs which come from creating multiple instances.

This also fixes a bug with the allowSelfSignup config not refreshing when
the portal_plans setting was changed.
2022-01-12 11:31:59 +02:00
Matt Hanley
620059c7b4 🐛 Fixed incorrect edit redirect for authors
closes https://github.com/TryGhost/Ghost/issues/13942

- Admin routes were updated, and the author page was moved under the settings route, but the /edit redirect was missed
2022-01-10 16:56:33 +00:00
Fabien 'egg' O'Carroll
68127cf4d4
Stopped reconfiguring MemberAPI on settings change (#13943)
refs https://github.com/TryGhost/Team/issues/1257
refs https://github.com/TryGhost/Team/issues/1261

Certain event listens are being added twice due to the way we "reload"
the MembersAPI which can cause duplicate counts of Offer Redemptions.

Rather than creating multiple instances of the MembersAPI we're moving
toward being able to reload the config in place or passing getters for
the config which will allows us to use the MembersAPI as a singleton,
and remove any bugs which come from creating multiple instances.

This also fixes a bug with the allowSelfSignup config not refreshing when
the portal_plans setting was changed.
2022-01-10 18:21:09 +02:00
Daniel Lockyer
2e3628443d Updated Admin to v4.32.1 2022-01-07 16:00:35 +00:00
Rishabh
912d338b6b Added discount information for a member on Portal home page
refs https://github.com/TryGhost/Team/issues/1195

- adds discounted subscription price info where applicable on Portal account home page
2022-01-06 18:47:22 +05:30
Kevin Ansfield
c27ad6e6b8 🎨 Improved copy on member email unsubscribe page
closes https://github.com/TryGhost/Team/issues/1228

- copy updated to clarify the unsubscribe was for emails only, not full account cancelation
- added a link to member account management so members can easily re-subscribe to emails if desired
2022-01-05 15:27:13 +00:00
Thibaut Patel
01e833376b
🐛 Added pagination to sitemap.xml to avoid max 50,000 entries limit
refs https://github.com/TryGhost/Team/issues/1044
refs https://github.com/TryGhost/Ghost/pull/13298

- This splits the sitemaps according to the limit set by Google https://developers.google.com/search/docs/advanced/sitemaps/large-sitemaps

Co-authored-by:
- Kevin Ansfield (@kevinansfield)
2022-01-05 11:54:35 +01:00
Kevin Ansfield
5b5f756a8d Fixed linter error
refs https://github.com/TryGhost/Team/issues/1258

- all uses of `labs` service in the frontend site router have been removed but the require had been left in place
2022-01-04 15:29:00 +00:00
Kevin Ansfield
9b210f9add Fixed linter error
refs https://github.com/TryGhost/Team/issues/1258

- all uses of `labs` service in canary routes have been removed but the require had been left in place
2022-01-04 15:26:17 +00:00
Kevin Ansfield
fc6ed1a45e Removed headerCard GA labs flag
refs https://github.com/TryGhost/Team/issues/1258

- labs flag conditionals have been removed from Admin so the GA flag is no longer necessary
2022-01-04 14:57:46 +00:00
Kevin Ansfield
829b410c78 Removed fileCard GA labs flag
refs https://github.com/TryGhost/Team/issues/1258

- labs flag conditionals have been removed from Admin so the GA flag is no longer necessary
2022-01-04 14:57:25 +00:00
Kevin Ansfield
0de2c7e261 Removed filesAPI GA labs flag
refs https://github.com/TryGhost/Team/issues/1258

- files API is GA so labs flag and conditional access to files API routes is no longer necessary
2022-01-04 14:56:07 +00:00
Kevin Ansfield
ebae98f538 Removed membersAutoLogin GA labs flag
refs https://github.com/TryGhost/Team/issues/1258

- members auto login after Stripe checkout feature is GA so labs flag is no longer necessary
- bumps `@tryghost/members-api` to version that does not use the labs flag
2022-01-04 14:54:11 +00:00
Kevin Ansfield
2773e82e3e Removed mediaAPI GA labs flag
refs https://github.com/TryGhost/Team/issues/1258

- media API is GA so labs flag and conditional access to media API routes is no longer necessary
2022-01-04 13:11:23 +00:00
Kevin Ansfield
09228298b1 Removed audioCard GA labs flag
refs https://github.com/TryGhost/Team/issues/1258

- labs flag conditionals have been removed from Admin so the GA flag is no longer necessary
2022-01-04 13:08:18 +00:00
Kevin Ansfield
afb402991d Removed richTwitterNewsletters GA labs flag
refs https://github.com/TryGhost/Team/issues/1258

- conditional custom-processing of twitter embeds is GA so no longer needs the flag or conditional
2022-01-04 13:07:39 +00:00
Kevin Ansfield
cd745e09a8 Removed productCard GA labs flag
refs https://github.com/TryGhost/Team/issues/1258

- labs flag conditionals have been removed from Admin so the GA flag is no longer necessary
2022-01-04 13:04:53 +00:00
Kevin Ansfield
3d256d200e Removed accordionCard GA labs flag
refs https://github.com/TryGhost/Team/issues/1258

- labs flag conditionals have been removed from Admin so the GA flag is no longer necessary
2022-01-04 13:03:43 +00:00
Kevin Ansfield
ee4ef59c43 Removed videoCard GA labs flag
refs https://github.com/TryGhost/Team/issues/1258

- labs flag conditionals have been removed from Admin so the GA flag is no longer necessary
2022-01-04 12:58:06 +00:00
Kevin Ansfield
81d6385598 Removed calloutCard GA labs flag
refs https://github.com/TryGhost/Team/issues/1258

- labs flag conditionals have been removed from Admin so the GA flag is no longer necessary
2022-01-04 12:56:51 +00:00
Kevin Ansfield
c4caf1c373 Removed nftCard GA labs flag
refs https://github.com/TryGhost/Team/issues/1258

- labs flag conditionals have been removed from Admin so the GA flag is no longer necessary
2022-01-04 12:55:33 +00:00
Kevin Ansfield
30c27ee1c3 🐛 Fixed Flickr embeds appearing distorted in emails
refs https://github.com/TryGhost/Team/issues/1262

- Flickr embeds have fixed width/height attributes on the `img` elements but the displayed width is always constrained to the width of the email content container which is less than the attribute width, however the fixed height is observed by email clients resulting in images that are stretched vertically
- added a `height: auto` CSS override so email clients will correctly recalculate the image size when resized to fit the container width
2022-01-04 11:33:08 +00:00
Fabien O'Carroll
4d457461c9 Deleted all SingleUseTokens on boot
refs https://github.com/TryGhost/Team/issues/1216

Since we are increasing the grace period to 10 minutes, we want to make
sure that server crashes during those 10 minutes do not cause single use
tokens to remain in the system. The quickest was to ensure that without
restartable background jobs is to delete all tokens upon boot.
2022-01-04 11:14:31 +01:00
Matt Hanley
cc7f527a6a
🐛 Added fallback for meta_description to custom_excerpt (#13927)
closes https://github.com/TryGhost/Ghost/issues/13920

- Custom excerpt should be used as a fallback for meta_description in line with the behaviour of OG and Twitter metadata
- We specifically don't want to use the full fallback to the auto-generated preview text when a custom excerpt isn't defined, because we trust search engines to be able to summarise content better than we can
2022-01-03 19:09:03 +00:00
Kevin Ansfield
cabf78e938 Cleaned up customThemeSettings labs flag
closes https://github.com/TryGhost/Team/issues/1164

- `customThemeSettings` feature is GA so any conditionals can be cleaned up
- removed conditional loading of custom theme settings and associated API routes
- removed event trigger for reloading custom theme settings when the feature flag is toggled
- removed flag from labs GA list
2022-01-03 17:45:25 +00:00
Fabien 'egg' O'Carroll
bc75d20cef
Updated SingleUseToken grace period to 10 minutes (#13926)
refs https://github.com/TryGhost/Team/issues/1216

Some email security clients are scanning links at delivery, rather than
at the point the user clicks on them. This is causing magic links to
expire. To get around this we're increasing the grace period in which a
link can be used multiple times to 10 minutes.
2022-01-03 17:55:53 +02:00
Juan Delgadillo
76cde79186
Fixed AMP style compliance (#13912)
no issue

- `!important` qualifier is not allowed in AMP styles as it's disallowed by the framework's spec https://amp.dev/documentation/guides-and-tutorials/develop/style_and_layout/style_pages/#disallowed-styles
2021-12-21 21:32:53 -05:00
Peter Zimon
25748f420c Applied default box sizing to all cards
refs. https://github.com/TryGhost/Ghost/issues/13874

- Improved stability of cards by adding 'box-sizing: border-box;' CSS property to all of them so that it's not required by themes anymore
2021-12-17 15:28:35 +01:00
Daniel Lockyer
435b385d94 Updated Admin to v4.32.0 2021-12-17 11:32:32 +00:00
Daniel Lockyer
3eabc6ca35
Added header card to editor
refs https://github.com/TryGhost/Team/issues/1253

- moves the header card flag to GA for public release
2021-12-17 12:20:10 +01:00
Peter Zimon
e64e646587 Refined default header styles 2021-12-17 07:53:16 +01:00
Peter Zimon
1d46adf07a Updated header card colors and typography 2021-12-17 04:23:46 +01:00
Peter Zimon
fb39a0032e Revert "Used neutral background colors for default header styles"
This reverts commit 999dc867b6.
2021-12-17 04:15:37 +01:00
Peter Zimon
999dc867b6 Used neutral background colors for default header styles 2021-12-17 03:41:50 +01:00
Peter Zimon
384efab031 Updated header frontend styles 2021-12-16 19:39:30 +01:00
James Morris
81374e3040 Updated button for header card frontend to not style inner span
refs https://github.com/TryGhost/Team/issues/1253
2021-12-16 18:26:02 +00:00
Peter Zimon
683ac885fd Updated email template for header card 2021-12-16 18:54:21 +01:00
Thibaut Patel
4984223bf2 Renamed the header styles
refs https://github.com/TryGhost/Team/issues/1253

- The naming is easier to understand for theme developers
2021-12-16 18:22:16 +01:00
James Morris
90c99afcfb Removed unnecessary styles from header card frontend
refs https://github.com/TryGhost/Team/issues/1253
2021-12-16 17:20:12 +00:00
James Morris
c373e41699 Added in proper header link colours
refs https://github.com/TryGhost/Team/issues/1253
2021-12-16 17:05:39 +00:00
James Morris
3490047a36 Updated frontend with header style tweaks
refs https://github.com/TryGhost/Team/issues/1253
2021-12-16 16:37:02 +00:00
Fabien 'egg' O'Carroll
a4783e1800
Removed empty class attribute from emails (#13906)
no-issue

This is causing some ESP's to think our markup is invalid, and this is
affecting deliverability
2021-12-16 16:58:33 +02:00