Commit Graph

39859 Commits

Author SHA1 Message Date
Yovko Lambrev
9f9c8dc364
🌐 Updated Bulgarian translations (#21533)
no issue

- Some lexical and punctuation improvements of the previous translations
- Bulgarian translation of the newly introduced newsletter strings
2024-11-06 10:00:08 +08:00
Chris Raible
190ebcd684
Added ability to push prometheus metrics to a pushgateway (#21526)
ref
https://linear.app/ghost/issue/ENG-1746/enable-ghost-to-push-metrics-to-a-pushgateway

- We'd like to use prometheus to expose metrics from Ghost, but the
"standard" approach of having prometheus scrape the `/metrics` endpoint
adds some complexity and additional challenges on Pro.
- A suggested simpler alternative is to use a pushgateway, to have Ghost
_push_ metrics to prometheus, rather than have prometheus scrape the
running instances.
- This PR introduces this functionality behind a configuration. 
- It also includes a refactor to the current metrics-server
implementation so all the related code for prometheus is colocated, and
the configuration is a bit more organized. `@tryghost/metrics-server`
has been renamed to `@tryghost/prometheus-metrics`, and it now includes
the metrics server and prometheus-client code itself (including the
pushgateway code)
- To enable the prometheus client alone, `prometheus:enabled` must be
true. This will _not_ enable the metrics server or the pushgateway — it
will essentially collect the metrics, but not do anything with them.
- To enable the metrics server, set `prometheus:metrics_server:enabled`
to true. You can also configure the host and port that the metrics
server should export the `/metrics` endpoint on in the
`prometheus:metrics_server` block.
- To enable the pushgateway, set `prometheus:pushgateway:enabled` to
true. You can also configure the pushgateway's `url`, the `interval` it
should push metrics in (in milliseconds) and the `jobName` in the
`prometheus:pushgateway` block.
2024-11-05 11:50:39 -08:00
renovate[bot]
b6f1ecc149 Update dependency mysql2 to v3.11.4 2024-11-05 18:22:17 +00:00
Fabien 'egg' O'Carroll
b591912c74
Updated the local state after following an account (#21509)
refs https://linear.app/ghost/issue/AP-523

We want to preempt the Accept activity from our Follows, so we make the
assumption that it's succeeded. What this means is that we have to
update our `following`, `followingCount` as well as the fetched profile
to set the `isFollowing` property. This gives a more fluid user
experience when following accounts and keeps our state up to date.

Accounts where the follow request has to be accepted manually, are a
little trickier as we don't currently have easy access to the "requested
but not accepted state"
2024-11-06 00:15:39 +07:00
Kevin Ansfield
c0a00cabe4 Bumped Comments-UI to 0.21.8
no issue
2024-11-05 10:55:50 +00:00
Daniël van der Winden
9d0e4e7d45
Updated Signup Page (#21434)
fixes
https://linear.app/ghost/issue/DES-881/sign-up-flow-on-mobile-with-checkbox-on-requires-ux-improvement

On mobile, the Sign Up button is no longer sticky. This ensures
customers scroll down and see the checkbox before they hit the button.

If they do still miss the checkbox, we now have a check in place that
— if the checkbox is the last missing thing — scrolls the checkbox into
view upon submission.

https://github.com/user-attachments/assets/5d7867b6-d60c-4844-9482-af04a0eb1eaf
2024-11-05 10:51:14 +01:00
Daniel Lockyer
18adf4b000 Optimized collating members and email IDs
- using lodash to do this is unnecessarily heavy, so this commit
  switches the code to the equivalent native version
- as mentioned in the comment I added, I think we can further optimize
  this by storing it as a Set and then calling `Array.from` once, but
  that's a step too far for now
2024-11-05 08:49:34 +01:00
Daniel Lockyer
44edf3d379 Removed duplicate serialization for offers
- we can skip an extra `toJSON` call here by storing the value and
  re-using it, which means we can cut down on the number of calls, which
  can be particularly heavy when this codepath is hit hard
2024-11-05 08:49:34 +01:00
Duy
19f6f910b6
Updated Vietnamese translations in newsletter.json (#21525)
no issue
2024-11-05 11:51:58 +08:00
Alexandre "Lekler" Rodrigues
197f807913
Addsed pt-BR translations to newsletter.json and fixes other strings (#21499)
no issue

- following pull requests #21251 and #21497, this commit adds pt-BR
translations to newsletter.json and fixes other strings in pt-BR locale
files
2024-11-05 11:50:15 +08:00
Mateus Ribeiro
9d332aab4e
Added missing pt-BR translation in comments.json (#21522)
no issue

- added pt-BR translation for "Sort by"
2024-11-05 03:14:37 +00:00
Ronald Langeveld
c77080f977
Fixed comments placeholder (#21524)
ref PLG-251

- Fixed comments placeholder to change from "Start the conversation" to
"Join the discussion" when there's more than 1 comment.
- Previously, it only worked after a refresh. This fix ensures it's
reactive and would update the placeholder without the need for a
refresh.
2024-11-05 12:14:29 +09:00
Gary Lai
a845002d7c
🌐 Added more zh-Hant translations (#21502)
no issue
2024-11-05 11:05:03 +08:00
renovate[bot]
514a9487d9 Pin dependency workerpool to 9.1.3 2024-11-05 02:45:38 +00:00
Mark Stosberg
c8dcbbfbc5
🐛 Fixed migrations for SQLite database users (#19839) (#21063)
refs https://github.com/TryGhost/Ghost/issues/19839
refs https://www.sqlite.org/limits.html

SQLite has limit of 500 items in a compound select statement.

This limit could be hit when a complex select statement was being
generated as part of a batch insert statement.

Lowering the batch size will have minimal impact on migration
performance while improving SQLite compatibility.

One of these bulk inserts is confirmed to be affected through the linked
issue.

I didn't confirm if the other two cases would trigger it, but the change
won't hurt there either.
2024-11-05 09:34:52 +07:00
Steve Larson
88db66a74c
Added experimental background job queue (#20985)
ref https://linear.app/tryghost/issue/ENG-1556/
- added background job queue behind config flags
- when enabled, is only used for the member email analytics updates in
order to speed up the parent job, and take load off of the main process
that is serving requests

The intent here is to decouple certain code paths from the main process where it is unnecessary, or worse, where it's part of the request. Primary use cases are email analytics (particularly the member stats [open rate]) which are not particularly helpful in the period immediately following an email send, while the click traffic and delivered/opened events are.

Related, the email link clicks themselves send off a cascade of events that are quite a burden on the main process currently and are somewhat tied to the request response when they needn't be. We'll be looking to tackle that after some initial testing with the email analytics job.
2024-11-04 10:13:15 -06:00
Daniël van der Winden
6e8e817a47
Makes newsletter comments toggle conditional (#21517)
fixes
https://linear.app/ghost/issue/DES-796/shouldnt-show-email-template-option-when-commenting-is-disabled

Previously, if you had comments turned off on your site, you would still
see the toggle in newsletter settings. Clicking it would do nothing.

Now, if comments are enabled (for all members, or paid members), it will
show; if they're not, it won't.



https://github.com/user-attachments/assets/80b8e2dc-a0ed-40bc-ada5-40141676e38b
2024-11-04 16:18:04 +01:00
Sodbileg Gansukh
264e362e06
Fixed sticky unsubscribe from all button on mobile (#21514)
ref DES-785
2024-11-04 11:41:16 +00:00
Sanne de Vries
d32cae4284
Hide sorting form when there is one or zero comments (#21513)
REF PLG-250
2024-11-04 12:33:26 +01:00
Sanne de Vries
599a526dd7
Used comment count to determine which text to show in the CTA box (#21512)
REF PLG-251
- This change uses commentCount instead of isFirst to ensure that the
CTA box text is correct regardless of layout.
2024-11-04 12:07:23 +01:00
Michael Barrett
0316c3f16e
Updated admin-x-activitypub to use consistent URL encoding (#21493)
refs
[TryGhost/ActivityPub](https://github.com/TryGhost/ActivityPub/pull/103)

Updated the API requests made by the `admin-x-activitypub` app to use
consistent URL encoding when making requests to the ActivityPub API
2024-11-04 10:40:06 +00:00
Sanne de Vries
73884e8f69
Added CTA popup to comments like button (#21484)
REF PLG-246
- Whenever a user clicks the like button and they are not allowed to
like comments (either not signed in or not a paid member) we now show a
CTA popup asking them to sign in or upgrade to a paid membership.

---------

Co-authored-by: Kevin Ansfield <kevin@ghost.org>
2024-11-04 11:29:31 +01:00
Sodbileg Gansukh
c9f5b72b3c
Made visual updates to the custom fonts selector (#21510)
ref DES-930
2024-11-04 16:42:04 +08:00
Princi Vershwal
a57d364d32
🐛 Fixed "Unsaved post" modal shown when updating visibility in post settings (#21511)
Ref:
https://linear.app/ghost/issue/ENG-661/unsaved-changes-when-post-has-not-been-edited
2024-11-04 07:42:47 +00:00
Princi Vershwal
d91869e640
🐛 Fixed post not being saved when updating tags (#21503)
Ref:
https://linear.app/ghost/issue/ENG-661/unsaved-changes-when-post-has-not-been-edited
2024-11-04 06:38:49 +00:00
Ronald Langeveld
d675dec74e
Bump Comments-UI to 0.21.7 (#21508)
no issue
2024-11-04 02:49:21 +00:00
Ronald Langeveld
fd463f69bd
Bumped Comments UI to 0.21.0 (#21445)
ref PLG-220
2024-11-04 02:40:14 +00:00
Ronald Langeveld
6742b20215
Fixed sorting by best Comment with pagination (#21506)
ref PLG-220

- Added an `orderAttributes` override method to be able to pass
`count__likes` to the `findPage` DB helper.
- Unknowingly, without that override method in the model, it would strip
all 'non-default' queries.
- Adding that means we could remove our custom database queries and use
the regular `findPage` helper that also handles pagination.
2024-11-04 00:50:53 +00:00
Cathy Sarisky
8f9a89c1a5
🎨 Updated Portal to accept data-locale (#21420)
no issue

This change adds the ability to pass a desired language/locale into
portal, as a data-locale tag added to the script that loads it.

Falls back to the previous behavior, loading from the site settings, if
no data-locale is present. (And then to 'en', if necessary.) No change
in expected behavior if data-locale is not passed.

This provides an option to run portal in a language other than the
sitewide language.

(ref: https://app.slack.com/client/T025584C4/C018EKC56JF)
2024-11-02 14:19:46 +00:00
Ghost CI
41041f9b96 v5.99.0 2024-11-01 15:05:35 +00:00
renovate[bot]
03f65afebb Update dependency webpack to v5.96.1 2024-11-01 12:28:55 +00:00
renovate[bot]
8541e8501c Update dependency webpack to v5.96.0 2024-10-31 23:50:19 +00:00
Michael Barrett
b90e16219d
Refactored collection retrieval in admin-x-activitypub (#21491)
no refs

Refactored collection retrieval to reduce code duplication and
complexity
2024-10-31 20:31:20 +00:00
renovate[bot]
4c79887b79 Update dependency compression to v1.7.5 2024-10-31 16:49:11 +00:00
Hannah Wolfe
fe2cff4e1d
Moved search i18n behind labs flag (#21488)
- When we added i18n for search we missed gating it behind the i18n flag. 
- There aren't that many translations for search yet, so it's likely not many have noticed yet
- We'll remove the flag soon, but until then, adding the flag for consistency :)
2024-10-31 16:36:44 +00:00
Michael Barrett
3ecfe08e1d
Added failure state for reply in admin-x-activitypub (#21487)
no refs

Added a failure state for when a reply fails to be sent
2024-10-31 16:34:53 +00:00
Cathy Sarisky
f601ab3fda
Added "exclude" option for customizing {{ghost_head}} (#21229)
no ref

{{ghost_head}} is huge, and some power-users and theme creators want the
ability to customize what it contains. This PR makes it easier for a
theme to write custom schema, or to load a custom version of
portal/comments/search/etc, or to minimize load times by not loading
scripts where they aren't needed, in a theme-specific way.

Because ghost_head is controlled at the theme level, this gives folks in
managed hosting the new ability to load a different version of the
included app scripts (by preventing ghost_head from writing them and
adding them in manually).

Usage example: ` {{ghost_head exclude="search,portal"}} `

(empty array)
	No changes to current behavior

search
	The built-in sodo-search script
Includes adding the click event listener on buttons, generating the
search index, and the UI.

portal
	The portal script
Handles sign-in and sign-up, payments, tips, memberships, etc, and all
the portal data-attributes.

announcement
	The announcement bar javascript
If you'd like to use the announcement bar admin settings but not have it
[mess up your CLS
metric](https://www.spectralwebservices.com/blog/announcement-bar-a-review/),
this is for you.

metadata
Skips HTML tags for meta description, favicon, canonical url, robots,
referrer
	Important for SEO

schema
	The LD+JSON schema
	Important for SEO

card_assets
	Loads cards.min.css and .js
Needed on any page with a post body, unless your theme replaces them
all. Assets can also be selectively loaded with the [card_assets
override](https://ghost.org/docs/themes/content/?ref=spectralwebservices.com#editor-cards)

comment_counts
	Loads the comment_counts helper
Needed if the page is using {{comments}} or data-ghost-comment-count
attribute

social_data
Produces the og: and twitter: attributes for social media sharing and
previews
	Required for good social media cards

cta_styles
	Removes the call to action (CTA) styles
Used for member signup and CTA cards - may be overwritten by your theme
already
2024-10-31 15:32:34 +00:00
Kevin Ansfield
7e50a4051f Improved error log when Twitter enhanced oembed fails
ref https://linear.app/ghost/issue/ONC-506

- adding `context` with the returned API response makes the logged error much more useful as without it we only log the status code which misses any details for why the failure occurred
2024-10-31 14:21:46 +00:00
Cathy Sarisky
1d429b8b09
🌐Added i18n for newsletter strings (#21433)
no issue

This PR adds the ability to translate the strings that appear in the
newsletter as boilerplate text, using i18next.

Variables are in single mustaches ( `{date}` ) in the translation
strings (rather than `{{date}}`), because these strings occur both the
email template.hbs and also .js files. That necessitated a separate
namespace.

This PR also includes changes to the newsletter button ("more like
this", "less like this", "comment") that were previously delivered on
desktop as images that included the text. @sanne-san provided a rework
that removed text-as-image from the desktop buttons, and allows more
shared code between the two layouts, along with making the buttons
translatable.

Example usage - handlebars
```
<h3 class="latest-posts-header">{{t 'Keep reading'}}</h3>

{{{t 'By {authors}' authors=post.authors }}} 
```
(NOTE: triple { required because of possible & )

Example usage - javascript
```
                getValue: (member) => {
                    if (member.status === 'comped') {
                        return t('complimentary');
                    }
                    if (this.isMemberTrialing(member)) {
                        return t('trialing');
                    }
                    // other possible statuses: t('free'), t('paid') //
                    return t(member.status);
                }
```

---------

Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
Co-authored-by: Steve Larson <9larsons@gmail.com>
2024-10-31 08:41:39 -05:00
Michael Barrett
dd2ed27d9d
Removed unused useAllActivitiesForUser hook and related code in admin-x-activitypub app (#21482)
no refs

Removed unused `useAllActivitiesForUser` hook and related code. This was
a left over from when we added paginated activities
2024-10-31 11:40:41 +00:00
renovate[bot]
085afdeb74 Pin dependency clsx to 2.1.1 2024-10-31 11:02:29 +00:00
Djordje Vlaisavljevic
45711e197c
AP design bugs (#21395)
- Fixed links in profile description
- Stripped post content
- Fixed grey bg in Avatars
- Installed `clsx`

---------

Co-authored-by: Michael Barrett <mike@ghost.org>
2024-10-31 10:50:51 +00:00
renovate[bot]
4f4662490f
Update Koenig packages (#21480) 2024-10-31 10:11:27 +00:00
Djordje Vlaisavljevic
824efc7f10
Added UUID as data attribute to posts in all views (#21470)
ref
https://linear.app/ghost/issue/AP-404/add-uuid-as-a-data-attribute-in-the-dom-for-easier-db-lookup

- This will allow us to find posts in the DB

Co-authored-by: Michael Barrett <mike@ghost.org>
2024-10-31 10:07:52 +00:00
Djordje Vlaisavljevic
becfd13141
Refactored handleViewContent so it can be reused (#21468)
ref
https://linear.app/ghost/issue/AP-540/clicking-comment-icon-on-posts-and-likes-tabs-of-your-profile-doesnt

- We want to open posts in the drawer from multiple views (Inbox,
Profile etc.) and this change allows us to do so by pulling
`handleViewContent` from `Inbox.tsx` into a utility function. At the
same time, we’ve simplified the function so it uses less props to
achieve the same functionality.
- Also added a simple fix for scrolling the reply-box into view when
opening a long `article` by clicking on the reply icon. We probably
still need to figure out a more robust solution, because the height of
the `iframe` and the fact it takes some time to load it sometimes gets
in the way.

Co-authored-by: Michael Barrett <mike@ghost.org>
2024-10-31 09:58:47 +00:00
Michael Barrett
5f59ddaacc
Updated replies implementation to use thread mechanism in admin-x-activitypub (#21465)
refs:

- https://linear.app/ghost/issue/AP-439/seeing-parent-post-for-replies
- https://linear.app/ghost/issue/AP-481/reply-ui
-
https://linear.app/ghost/issue/AP-482/replies-to-a-post-should-be-visible-when-opening-it

Updated the replies implementation to make use of the new thread
mechanism. This allows for a more sane approach to handling replies as
well as making it possible to show the parent of a reply in the UI

---------

Co-authored-by: Djordje Vlaisavljevic <dzvlais@gmail.com>
2024-10-31 09:38:52 +00:00
Daniel Lockyer
ea6d3a0f26 ️ Optimized fetching strings from the settings cache
fix https://linear.app/ghost/issue/ENG-1105/settingscacheget-is-slow

- through profiling and flamegraphs, we can see that `_doGet` is one of
  the bottlenecks during high traffic times, sometimes taking up to 20%
  of the CPU time when hammering Ghost with `wrk`
- this is because, for the majority of settings cache lookup, we're
  running `JSON.parse`, which blocks the main thread
- whilst we're only parsing small strings, we're doing it a LOT,
  sometimes hundreds of times per request, which adds up
- this code just throws most deserializing at `JSON.parse`, so if we can
  stop it from doing that, it'd be a huge win
- my initial attempts here were to convert the _doGet function to a
  smarter deserializing, by looking up `cacheEntry.type` and acting
  accordingly
- however, it became a bit of a logical nightmare, and difficult to
  reason about for now (i still think we should do it)
- therefore, I'm just doing to add a hotpath fix to catch 99% of
  usecases, which is checking the type of the cache entry and returning
  the value if it's a string
- on a trivial benchmark locally, this causes Ghost to return 30% more
  requests per second!!
2024-10-31 10:13:10 +01:00
Sodbileg Gansukh
fa31176621
Removed Prata font (#21478)
ref DES-926
2024-10-31 05:43:39 +00:00
Sodbileg Gansukh
e01b952ed2
Made the tabs sticky in design and newsletter settings (#21477)
ref DES-927, DES-928
2024-10-31 13:30:25 +08:00
Ronald Langeveld
87e24f6403
Revert "Enhanced Comments Ordering for Best Liked Sorting (#21473)" (#21475)
This reverts commit fd18a39238.
2024-10-31 03:28:44 +00:00