Commit Graph

20853 Commits

Author SHA1 Message Date
Kevin Ansfield
9fa0c24be9 Removed resend countdown from 2fa flow
closes https://linear.app/ghost/issue/ENG-1658

- switched to using a task to match patterns elsewhere and have better cancellation behaviour if code is re-used in a short-lived component
- added `drop: true` task modifier to our main tasks so they can't be triggered again whilst we're waiting on an API request
- removed confusing countdown in button text
- restored forced "text" data type for resend API request to match API behavior
- added acceptance tests for resend behaviour
2024-10-25 15:26:23 +01:00
Fabien 'egg' O'Carroll
5fd22df669
Bumb gscan to v4.45.0
refs https://github.com/TryGhost/Ghost/commit/21da7f6b50c

Adds support for the new `content_api{key,url}` helpers
Fixes the ordering of the `@tryghost/custom-fonts` dep
2024-10-25 10:52:17 +00:00
Cathy Sarisky
21da7f6b50
Added content_api_url helper (#21331)
This adds a `content_api_url` helper, returning the url for Ghost's
Content API. By default it will return an absolute URL but can be 
passed `absolute=false` if a relative URL is wanted.

This works in tandem with the `content_api_key` helper to
facilitate third party integrations with the Content API, for
example - custom Portal or Search implementations.
2024-10-25 16:37:56 +07:00
Fernando Ochoa
66b1cb0db2
Improved es translation for no search results 2024-10-25 14:55:09 +07:00
Ludovic Toinel
c8b05fdfa6
Added missing name attribute to "WebSite" metadata
refs https://developers.google.com/search/docs/appearance/site-names?hl=fr#website

The 'WebSite' type from https://schema.org should have a name attribute
on the root object. This value is used by Google Search for the name
display on to top of the content title.
2024-10-25 14:40:45 +07:00
Peter Gonda
a9e69d3b0d
Updated slovak translations for search (#21394)
Thanks to my friend Boshi for reviewing ❤️
2024-10-25 12:34:31 +07:00
Chris Raible
162149a04d
Fixed "specific tiers" flaky publishing test (#21404)
no issue

- Fixed a flaky [publishing
test](https://github.com/TryGhost/Ghost/actions/runs/11509561903/job/32039943951)
that was suffering from a race condition. It was trying to copy the
bookmark link shown on the publishing complete modal, but it was
sometimes already closed by that point.
- It seemed to pass consistently locally, but in CI it would frequently
fail. This commit should wait to copy the link before closing the modal.
2024-10-24 18:38:43 -07:00
Chris Raible
b44ad06015
Fixed browser tests yielding a false passing result in CI (#21401)
no issue

- Browser tests in CI were yielding a passing result even if one or more
tests failed (including retries).
- The `yarn dev` command that triggers the browser tests in CI was
catching any errors and exiting with code 0, resulting in a  in CI.
- This commit changes `yarn dev` to exit with code 1 if the browser
tests fail, so that CI will correctly fail if any of the browser tests
fail.
2024-10-24 17:22:37 -07:00
Chris Raible
af0f26c75f
Added Dev Container setup (#21279)
no issue

- Dev Containers let you work on Ghost in a consistent, isolated
environment with all the necessary development dependencies
pre-installed. VSCode (or Cursor) can effectively run _inside_ the
container, providing a local quality development environment while
working in a well-defined, isolated environment.
- For now the default setup only works with "Clone repository in
Container Volume" or "Clone PR in Container Volume" — this allows for a
super quick and simple setup. We can also introduce another
configuration to allow opening an existing local checkout in a Dev
Container, but that's not quite ready yet.
- This PR also added the `yarn clean:hard` command which: deletes all
node_modules, cleans the yarn cache, and cleans the NX cache. This will
be necessary for opening a local checkout in a Dev Container.
- To learn more about Dev Containers, read this guide from VSCode:
https://code.visualstudio.com/docs/devcontainers/containers#_personalizing-with-dotfile-repositories

---------

Co-authored-by: Joe Grigg <joe@ghost.org>
Co-authored-by: Steve Larson <9larsons@gmail.com>
2024-10-24 11:15:08 -07:00
Aileen Booker
c1ce322e86
Custom fonts (#21337)
- Adding custom fonts for themes behind a feature flag
- Introduces new `@tryghost/custom-fonts` module to manage custom fonts
- UI updates for Branding and Theme settings

---------

Co-authored-by: Fabien O'Carroll <fabien@allou.is>
Co-authored-by: Sodbileg Gansukh <sodbileg.gansukh@gmail.com>
Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
Co-authored-by: Daniël van der Winden <danielvanderwinden@ghost.org>
2024-10-24 07:43:08 -04:00
Ronald Langeveld
96239d31a6
Added Comments Sorting UI (#21375)
ref PLG-220

- Added UI for Comments Sorting on the Comments UI App.

Co-authored-by: Sanne de Vries <65487235+sanne-san@users.noreply.github.com>
2024-10-24 19:01:14 +09:00
Ghost CI
ee980e3e34 Merged v5.97.3 into main 2024-10-23 12:30:55 +00:00
Ghost CI
e8b6f9ff84 v5.97.3 2024-10-23 12:30:53 +00:00
Michael Barrett
75205a7d31
Updated admin-x-activitypub URL to point at shorter cached version (#21378)
no refs
2024-10-23 13:03:40 +01:00
Daniel Lockyer
9c6992535b Refactored URL service code to aid with debugging
- replaced a couple of uses of lodash.each in favor of native for loops
- tidied up `debug` statements and spacing
- pulled out common statements into variables
2024-10-23 13:17:54 +02:00
Ludovic Toinel
182a07278d
Added missing lang attribute to html tag for AMP
refs https://github.com/ampproject/amphtml/blob/main/docs/spec/amp-html-components.md

SEMRush was giving back issues on AMP analysis due to this missing attribute
2024-10-23 18:05:46 +07:00
Michael Barrett
5492e64988
Updated admin-x-activitypub URL to point at shorter cached version (#21378)
no refs
2024-10-23 11:36:16 +01:00
Fabien O'Carroll
0cb435fe4d Added breaking test for ghost_head including portal script
refs https://linear.app/ghost/issue/ONC-254
refs https://github.com/TryGhost/Ghost/issues/20771

The reason that recommendations aren't working is because portal isn't loaded,
which handles the data-attributes having the event listeners added to them.
2024-10-23 08:58:52 +01:00
Ghost CI
df1da8ac24 Merged v5.97.2 into main 2024-10-23 07:56:20 +00:00
Ghost CI
0f718a13f1 v5.97.2 2024-10-23 07:56:19 +00:00
Cathy Sarisky
de3b9b1ec5
🐛 Fixed recommendations popup not opening
closes https://linear.app/ghost/issue/ONC-254
closes #20771

The portal script, which is responsible for handling the recommendations popup,
was only loaded into the front end if either members or donations are enabled.
We're adding an extra condition to load it if recommendations are enabled.

We may want to consider splitting out this functionality into several scripts,
so that we don't have to load _everything_ if only one feature is enabled, but
that is outside the scope of this issue.
2024-10-23 14:49:10 +07:00
Michael Barrett
c6bfd0f98f
Moved ActivityPub labs flag to (private) beta (#21363)
no refs
2024-10-23 08:36:15 +01:00
Daniël van der Winden
8615bd538b
MRR/Members chart axis fix (#21359)
fixes
https://linear.app/ghost/issue/DES-869/dashboard-mrr-member-chart-axis-is-making-flat-growth-look-like

A slight decline/increase on the MRR/members chart was shown as a very
dramatic shift. These changes will make the chart appear more gradual
when the changes are small. 

The chart will effectively "zoom in" on the
range where the values fluctuate. The y-axis minimum is 95% of the lowest data point, and the maximum is 105% of the highest data point. That way there's a small buffer above and below the data range, and the chart as a whole doesn't have the overly dramatic drops/peaks.

I've tested it with hardcoded values, as well as values inserted via the
API, and the charts look a lot better.

**Before**
<img width="1257" alt="1 - chart before"
src="https://github.com/user-attachments/assets/8d59fc38-0a57-4a7a-a83f-06e045057f45">
<img width="1255" alt="2 - chart before"
src="https://github.com/user-attachments/assets/46476d88-3991-4253-a5bc-76591ea67e39">

**After (same two values)**
<img width="1260" alt="3 - chart after"
src="https://github.com/user-attachments/assets/d5bcfdb2-40dd-4655-afd4-ba19a62d76b9">
<img width="1263" alt="4 - chart after"
src="https://github.com/user-attachments/assets/6c8cf189-6497-482e-9414-a7d77c00c533">

**Gradual decline**
<img width="1259" alt="5 - chart gradual"
src="https://github.com/user-attachments/assets/5ec2b470-f1d2-45cd-aba5-5f11e6e718fd">
<img width="1250" alt="6 - chart gradual"
src="https://github.com/user-attachments/assets/b6dd67ab-0b5e-47db-a9ef-d4ae10b78f73">

**More pronounced decline**
<img width="1270" alt="7 - chart dramatic"
src="https://github.com/user-attachments/assets/c43215c3-a687-47be-ab05-70fee855a345">
<img width="1256" alt="8 - chart dramatic"
src="https://github.com/user-attachments/assets/55ae833b-e47d-441a-98e0-fcfa2e9734a0">
<img width="1258" alt="9 - chart dramatic"
src="https://github.com/user-attachments/assets/b9fdef8f-61fa-4315-a662-b37eea2259d3">
2024-10-23 09:02:30 +02:00
Princi Vershwal
3f1fa96003
Updated code for fetching location (#21368)
Ref:
https://linear.app/ghost/issue/ENG-1660/undefined-location-when-logging-in-on-ios
2024-10-23 06:43:42 +01:00
Ronald Langeveld
1e8bb253bf
Added Best Comment to top of API output (#21374)
ref PLG-220

- Added the ability to move the Best comment to the first entry when
order=best is passed as params.
2024-10-23 09:48:16 +09:00
Ghost CI
1626a0c537 Merged v5.97.1 into main 2024-10-22 15:20:32 +00:00
Ghost CI
7dc0c87b44 v5.97.1 2024-10-22 15:20:30 +00:00
Fabien 'egg' O'Carroll
1739bdb9be 🐛 Fixed hidden comments still appearing
refs https://linear.app/ghost/issue/ONC-469

Hidden comments were not being purged from the cache, which resulted
in stale data being served, and hidden comments being visible.
2024-10-22 22:08:37 +07:00
Fabien 'egg' O'Carroll
73e0727cc4
🐛 Fixed hidden comments still appearing
refs https://linear.app/ghost/issue/ONC-469

Hidden comments were not being purged from the cache, which resulted
in stale data being served, and hidden comments being visible.
2024-10-22 22:02:24 +07:00
Michael Barrett
f7fbb6edcd
Moved ActivityPub labs flag to (private) beta (#21363)
no refs
2024-10-22 12:45:45 +01:00
Cathy Sarisky
1ce5dc34ca
🐛 fixed routing error when no recommendations (#21251)
no ref.

The default routing for the portal app is a signup page. When a site has
no recommendations, the result of triggering that page (by following a
link that goes there) is a prompt to sign up, or a notification that one
cannot sign up, if membership is disabled.

This patch adds a "No recommendations" message, which will be shown if a
user follows a recommendations link (#/portal/recommendations) on a site
without recommendations. While we shouldn't end up there very often,
it'll make a lot more sense when it does!
2024-10-22 11:34:44 +01:00
Kevin Ansfield
a4e3ef012c Improved validation behaviour on 2fa code verification screen
closes https://linear.app/ghost/issue/ENG-1672

- removed input on-blur validation because it can be triggered when clicking reset button giving a misleading error state
- added client-side validation for 6-digit code
- added validation when submitting the form
- added error reset when typing in the code field, including removal of button failure state, so it's clearer you're in a new submit state
2024-10-21 12:32:29 +01:00
Kevin Ansfield
6c4de6a937 Updated 2fa flow copy
closes https://linear.app/tryghost/issue/ENG-1654
closes https://linear.app/tryghost/issue/ENG-1656
closes https://linear.app/tryghost/issue/ENG-1657

- updated copy
- improved error handling when verification fails
- refactored some duplication of steps in Admin authentication tests
2024-10-21 11:01:40 +01:00
Sam Lord
85d305ebf7 Added browser tests for 2fa 2024-10-21 11:01:40 +01:00
Kevin Ansfield
2bf626bf6c Added explicit 2fa required error detection
no issue

- previously we determined any 403 response was an indication that we should switch to the 2fa input screen during sign-in
- added a custom error that explicitly looks for an error with our `2FA_TOKEN_REQUIRED` code so we don't have any confusion when a non-2fa 403 is received for any reason and to have the option of moving away from the 403 if needed without breaking the client
- test to ensure our error 2fa-required error detection works correctly
- extracted duplicate steps in the authentication tests into a helper function
- fixed authentication tests so they better represent our API output of `errors` being an array
2024-10-21 11:01:40 +01:00
Kevin Ansfield
df6eb7bfda Fixed flash of button error state when redirected to 2fa screen
closes https://linear.app/tryghost/issue/ENG-1652/

- returning `undefined` from a task is equivalent to failing
- switched to returning `true` when we get the 2fa required error so the button stays in the neutral/success state
- added `SUCCESS` and `FAILURE` consts to better reflect control flow when returning from tasks and ensured we always return a value
2024-10-21 11:01:40 +01:00
Sam Lord
3ed1f6a8ca Added tests for sessions API with 2fa enabled 2024-10-21 11:01:40 +01:00
Sam Lord
eef6c64131 Added brute protection to 2FA endpoints
ref ENG-1629

Use separate protection for the 2 endpoints as one can resend an
email, and the other is used to login -- each presents its own
security challenges.
2024-10-21 11:01:40 +01:00
Michael Barrett
d90a70e43c Moved 2fa resend button inside form and added countdown 2024-10-21 11:01:40 +01:00
Sam Lord
c9c8709fd3 Added publication icon to 2fa email if available 2024-10-21 11:01:40 +01:00
Princi Vershwal
d2ca6e4a74 Added siteLogo to session service emails 2024-10-21 11:01:40 +01:00
Djordje Vlaisavljevic
548ff8d14a Updated design for 2FA verification code email
ref https://linear.app/tryghost/issue/ENG-1636/email-template-design-for-verification-code-email
2024-10-21 11:01:40 +01:00
Princi Vershwal
0c0ac6f0ab Changed subject for verification code email 2024-10-21 11:01:40 +01:00
Princi Vershwal
5ee2f91557 Added support for fetching device details when creating session 2024-10-21 11:01:40 +01:00
Michael Barrett
29d1026606 Added button to resend 2fa code
refs [ENG-1644](https://linear.app/tryghost/issue/ENG-1644/add-re-send-ui-flow)
2024-10-21 11:01:40 +01:00
Sam Lord
1f687ae466 Moved 2fa labs flag usage to avoid logging out users
After migrations run, any sessions made with the labs flag turned off
will have the verified flag set. We also need new sessions made after
that to gain the verified flag, so that they aren't logged out at the
point that the labs flag is enabled (or removed).
2024-10-21 11:01:40 +01:00
Michael Barrett
16b0ef352f Fixed 2fa code resend button reverting to retry on success
refs [ENG-1642](https://linear.app/tryghost/issue/ENG-1642/when-submitting-the-code-the-login-button-changes-to-retry-before)
2024-10-21 11:01:40 +01:00
Sam Lord
db107bd789 Fixed sendAuthCodeForUser to find user on first request
ref ENG-1641

Using `getUserFromSession` requires the cookie header to be set, but
at this point we may still be constructing the session. Instead we can
get the user id from the session itself
2024-10-21 11:01:40 +01:00
Princi Vershwal
3cffb9a132 Moved session verified check behind staff2fa flag 2024-10-21 11:01:40 +01:00
Sam Lord
cb8d18423a Fixed login / logout with 2fa code
refs ENG-1640

We had built all the right pieces, but the session endpoints weren't
verifying the service
2024-10-21 11:01:40 +01:00