From 6035670cc0ac6907ab511d53e98739948493f7c2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 17 Jul 2026 07:57:12 +0200 Subject: [PATCH 1/7] Update dependency ws to v8.21.1 (#39839) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 71a7398983..e8599c6a51 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15089,8 +15089,8 @@ __metadata: linkType: hard "ws@npm:^8.12.1, ws@npm:^8.18.0, ws@npm:^8.19.0, ws@npm:^8.21.0": - version: 8.21.0 - resolution: "ws@npm:8.21.0" + version: 8.21.1 + resolution: "ws@npm:8.21.1" peerDependencies: bufferutil: ^4.0.1 utf-8-validate: ">=5.0.2" @@ -15099,7 +15099,7 @@ __metadata: optional: true utf-8-validate: optional: true - checksum: 10c0/ef4a243476283fc49bc7550966c4af4aa0eef56273837211e700de3b664e08604a760cdddcb5ba43c049140e74ccfec5b0ee0bb439e08c2adf9138902fdde5f9 + checksum: 10c0/c4c6f1d95f6d465262de2037c57c715725d67e078dd49420ede4e19115668aba159cb64d85c5e89c06eb2826be599e62e5095860ad6cc54ff42e8bd7684e1db8 languageName: node linkType: hard From 0a45b0fdb8acc51cec124a0e3087654ffa985bb6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 17 Jul 2026 08:44:14 +0200 Subject: [PATCH 2/7] New Crowdin Translations (automated) (#39855) Co-authored-by: GitHub Actions --- app/javascript/mastodon/locales/eu.json | 2 +- app/javascript/mastodon/locales/th.json | 2 ++ config/locales/de.yml | 11 +++++++++++ config/locales/simple_form.de.yml | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/locales/eu.json b/app/javascript/mastodon/locales/eu.json index aa0c8b4363..dc089c6d94 100644 --- a/app/javascript/mastodon/locales/eu.json +++ b/app/javascript/mastodon/locales/eu.json @@ -1166,7 +1166,7 @@ "status.reblog_private": "Partekatu berriz zure jarraitzaileekin", "status.reblogged_by": "{name}(r)en bultzada", "status.reblogs.empty": "Inork ez dio bultzada eman bidalketa honi oraindik. Inork egiten badu, hemen agertuko da.", - "status.reblogs_count": "{count, plural, one {{counter} bultzaeda} other {{counter} bultzaeda}}", + "status.reblogs_count": "{count, plural, one {{counter} bultzada} other {{counter} bultzada}}", "status.redraft": "Ezabatu eta berridatzi", "status.remove_bookmark": "Kendu laster-marka", "status.remove_favourite": "Kendu gogokoetatik", diff --git a/app/javascript/mastodon/locales/th.json b/app/javascript/mastodon/locales/th.json index eda9616031..e6622b9b4a 100644 --- a/app/javascript/mastodon/locales/th.json +++ b/app/javascript/mastodon/locales/th.json @@ -40,6 +40,8 @@ "account.familiar_followers_two": "ติดตามโดย {name1} และ {name2}", "account.featured": "น่าสนใจ", "account.featured.accounts": "โปรไฟล์", + "account.filters.boosts_toggle": "แสดงการดัน", + "account.filters.posts_only": "โพสต์", "account.follow": "ติดตาม", "account.follow_back": "ติดตามกลับ", "account.follow_back_short": "ติดตามกลับ", diff --git a/config/locales/de.yml b/config/locales/de.yml index 763ce513c7..40bb9af0c4 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1013,6 +1013,7 @@ de: critical_update: Kritisch — bitte zügig aktualisieren description: Es wird empfohlen, deine Mastodon-Installation auf dem aktuellen Stand zu halten, um von den neuesten Fehlerkorrekturen und Funktionen zu profitieren. Darüber hinaus ist es wichtig, Mastodon zeitnah zu aktualisieren, um Sicherheitslücken zu schließen. Aus diesen Gründen prüft Mastodon alle 30 Minuten auf Updates und du wirst deinen Einstellungen entsprechend per E-Mail informiert. documentation_link: Mehr erfahren + nearing_eol: Der aktuelle Branch wird ab dem %{date} nicht mehr unterstützt. Bitte ziehe eine Aktualisierung in Erwägung. release_notes: Versionshinweise supported_until: Support endet am %{date} title: Verfügbare Updates @@ -1021,6 +1022,7 @@ de: major: Hauptversion minor: Nebenversion patch: Revision — Fehlerkorrekturen und einfach zu implementierende Änderungen + unsupported_branch: Der aktuelle Branch wird nicht mehr unterstützt. Bitte führe so bald wie möglich eine Aktualisierung durch. unsupported_since: Nicht mehr unterstützt seit %{date} version: Version statuses: @@ -1287,6 +1289,15 @@ de: auto_close_registrations: body: Aufgrund fehlender Aktivität von Moderator*innen müssen neue Registrierungen auf %{instance} jetzt manuell genehmigt werden. Dies wurde automatisch umgestellt, damit %{instance} nicht als Plattform für Böswillige missbraucht werden kann. Du kannst jederzeit auf uneingeschränkte Registrierungen zurückwechseln. subject: Registrierungen auf %{instance} müssen ab jetzt manuell genehmigt werden (automatisch umgestellt) + end_of_support_out_of_support_warning: + body: Die derzeitige Mastodon-Version wird nicht mehr unterstützt. Bitte führe so bald wie möglich eine Aktualisierung durch! + subject: Mastodon %{branch} auf %{instance} wird nicht länger unterstützt! + end_of_support_three_months_warning: + body: Die derzeitige Mastodon-Version wird in 3 Monaten nicht mehr unterstützt. Bitte führe so bald wie möglich eine Aktualisierung auf einen neueren Branch durch. + subject: Mastodon %{branch} auf %{instance} wird in 3 Monaten nicht mehr unterstützt. + end_of_support_two_weeks_warning: + body: Die derzeitige Mastodon-Version wird in 2 Wochen nicht mehr unterstützt. Bitte führe so bald wie möglich eine Aktualisierung auf einen neueren Branch durch. + subject: Mastodon %{branch} auf %{instance} wird in 2 Wochen nicht mehr unterstützt. new_appeal: actions: delete_statuses: das Löschen der Beiträge diff --git a/config/locales/simple_form.de.yml b/config/locales/simple_form.de.yml index fc1609442c..ba0fa18b53 100644 --- a/config/locales/simple_form.de.yml +++ b/config/locales/simple_form.de.yml @@ -345,6 +345,7 @@ de: notification_emails: appeal: Jemand hat Einspruch gegen eine Maßnahme erhoben digest: Zusammenfassung senden + end_of_support: Die derzeitige Mastodon-Version wird bald nicht mehr unterstützt favourite: Jemand favorisierte meinen Beitrag follow: Ein neues Profil folgt mir follow_request: Jemand möchte mir folgen From e95b87ed8700b586f6734578f263acfd7ad6a6cc Mon Sep 17 00:00:00 2001 From: diondiondion Date: Fri, 17 Jul 2026 10:40:35 +0200 Subject: [PATCH 3/7] Add design tokens for 5.0 redesign (#39848) --- .../components/_theme_playground/index.tsx | 1 + .../theme_playground.module.scss | 67 +++++++---- app/javascript/styles/application.scss | 2 +- app/javascript/styles/mastodon/_mixins.scss | 110 ++++++++++++++++++ .../styles/mastodon/_variables.scss | 7 -- .../styles/mastodon/components.scss | 11 +- .../styles/mastodon/tokens/_shape.scss | 22 ++++ .../styles/mastodon/tokens/_type.scss | 25 ++++ .../mastodon/{theme => tokens}/index.scss | 15 ++- .../mastodon/{ => tokens}/theme/_base.scss | 0 .../mastodon/{ => tokens}/theme/_dark.scss | 0 .../mastodon/{ => tokens}/theme/_light.scss | 0 .../mastodon/{ => tokens}/theme/_utils.scss | 0 13 files changed, 221 insertions(+), 39 deletions(-) create mode 100644 app/javascript/styles/mastodon/tokens/_shape.scss create mode 100644 app/javascript/styles/mastodon/tokens/_type.scss rename app/javascript/styles/mastodon/{theme => tokens}/index.scss (67%) rename app/javascript/styles/mastodon/{ => tokens}/theme/_base.scss (100%) rename app/javascript/styles/mastodon/{ => tokens}/theme/_dark.scss (100%) rename app/javascript/styles/mastodon/{ => tokens}/theme/_light.scss (100%) rename app/javascript/styles/mastodon/{ => tokens}/theme/_utils.scss (100%) diff --git a/app/javascript/mastodon/components/_theme_playground/index.tsx b/app/javascript/mastodon/components/_theme_playground/index.tsx index 630ad15af5..efa2d540d2 100644 --- a/app/javascript/mastodon/components/_theme_playground/index.tsx +++ b/app/javascript/mastodon/components/_theme_playground/index.tsx @@ -55,6 +55,7 @@ export const ThemePlayground: React.FC = () => {
Test 1 2 3
+
Hello World
); }; diff --git a/app/javascript/mastodon/components/_theme_playground/theme_playground.module.scss b/app/javascript/mastodon/components/_theme_playground/theme_playground.module.scss index 1e892f9d59..bac775034a 100644 --- a/app/javascript/mastodon/components/_theme_playground/theme_playground.module.scss +++ b/app/javascript/mastodon/components/_theme_playground/theme_playground.module.scss @@ -1,11 +1,13 @@ +@use '@/styles/mastodon/mixins'; + .wrapper { position: relative; display: grid; grid-template-columns: 250px 1fr; - gap: 1rem; - padding: 2rem; - font-size: 16px; - line-height: 1.5; + gap: var(--space-md); + padding: var(--space-3xl); + font-size: var(--fs-lg); + line-height: var(--lh-normal); overflow-wrap: break-word; color: var(--color-text-primary); background-color: var(--color-bg-blend); @@ -17,18 +19,19 @@ nav { display: block; grid-template-rows: min-content; - font-size: 14px; + font-size: var(--fs-sm); input { display: block; box-sizing: border-box; width: 100%; - margin-block-end: 1rem; - padding: 0.5rem 1rem; + margin-block-end: var(--space-md); + padding: var(--space-xs) var(--space-md); color: var(--color-text-primary); background: transparent; border: 1px solid var(--color-border-primary); - border-radius: 0.5rem; + border-radius: var(--radius-xs); + font: inherit; &:focus { border-color: var(--color-border-brand); @@ -38,9 +41,10 @@ a { display: block; - padding: 0.5rem 1rem 0.45rem; - border-radius: 0.5rem; + padding: var(--space-xs) var(--space-md); + border-radius: var(--radius-xs); color: var(--color-text-secondary); + @include mixins.type-body-compact; &[aria-current='page'] { color: var(--color-text-primary); @@ -55,22 +59,23 @@ 'subtitle button'; grid-template-columns: 1fr min-content; align-items: center; - gap: 0.125rem 0.5rem; - margin-block-start: 1rem; - padding: 0.75rem 1rem; - line-height: 1.2; - border-radius: 1rem; - background-color: var(--color-bg-highlight); + gap: var(--space-3xs) var(--space-xs); + margin-block-start: var(--space-md); + padding: var(--space-sm) var(--space-md); + border-radius: var(--radius-md); + border: 1px solid var(--color-border-primary); h2 { grid-area: title; - font-size: 16px; - font-weight: bold; + @include mixins.type-body; + + line-height: var(--lh-tighter); } .subtitle { grid-area: subtitle; - font-size: 12px; + @include mixins.type-label-sm; + color: var(--color-text-secondary); overflow: hidden; text-overflow: ellipsis; @@ -84,15 +89,31 @@ width: 32px; height: 32px; border: none; - background-color: var(--color-bg-highlight); - border-radius: 99rem; + background-color: transparent; + border-radius: var(--radius-round); + + &:hover { + background-color: var(--color-bg-highlight); + } } } } main { - padding: 2rem; + padding: var(--space-3xl); background-color: var(--color-bg-primary); - border-radius: 1rem; + border-radius: var(--radius-md); + } + + .overlay { + position: absolute; + inset: auto var(--space-md) var(--space-md) auto; + width: 30%; + height: 35%; + padding: var(--space-md); + background-color: var(--color-bg-primary); + border-radius: var(--radius-xl); + + @include mixins.elevation-2; } } diff --git a/app/javascript/styles/application.scss b/app/javascript/styles/application.scss index aca615414f..bdbe8f067c 100644 --- a/app/javascript/styles/application.scss +++ b/app/javascript/styles/application.scss @@ -4,7 +4,7 @@ @use 'fonts/roboto-mono'; @use 'mastodon/reset'; -@use 'mastodon/theme'; +@use 'mastodon/tokens'; @use 'mastodon/basics'; @use 'mastodon/branding'; @use 'mastodon/containers'; diff --git a/app/javascript/styles/mastodon/_mixins.scss b/app/javascript/styles/mastodon/_mixins.scss index afc52329f2..0a12333732 100644 --- a/app/javascript/styles/mastodon/_mixins.scss +++ b/app/javascript/styles/mastodon/_mixins.scss @@ -1,3 +1,113 @@ +/** + * Type styles + */ + +@mixin type-heading-lg { + // font-family: Syne; + font-size: var(--fs-3xl); + font-weight: bold; + line-height: var(--lh-tighter); + letter-spacing: var(--ls-tighter); +} + +@mixin type-heading-md { + // font-family: Syne; + font-size: var(--fs-2xl); + font-weight: bold; + line-height: var(--lh-tighter); + letter-spacing: var(--ls-tight); +} + +@mixin type-heading-sm { + // font-family: Syne; + font-size: var(--fs-xl); + font-weight: bold; + line-height: var(--lh-tight); + letter-spacing: var(--ls-tight); +} + +@mixin type-body-lg { + // font-family: Inter; + font-size: var(--fs-lg); + font-weight: normal; + line-height: var(--lh-normal); + letter-spacing: var(--ls-normal); +} + +@mixin type-body-strong { + // font-family: Inter; + font-size: var(--fs-md); + font-weight: bold; + line-height: var(--lh-normal); + letter-spacing: var(--ls-normal); +} + +@mixin type-body { + // font-family: Inter; + font-size: var(--fs-md); + font-weight: normal; + line-height: var(--lh-normal); + letter-spacing: var(--ls-normal); +} + +@mixin type-body-compact { + // font-family: Inter; + font-size: var(--fs-sm); + font-weight: normal; + line-height: var(--lh-tight); + letter-spacing: var(--ls-normal); +} + +@mixin type-label-lg { + // font-family: Inter; + font-size: var(--fs-sm); + font-weight: bold; + line-height: var(--lh-tight); + letter-spacing: var(--ls-normal); +} + +@mixin type-label-md { + // font-family: Inter; + font-size: var(--fs-xs); + font-weight: normal; + line-height: var(--lh-tighter); + letter-spacing: var(--ls-loose); +} + +@mixin type-label-sm { + // font-family: Inter; + font-size: var(--fs-2xs); + font-weight: normal; + line-height: var(--lh-tighter); + letter-spacing: var(--ls-loose); +} + +@mixin type-micro { + // font-family: 'JetBrains Mono'; + font-size: var(--fs-3xs); + font-weight: normal; + line-height: var(--lh-tighter); + letter-spacing: var(--ls-looser); +} + +/** + * Elevation styles + */ + +@mixin elevation-1 { + border: 1px solid var(--color-border-strong); + box-shadow: 0 1px 0 var(--color-border-strong); +} + +@mixin elevation-2 { + border: 1px solid var(--color-border-strong); + box-shadow: 1px 2px 0 var(--color-border-strong); +} + +/** + * Search input styles + */ + @mixin search-input { box-sizing: border-box; width: 100%; diff --git a/app/javascript/styles/mastodon/_variables.scss b/app/javascript/styles/mastodon/_variables.scss index 7a947891d5..f0b12a373f 100644 --- a/app/javascript/styles/mastodon/_variables.scss +++ b/app/javascript/styles/mastodon/_variables.scss @@ -9,17 +9,10 @@ $cjk-langs: ja, ko, zh-CN, zh-HK, zh-TW; // Language codes that is written vertically $vertical-lr-langs: mn-Mong; -// Variables for components -$media-modal-media-max-width: 100%; - -// put margins on top and bottom of image to avoid the screen covered by image. -$media-modal-media-max-height: 80%; - $no-gap-breakpoint: 1175px; $mobile-menu-breakpoint: 760px; $mobile-breakpoint: 630px; $no-columns-breakpoint: 600px; $font-sans-serif: 'mastodon-font-sans-serif' !default; -$font-display: 'mastodon-font-display' !default; $font-monospace: 'mastodon-font-monospace' !default; diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 537afdb1a9..b7c4efc172 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -2688,6 +2688,9 @@ a.account__display-name { } .zoomable-image { + --media-max-width: 100%; + --media-max-height: 80%; + position: relative; width: 100%; height: 100%; @@ -2699,8 +2702,8 @@ a.account__display-name { user-select: none; img { - max-width: $media-modal-media-max-width; - max-height: $media-modal-media-max-height; + max-width: var(--media-max-width); + max-height: var(--media-max-height); width: auto; height: auto; outline: 1px solid var(--color-border-media); @@ -2729,8 +2732,8 @@ a.account__display-name { } &__preview { - max-width: $media-modal-media-max-width; - max-height: $media-modal-media-max-height; + max-width: var(--media-max-width); + max-height: var(--media-max-height); position: absolute; z-index: 1; outline: 1px solid var(--color-border-media); diff --git a/app/javascript/styles/mastodon/tokens/_shape.scss b/app/javascript/styles/mastodon/tokens/_shape.scss new file mode 100644 index 0000000000..66f1cb96b9 --- /dev/null +++ b/app/javascript/styles/mastodon/tokens/_shape.scss @@ -0,0 +1,22 @@ +@mixin space { + --space-3xs: 2px; + --space-2xs: 4px; + --space-xs: 8px; + --space-sm: 12px; + --space-md: 16px; + --space-lg: 20px; + --space-xl: 24px; + --space-2xl: 28px; + --space-3xl: 32px; + --space-4xl: 36px; + --space-5xl: 40px; +} + +@mixin radius { + --radius-xs: 8px; + --radius-sm: 12px; + --radius-md: 16px; + --radius-lg: 20px; + --radius-xl: 28px; + --radius-round: calc(1px * infinity); +} diff --git a/app/javascript/styles/mastodon/tokens/_type.scss b/app/javascript/styles/mastodon/tokens/_type.scss new file mode 100644 index 0000000000..99865d5d6f --- /dev/null +++ b/app/javascript/styles/mastodon/tokens/_type.scss @@ -0,0 +1,25 @@ +@mixin font-size { + --fs-3xs: 0.6875rem; // 11px + --fs-2xs: 0.75rem; // 12px + --fs-xs: 0.8125rem; // 13px + --fs-sm: 0.875rem; // 14px + --fs-md: 0.9375rem; // 15px + --fs-lg: 1rem; // 16px + --fs-xl: 1.25rem; // 20px + --fs-2xl: 1.375rem; // 22px + --fs-3xl: 1.625rem; // 26px +} + +@mixin line-height { + --lh-tighter: 1.3; + --lh-tight: 1.4; + --lh-normal: 1.6; +} + +@mixin letter-spacing { + --ls-tighter: -0.02em; + --ls-tight: -0.01em; + --ls-normal: 0; + --ls-loose: 0.01em; + --ls-looser: 0.02em; +} diff --git a/app/javascript/styles/mastodon/theme/index.scss b/app/javascript/styles/mastodon/tokens/index.scss similarity index 67% rename from app/javascript/styles/mastodon/theme/index.scss rename to app/javascript/styles/mastodon/tokens/index.scss index a84b8b80da..d0e283d27a 100644 --- a/app/javascript/styles/mastodon/theme/index.scss +++ b/app/javascript/styles/mastodon/tokens/index.scss @@ -1,10 +1,17 @@ -@use 'base'; -@use 'dark'; -@use 'light'; -@use 'utils'; +@use 'theme/base'; +@use 'theme/dark'; +@use 'theme/light'; +@use 'theme/utils'; +@use 'shape'; +@use 'type'; html { @include base.palette; + @include shape.space; + @include shape.radius; + @include type.font-size; + @include type.line-height; + @include type.letter-spacing; } [data-color-scheme='dark'], diff --git a/app/javascript/styles/mastodon/theme/_base.scss b/app/javascript/styles/mastodon/tokens/theme/_base.scss similarity index 100% rename from app/javascript/styles/mastodon/theme/_base.scss rename to app/javascript/styles/mastodon/tokens/theme/_base.scss diff --git a/app/javascript/styles/mastodon/theme/_dark.scss b/app/javascript/styles/mastodon/tokens/theme/_dark.scss similarity index 100% rename from app/javascript/styles/mastodon/theme/_dark.scss rename to app/javascript/styles/mastodon/tokens/theme/_dark.scss diff --git a/app/javascript/styles/mastodon/theme/_light.scss b/app/javascript/styles/mastodon/tokens/theme/_light.scss similarity index 100% rename from app/javascript/styles/mastodon/theme/_light.scss rename to app/javascript/styles/mastodon/tokens/theme/_light.scss diff --git a/app/javascript/styles/mastodon/theme/_utils.scss b/app/javascript/styles/mastodon/tokens/theme/_utils.scss similarity index 100% rename from app/javascript/styles/mastodon/theme/_utils.scss rename to app/javascript/styles/mastodon/tokens/theme/_utils.scss From de2cf76e4a10b7f1ebe6c4ea509985272dfc1e89 Mon Sep 17 00:00:00 2001 From: diondiondion Date: Fri, 17 Jul 2026 11:22:43 +0200 Subject: [PATCH 4/7] Fix swapped order of "accept/reject" actions in follow requests (#39862) --- .../components/notification_follow_request.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/javascript/mastodon/features/notifications_v2/components/notification_follow_request.tsx b/app/javascript/mastodon/features/notifications_v2/components/notification_follow_request.tsx index 5f61f2cd78..1ca24d0427 100644 --- a/app/javascript/mastodon/features/notifications_v2/components/notification_follow_request.tsx +++ b/app/javascript/mastodon/features/notifications_v2/components/notification_follow_request.tsx @@ -61,18 +61,18 @@ export const NotificationFollowRequest: React.FC<{ const actions = ( <> - + ); From 86a7f955346d2428ac799b878bd02b17a083c118 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 17 Jul 2026 12:41:59 +0200 Subject: [PATCH 5/7] Fix suspended accounts not being removed from follow request count in `/api/v1/accounts/verify_credentials` (#39858) --- app/serializers/rest/credential_account_serializer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/serializers/rest/credential_account_serializer.rb b/app/serializers/rest/credential_account_serializer.rb index 0bbb7792cd..2828f60fbf 100644 --- a/app/serializers/rest/credential_account_serializer.rb +++ b/app/serializers/rest/credential_account_serializer.rb @@ -14,7 +14,7 @@ class REST::CredentialAccountSerializer < REST::AccountSerializer language: user.setting_default_language, note: object.note, fields: object.fields.map(&:to_h), - follow_requests_count: FollowRequest.where(target_account: object).limit(40).count, + follow_requests_count: Account.without_suspended.joins(:follow_requests).where(follow_requests: { target_account: object }).limit(40).count, hide_collections: object.hide_collections, discoverable: object.discoverable, indexable: object.indexable, From 53c3508ea0e83cd687bea44a7d9ac806a583c23e Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 17 Jul 2026 16:11:37 +0200 Subject: [PATCH 6/7] Fix `account` and `keypair` fabricators not working outside of rspec (#39866) --- spec/fabricators/account_fabricator.rb | 2 ++ spec/fabricators/keypair_fabricator.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/spec/fabricators/account_fabricator.rb b/spec/fabricators/account_fabricator.rb index e12c01dea5..9e10a0d64e 100644 --- a/spec/fabricators/account_fabricator.rb +++ b/spec/fabricators/account_fabricator.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require_relative '../support/signing_keys_helpers' + Fabricator(:account) do transient :suspended, :silenced, :legacy_keypair username { sequence(:username) { |i| "#{Faker::Internet.user_name(separators: %w(_))}#{i}" } } diff --git a/spec/fabricators/keypair_fabricator.rb b/spec/fabricators/keypair_fabricator.rb index 694e9b4e8f..39461ed0cb 100644 --- a/spec/fabricators/keypair_fabricator.rb +++ b/spec/fabricators/keypair_fabricator.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require_relative '../support/signing_keys_helpers' + Fabricator(:keypair) do account { Fabricate(:account, keypairs: []) } type :rsa From 9edbe4706a94daa2ad63ee3ec6f1241cc4dd0456 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 17 Jul 2026 16:44:20 +0200 Subject: [PATCH 7/7] Delete remote accounts when fetching their URI leads to a 410 (#39865) --- app/helpers/json_ld_helper.rb | 2 +- .../activitypub/fetch_remote_actor_service.rb | 16 ++++++- .../fetch_remote_actor_service_spec.rb | 45 +++++++++++++++++++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/app/helpers/json_ld_helper.rb b/app/helpers/json_ld_helper.rb index f3361ee206..0858d168c0 100644 --- a/app/helpers/json_ld_helper.rb +++ b/app/helpers/json_ld_helper.rb @@ -233,7 +233,7 @@ module JsonLdHelper # If an error is raised, it contains the response and can be captured for handling like # # begin - # fetch_resource_without_id_validation(uri, nil, true) + # fetch_resource_without_id_validation(uri, raise_on_error: :all) # rescue Mastodon::UnexpectedResponseError => e # e.response # end diff --git a/app/services/activitypub/fetch_remote_actor_service.rb b/app/services/activitypub/fetch_remote_actor_service.rb index efb9b9b64b..2c7381dd97 100644 --- a/app/services/activitypub/fetch_remote_actor_service.rb +++ b/app/services/activitypub/fetch_remote_actor_service.rb @@ -15,10 +15,14 @@ class ActivityPub::FetchRemoteActorService < BaseService @json = begin if prefetched_body.nil? - fetch_resource(uri, true) + fetch_resource(uri, true, raise_on_error: :all) else body_to_json(prefetched_body, compare_id: uri) end + rescue Mastodon::UnexpectedResponseError => e + queue_deletion!(uri) if e.response.code == 410 + + raise Error, "Error fetching actor JSON at #{uri} (HTTP #{e.response.code})" rescue JSON::ParserError raise Error, "Error parsing JSON-LD document #{uri}" end @@ -39,6 +43,16 @@ class ActivityPub::FetchRemoteActorService < BaseService private + def queue_deletion!(uri) + account = Account.find_by(uri:) + return unless account&.remote? + + Rails.logger.debug { "Deleting actor #{uri} because of HTTP 410 response" } + + account.suspend!(origin: :remote) + AccountDeletionWorker.perform_async(account.id, { 'reserve_username' => false, 'skip_activitypub' => true }) + end + def supported_context? super(@json) end diff --git a/spec/services/activitypub/fetch_remote_actor_service_spec.rb b/spec/services/activitypub/fetch_remote_actor_service_spec.rb index f1dc327fab..49eea0ede4 100644 --- a/spec/services/activitypub/fetch_remote_actor_service_spec.rb +++ b/spec/services/activitypub/fetch_remote_actor_service_spec.rb @@ -32,6 +32,51 @@ RSpec.describe ActivityPub::FetchRemoteActorService do end end + context 'when the account is already known and the actor document returns a temporary error' do + let!(:known_account) { Fabricate(:remote_account, uri: 'https://example.com/alice') } + + before do + stub_request(:get, 'https://example.com/alice').to_return(status: 500) + end + + it 'returns nil but keeps the existing account intact' do + expect(account).to be_nil + expect(known_account.reload.suspended?).to be false + expect(a_request(:get, 'https://example.com/alice')).to have_been_made.once + expect(AccountDeletionWorker).to_not have_enqueued_sidekiq_job + end + end + + context 'when the account is already known and the actor document returns a 404 not found error' do + let!(:known_account) { Fabricate(:remote_account, uri: 'https://example.com/alice') } + + before do + stub_request(:get, 'https://example.com/alice').to_return(status: 404) + end + + it 'returns nil but keeps the existing account intact' do + expect(account).to be_nil + expect(known_account.reload.suspended?).to be false + expect(a_request(:get, 'https://example.com/alice')).to have_been_made.once + expect(AccountDeletionWorker).to_not have_enqueued_sidekiq_job + end + end + + context 'when the account is already known and the actor document returns a 410 gone error' do + let!(:known_account) { Fabricate(:remote_account, uri: 'https://example.com/alice') } + + before do + stub_request(:get, 'https://example.com/alice').to_return(status: 410) + end + + it 'returns nil and marks the known account for deletion' do + expect(account).to be_nil + expect(known_account.reload.suspended?).to be true + expect(a_request(:get, 'https://example.com/alice')).to have_been_made.once + expect(AccountDeletionWorker).to have_enqueued_sidekiq_job(known_account.id, { 'reserve_username' => false, 'skip_activitypub' => true }) + end + end + context 'when the account does not have a inbox' do before do actor[:inbox] = nil