From 93f5ed0fcecee13a59c2ca9e59c40b60574c0d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heath=20Dutton=F0=9F=95=B4=EF=B8=8F?= Date: Thu, 15 Jan 2026 12:02:17 -0500 Subject: [PATCH 1/5] Fix directory showing load more button when no more profiles exist (#37465) --- app/javascript/mastodon/actions/directory.ts | 13 +++++++++---- .../mastodon/features/directory/index.tsx | 5 ++++- app/javascript/mastodon/reducers/user_lists.js | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/javascript/mastodon/actions/directory.ts b/app/javascript/mastodon/actions/directory.ts index 34ac309c66..a50a377ffc 100644 --- a/app/javascript/mastodon/actions/directory.ts +++ b/app/javascript/mastodon/actions/directory.ts @@ -6,15 +6,17 @@ import { createDataLoadingThunk } from 'mastodon/store/typed_functions'; import { fetchRelationships } from './accounts'; import { importFetchedAccounts } from './importer'; +const DIRECTORY_FETCH_LIMIT = 20; + export const fetchDirectory = createDataLoadingThunk( 'directory/fetch', async (params: Parameters[0]) => - apiGetDirectory(params), + apiGetDirectory(params, DIRECTORY_FETCH_LIMIT), (data, { dispatch }) => { dispatch(importFetchedAccounts(data)); dispatch(fetchRelationships(data.map((x) => x.id))); - return { accounts: data }; + return { accounts: data, isLast: data.length < DIRECTORY_FETCH_LIMIT }; }, ); @@ -26,12 +28,15 @@ export const expandDirectory = createDataLoadingThunk( 'items', ]) as ImmutableList; - return apiGetDirectory({ ...params, offset: loadedItems.size }, 20); + return apiGetDirectory( + { ...params, offset: loadedItems.size }, + DIRECTORY_FETCH_LIMIT, + ); }, (data, { dispatch }) => { dispatch(importFetchedAccounts(data)); dispatch(fetchRelationships(data.map((x) => x.id))); - return { accounts: data }; + return { accounts: data, isLast: data.length < DIRECTORY_FETCH_LIMIT }; }, ); diff --git a/app/javascript/mastodon/features/directory/index.tsx b/app/javascript/mastodon/features/directory/index.tsx index 0fe140b4eb..54317a6c76 100644 --- a/app/javascript/mastodon/features/directory/index.tsx +++ b/app/javascript/mastodon/features/directory/index.tsx @@ -83,6 +83,9 @@ export const Directory: React.FC<{ (state) => state.user_lists.getIn(['directory', 'isLoading'], true) as boolean, ); + const hasMore = useAppSelector( + (state) => !!state.user_lists.getIn(['directory', 'next']), + ); useEffect(() => { void dispatch(fetchDirectory({ order, local })); @@ -182,7 +185,7 @@ export const Directory: React.FC<{ diff --git a/app/javascript/mastodon/reducers/user_lists.js b/app/javascript/mastodon/reducers/user_lists.js index 466bfe54d6..0393c06763 100644 --- a/app/javascript/mastodon/reducers/user_lists.js +++ b/app/javascript/mastodon/reducers/user_lists.js @@ -204,9 +204,9 @@ export default function userLists(state = initialState, action) { else if (fetchFeaturedTags.rejected.match(action)) return state.setIn(['featured_tags', action.meta.arg.accountId, 'isLoading'], false); else if (fetchDirectory.fulfilled.match(action)) - return normalizeList(state, ['directory'], action.payload.accounts, undefined); + return normalizeList(state, ['directory'], action.payload.accounts, action.payload.isLast ? null : true); else if (expandDirectory.fulfilled.match(action)) - return appendToList(state, ['directory'], action.payload.accounts, undefined); + return appendToList(state, ['directory'], action.payload.accounts, action.payload.isLast ? null : true); else if (fetchDirectory.pending.match(action) || expandDirectory.pending.match(action)) return state.setIn(['directory', 'isLoading'], true); From 0d9fcb59a497902373c6293c8a193e46d307f2ff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 10:17:56 +0100 Subject: [PATCH 2/5] New Crowdin Translations (automated) (#37517) Co-authored-by: GitHub Actions --- app/javascript/mastodon/locales/be.json | 1 + app/javascript/mastodon/locales/da.json | 1 + app/javascript/mastodon/locales/de.json | 1 + app/javascript/mastodon/locales/el.json | 1 + app/javascript/mastodon/locales/en-GB.json | 1 + app/javascript/mastodon/locales/es-AR.json | 1 + app/javascript/mastodon/locales/es-MX.json | 1 + app/javascript/mastodon/locales/es.json | 1 + app/javascript/mastodon/locales/fo.json | 1 + app/javascript/mastodon/locales/hu.json | 1 + app/javascript/mastodon/locales/is.json | 1 + app/javascript/mastodon/locales/lt.json | 6 +++--- app/javascript/mastodon/locales/pt-PT.json | 1 + app/javascript/mastodon/locales/sq.json | 1 + app/javascript/mastodon/locales/vi.json | 1 + app/javascript/mastodon/locales/zh-CN.json | 1 + app/javascript/mastodon/locales/zh-TW.json | 1 + config/locales/cy.yml | 1 + config/locales/lt.yml | 2 +- 19 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/javascript/mastodon/locales/be.json b/app/javascript/mastodon/locales/be.json index da4aa54409..caf4939777 100644 --- a/app/javascript/mastodon/locales/be.json +++ b/app/javascript/mastodon/locales/be.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# новы элемент} few {# новыя элементы} many {# новых элементаў} other {# новых элементаў}}", "loading_indicator.label": "Ідзе загрузка…", "media_gallery.hide": "Схаваць", + "minicard.more_items": "+ яшчэ {count}", "moved_to_account_banner.text": "Ваш уліковы запіс {disabledAccount} зараз адключаны, таму што Вы перайшлі на {movedToAccount}.", "mute_modal.hide_from_notifications": "Схаваць з апавяшчэнняў", "mute_modal.hide_options": "Схаваць опцыі", diff --git a/app/javascript/mastodon/locales/da.json b/app/javascript/mastodon/locales/da.json index 035037fccb..a95303c0f2 100644 --- a/app/javascript/mastodon/locales/da.json +++ b/app/javascript/mastodon/locales/da.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# nyt element} other {# nye elementer}}", "loading_indicator.label": "Indlæser…", "media_gallery.hide": "Skjul", + "minicard.more_items": "+ {count} mere", "moved_to_account_banner.text": "Din konto {disabledAccount} er i øjeblikket deaktiveret, fordi du er flyttet til {movedToAccount}.", "mute_modal.hide_from_notifications": "Skjul fra notifikationer", "mute_modal.hide_options": "Skjul valgmuligheder", diff --git a/app/javascript/mastodon/locales/de.json b/app/javascript/mastodon/locales/de.json index 9e63460159..f475865203 100644 --- a/app/javascript/mastodon/locales/de.json +++ b/app/javascript/mastodon/locales/de.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# neuer Beitrag} other {# neue Beiträge}}", "loading_indicator.label": "Lädt …", "media_gallery.hide": "Ausblenden", + "minicard.more_items": "+ {count} weitere", "moved_to_account_banner.text": "Dein Konto {disabledAccount} ist derzeit deaktiviert, weil du zu {movedToAccount} umgezogen bist.", "mute_modal.hide_from_notifications": "Auch aus den Benachrichtigungen entfernen", "mute_modal.hide_options": "Optionen ausblenden", diff --git a/app/javascript/mastodon/locales/el.json b/app/javascript/mastodon/locales/el.json index e31e6f3bde..9903fed3b4 100644 --- a/app/javascript/mastodon/locales/el.json +++ b/app/javascript/mastodon/locales/el.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# νέο στοιχείο} other {# νέα στοιχεία}}", "loading_indicator.label": "Φόρτωση…", "media_gallery.hide": "Απόκρυψη", + "minicard.more_items": "+ {count} ακόμα", "moved_to_account_banner.text": "Ο λογαριασμός σου {disabledAccount} είναι προσωρινά απενεργοποιημένος επειδή μεταφέρθηκες στον {movedToAccount}.", "mute_modal.hide_from_notifications": "Απόκρυψη από ειδοποιήσεις", "mute_modal.hide_options": "Απόκρυψη επιλογών", diff --git a/app/javascript/mastodon/locales/en-GB.json b/app/javascript/mastodon/locales/en-GB.json index 0863df6699..58912dd035 100644 --- a/app/javascript/mastodon/locales/en-GB.json +++ b/app/javascript/mastodon/locales/en-GB.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# new item} other {# new items}}", "loading_indicator.label": "Loading…", "media_gallery.hide": "Hide", + "minicard.more_items": "+ {count} more", "moved_to_account_banner.text": "Your account {disabledAccount} is currently disabled because you moved to {movedToAccount}.", "mute_modal.hide_from_notifications": "Hide from notifications", "mute_modal.hide_options": "Hide options", diff --git a/app/javascript/mastodon/locales/es-AR.json b/app/javascript/mastodon/locales/es-AR.json index 670cc70055..197dc7a92a 100644 --- a/app/javascript/mastodon/locales/es-AR.json +++ b/app/javascript/mastodon/locales/es-AR.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# elemento nuevo} other {# elementos nuevos}}", "loading_indicator.label": "Cargando…", "media_gallery.hide": "Ocultar", + "minicard.more_items": "y {count} más", "moved_to_account_banner.text": "Tu cuenta {disabledAccount} está actualmente deshabilitada porque te mudaste a {movedToAccount}.", "mute_modal.hide_from_notifications": "Ocultar en las notificaciones", "mute_modal.hide_options": "Ocultar opciones", diff --git a/app/javascript/mastodon/locales/es-MX.json b/app/javascript/mastodon/locales/es-MX.json index db87e02463..48eaf1dc6f 100644 --- a/app/javascript/mastodon/locales/es-MX.json +++ b/app/javascript/mastodon/locales/es-MX.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# nuevo elemento} other {# nuevos elementos}}", "loading_indicator.label": "Cargando…", "media_gallery.hide": "Ocultar", + "minicard.more_items": "y {count} más", "moved_to_account_banner.text": "Tu cuenta {disabledAccount} está actualmente deshabilitada porque te has mudado a {movedToAccount}.", "mute_modal.hide_from_notifications": "Ocultar de las notificaciones", "mute_modal.hide_options": "Ocultar opciones", diff --git a/app/javascript/mastodon/locales/es.json b/app/javascript/mastodon/locales/es.json index 2b7d190535..aa2b7588dd 100644 --- a/app/javascript/mastodon/locales/es.json +++ b/app/javascript/mastodon/locales/es.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# nuevo elemento} other {# nuevos elementos}}", "loading_indicator.label": "Cargando…", "media_gallery.hide": "Ocultar", + "minicard.more_items": "y {count} más", "moved_to_account_banner.text": "Tu cuenta {disabledAccount} está actualmente deshabilitada porque te has mudado a {movedToAccount}.", "mute_modal.hide_from_notifications": "Ocultar de las notificaciones", "mute_modal.hide_options": "Ocultar opciones", diff --git a/app/javascript/mastodon/locales/fo.json b/app/javascript/mastodon/locales/fo.json index 52ef3946c5..1f42161459 100644 --- a/app/javascript/mastodon/locales/fo.json +++ b/app/javascript/mastodon/locales/fo.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# nýtt evni} other {# nýggj evni}}", "loading_indicator.label": "Innlesur…", "media_gallery.hide": "Fjal", + "minicard.more_items": "+ {count} meira", "moved_to_account_banner.text": "Konta tín {disabledAccount} er í løtuni óvirkin, tí tú flutti til {movedToAccount}.", "mute_modal.hide_from_notifications": "Fjal boð", "mute_modal.hide_options": "Fjal valmøguleikar", diff --git a/app/javascript/mastodon/locales/hu.json b/app/javascript/mastodon/locales/hu.json index 0f53d1b18e..edcdd2b9f3 100644 --- a/app/javascript/mastodon/locales/hu.json +++ b/app/javascript/mastodon/locales/hu.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# új elem} other {# új elem}}", "loading_indicator.label": "Betöltés…", "media_gallery.hide": "Elrejtés", + "minicard.more_items": "+ {count} további", "moved_to_account_banner.text": "A(z) {disabledAccount} fiókod jelenleg le van tiltva, mert átköltöztél ide: {movedToAccount}.", "mute_modal.hide_from_notifications": "Elrejtés az értesítések közül", "mute_modal.hide_options": "Beállítások elrejtése", diff --git a/app/javascript/mastodon/locales/is.json b/app/javascript/mastodon/locales/is.json index 0f255dfa97..e2efff0a47 100644 --- a/app/javascript/mastodon/locales/is.json +++ b/app/javascript/mastodon/locales/is.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# nýtt atriði} other {# ný atriði}}", "loading_indicator.label": "Hleð inn…", "media_gallery.hide": "Fela", + "minicard.more_items": "+ {count} í viðbót", "moved_to_account_banner.text": "Aðgangurinn þinn {disabledAccount} er óvirkur í augnablikinu vegna þess að þú fluttir þig yfir á {movedToAccount}.", "mute_modal.hide_from_notifications": "Fela úr tilkynningum", "mute_modal.hide_options": "Fela valkosti", diff --git a/app/javascript/mastodon/locales/lt.json b/app/javascript/mastodon/locales/lt.json index cfbb355bb3..3b6957b0c2 100644 --- a/app/javascript/mastodon/locales/lt.json +++ b/app/javascript/mastodon/locales/lt.json @@ -69,7 +69,7 @@ "account.mute_short": "Nutildyti", "account.muted": "Nutildytas", "account.muting": "Užtildymas", - "account.mutual": "Jūs sekate vienas kitą", + "account.mutual": "Sekate vienas kitą", "account.no_bio": "Nėra pateikto aprašymo.", "account.open_original_page": "Atidaryti originalų puslapį", "account.posts": "Įrašai", @@ -685,7 +685,7 @@ "notifications.filter.follows": "Sekimai", "notifications.filter.mentions": "Paminėjimai", "notifications.filter.polls": "Balsavimo rezultatai", - "notifications.filter.statuses": "Naujinimai iš žmonių, kuriuos seki", + "notifications.filter.statuses": "Naujienos iš žmonių, kuriuos sekate", "notifications.grant_permission": "Suteikti leidimą.", "notifications.group": "{count} pranešimai", "notifications.mark_as_read": "Pažymėti kiekvieną pranešimą kaip perskaitytą", @@ -821,7 +821,7 @@ "report.thanks.title": "Nenori to matyti?", "report.thanks.title_actionable": "Ačiū, kad pranešei, mes tai išnagrinėsime.", "report.unfollow": "Nebesekti @{name}", - "report.unfollow_explanation": "Tu seki šią paskyrą. Jei nori nebematyti jų įrašų savo pagrindiniame sraute, nebesek jų.", + "report.unfollow_explanation": "Jūs sekate šią paskyrą. Kad nebematytumėte jų įrašų savo pagrindiniame sraute, nebesekite.", "report_notification.attached_statuses": "Pridėti {count, plural, one {{count} įrašas} few {{count} įrašai} many {{count} įrašo} other {{count} įrašų}}", "report_notification.categories.legal": "Teisinės", "report_notification.categories.legal_sentence": "nelegalus turinys", diff --git a/app/javascript/mastodon/locales/pt-PT.json b/app/javascript/mastodon/locales/pt-PT.json index 66710d1172..72b97b22cb 100644 --- a/app/javascript/mastodon/locales/pt-PT.json +++ b/app/javascript/mastodon/locales/pt-PT.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# novo item} other {# novos itens}}", "loading_indicator.label": "A carregar…", "media_gallery.hide": "Esconder", + "minicard.more_items": "+ {count} mais", "moved_to_account_banner.text": "A tua conta {disabledAccount} está neste momento desativada porque migraste para {movedToAccount}.", "mute_modal.hide_from_notifications": "Ocultar das notificações", "mute_modal.hide_options": "Ocultar opções", diff --git a/app/javascript/mastodon/locales/sq.json b/app/javascript/mastodon/locales/sq.json index 300966b209..897cbd8722 100644 --- a/app/javascript/mastodon/locales/sq.json +++ b/app/javascript/mastodon/locales/sq.json @@ -587,6 +587,7 @@ "load_pending": "{count, plural,one {# objekt i ri }other {# objekte të rinj }}", "loading_indicator.label": "Po ngarkohet…", "media_gallery.hide": "Fshihe", + "minicard.more_items": "+ {count} më tepër", "moved_to_account_banner.text": "Llogaria juaj {disabledAccount} aktualisht është e çaktivizuar, ngaqë kaluat te {movedToAccount}.", "mute_modal.hide_from_notifications": "Fshihe prej njoftimeve", "mute_modal.hide_options": "Fshihi mundësitë", diff --git a/app/javascript/mastodon/locales/vi.json b/app/javascript/mastodon/locales/vi.json index 4a9158e5b9..6b1138ec08 100644 --- a/app/javascript/mastodon/locales/vi.json +++ b/app/javascript/mastodon/locales/vi.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, one {# tút mới} other {# tút mới}}", "loading_indicator.label": "Đang tải…", "media_gallery.hide": "Ẩn", + "minicard.more_items": "+ {count} khác", "moved_to_account_banner.text": "Tài khoản {disabledAccount} của bạn hiện không khả dụng vì bạn đã chuyển sang {movedToAccount}.", "mute_modal.hide_from_notifications": "Ẩn thông báo", "mute_modal.hide_options": "Ẩn tùy chọn", diff --git a/app/javascript/mastodon/locales/zh-CN.json b/app/javascript/mastodon/locales/zh-CN.json index d69f490b5b..92c0eaa3f4 100644 --- a/app/javascript/mastodon/locales/zh-CN.json +++ b/app/javascript/mastodon/locales/zh-CN.json @@ -589,6 +589,7 @@ "load_pending": "{count} 项", "loading_indicator.label": "加载中…", "media_gallery.hide": "隐藏", + "minicard.more_items": "+ 还有 {count} 项", "moved_to_account_banner.text": "你的账号 {disabledAccount} 已禁用,因为你已迁移到 {movedToAccount}。", "mute_modal.hide_from_notifications": "从通知中隐藏", "mute_modal.hide_options": "隐藏选项", diff --git a/app/javascript/mastodon/locales/zh-TW.json b/app/javascript/mastodon/locales/zh-TW.json index 78d191efa3..f6e4e3967b 100644 --- a/app/javascript/mastodon/locales/zh-TW.json +++ b/app/javascript/mastodon/locales/zh-TW.json @@ -589,6 +589,7 @@ "load_pending": "{count, plural, other {# 個新項目}}", "loading_indicator.label": "正在載入...", "media_gallery.hide": "隱藏", + "minicard.more_items": "+ 其餘 {count} 個", "moved_to_account_banner.text": "您的帳號 {disabledAccount} 目前已停用,因為您已搬家至 {movedToAccount}。", "mute_modal.hide_from_notifications": "於推播通知中隱藏", "mute_modal.hide_options": "隱藏選項", diff --git a/config/locales/cy.yml b/config/locales/cy.yml index a74a51d31f..1f38ea6eee 100644 --- a/config/locales/cy.yml +++ b/config/locales/cy.yml @@ -904,6 +904,7 @@ cy: publish_statistics: Cyhoeddi ystadegau title: Darganfod trends: Tueddiadau + wrapstodon: Wrapstodon domain_blocks: all: I bawb disabled: I neb diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 3302840450..6666a4d7bd 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -1033,7 +1033,7 @@ lt: merge_long: Išsaugoti esančius įrašus ir pridėti naujus overwrite: Perrašyti overwrite_long: Pakeisti senus įrašus naujais - preface: Gali importuoti duomenis, kuriuos eksportavai iš kito serverio, pavyzdžiui, sekamų arba blokuojamų žmonių sąrašą. + preface: Galite importuoti duomenis, kuriuos eksportavote iš kito serverio kaip sekamų arba blokuojamų žmonių sąrašą. success: Jūsų informacija sėkmingai įkelta ir bus apdorota kaip įmanoma greičiau types: blocking: Blokuojamų sąrašas From be00db4fa3164f89090f60676231ecb0792e2f77 Mon Sep 17 00:00:00 2001 From: David Roetzel Date: Fri, 16 Jan 2026 10:49:53 +0100 Subject: [PATCH 3/5] Use snowflake ids for collections and their items (#37514) --- ...53219_use_snowflake_ids_for_collections.rb | 25 +++++++++++++++++++ db/schema.rb | 6 ++--- 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20260115153219_use_snowflake_ids_for_collections.rb diff --git a/db/migrate/20260115153219_use_snowflake_ids_for_collections.rb b/db/migrate/20260115153219_use_snowflake_ids_for_collections.rb new file mode 100644 index 0000000000..25aad0732e --- /dev/null +++ b/db/migrate/20260115153219_use_snowflake_ids_for_collections.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class UseSnowflakeIdsForCollections < ActiveRecord::Migration[8.0] + def up + safety_assured do + execute(<<~SQL.squish) + ALTER TABLE collections ALTER COLUMN id SET DEFAULT timestamp_id('collections'); + ALTER TABLE collection_items ALTER COLUMN id SET DEFAULT timestamp_id('collection_items'); + SQL + end + + Mastodon::Snowflake.ensure_id_sequences_exist + end + + def down + execute(<<~SQL.squish) + LOCK collections; + SELECT setval('collections_id_seq', (SELECT MAX(id) FROM collections)); + ALTER TABLE collections ALTER COLUMN id SET DEFAULT nextval('collections_id_seq'); + LOCK collection_items; + SELECT setval('collection_items_id_seq', (SELECT MAX(id) FROM collection_items)); + ALTER TABLE collection_items ALTER COLUMN id SET DEFAULT nextval('collection_items_id_seq'); + SQL + end +end diff --git a/db/schema.rb b/db/schema.rb index 78d7ef6826..8dc1e88fd1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_12_17_091936) do +ActiveRecord::Schema[8.0].define(version: 2026_01_15_153219) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -352,7 +352,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_17_091936) do t.index ["reference_account_id"], name: "index_canonical_email_blocks_on_reference_account_id" end - create_table "collection_items", force: :cascade do |t| + create_table "collection_items", id: :bigint, default: -> { "timestamp_id('collection_items'::text)" }, force: :cascade do |t| t.bigint "collection_id", null: false t.bigint "account_id" t.integer "position", default: 1, null: false @@ -369,7 +369,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_17_091936) do t.index ["object_uri"], name: "index_collection_items_on_object_uri", unique: true, where: "(activity_uri IS NOT NULL)" end - create_table "collections", force: :cascade do |t| + create_table "collections", id: :bigint, default: -> { "timestamp_id('collections'::text)" }, force: :cascade do |t| t.bigint "account_id", null: false t.string "name", null: false t.text "description", null: false From e58084a85f6ccf64325c9af6f71ed7ef030fed65 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 16 Jan 2026 11:00:04 +0100 Subject: [PATCH 4/5] Update `theme_color_tags` helper for new theme infrastructure (#37519) --- app/helpers/theme_helper.rb | 15 +++++++-------- app/views/layouts/application.html.haml | 2 +- spec/helpers/theme_helper_spec.rb | 18 +++++++++--------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/app/helpers/theme_helper.rb b/app/helpers/theme_helper.rb index 1d64205680..e765541414 100644 --- a/app/helpers/theme_helper.rb +++ b/app/helpers/theme_helper.rb @@ -28,14 +28,17 @@ module ThemeHelper end end - def theme_color_tags(theme) - if theme == 'system' + def theme_color_tags(color_scheme) + case color_scheme + when 'auto' ''.html_safe.tap do |tags| tags << tag.meta(name: 'theme-color', content: Themes::THEME_COLORS[:dark], media: '(prefers-color-scheme: dark)') tags << tag.meta(name: 'theme-color', content: Themes::THEME_COLORS[:light], media: '(prefers-color-scheme: light)') end - else - tag.meta name: 'theme-color', content: theme_color_for(theme) + when 'light' + tag.meta name: 'theme-color', content: Themes::THEME_COLORS[:light] + when 'dark' + tag.meta name: 'theme-color', content: Themes::THEME_COLORS[:dark] end end @@ -65,8 +68,4 @@ module ThemeHelper Setting.custom_css&.then { |content| Digest::SHA256.hexdigest(content) } end end - - def theme_color_for(theme) - theme == 'mastodon-light' ? Themes::THEME_COLORS[:light] : Themes::THEME_COLORS[:dark] - end end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 0cbd51c85b..15f1e961ed 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -21,7 +21,7 @@ %link{ rel: 'mask-icon', href: frontend_asset_path('images/logo-symbol-icon.svg'), color: '#6364FF' }/ %link{ rel: 'manifest', href: manifest_path(format: :json) }/ = javascript_inline_tag 'theme-selection.js' - = theme_color_tags current_theme + = theme_color_tags color_scheme %meta{ name: 'mobile-web-app-capable', content: 'yes' }/ %title= html_title diff --git a/spec/helpers/theme_helper_spec.rb b/spec/helpers/theme_helper_spec.rb index 9eefa01f90..9e8119a742 100644 --- a/spec/helpers/theme_helper_spec.rb +++ b/spec/helpers/theme_helper_spec.rb @@ -49,12 +49,12 @@ RSpec.describe ThemeHelper do end describe 'theme_color_tags' do - let(:result) { helper.theme_color_tags(theme) } + let(:result) { helper.theme_color_tags(color_scheme) } context 'when using system theme' do - let(:theme) { 'system' } + let(:color_scheme) { 'auto' } - it 'returns the mastodon-light and default stylesheets with correct color schemes' do + it 'returns both color schemes with appropriate media queries' do expect(html_theme_colors.first.attributes.symbolize_keys) .to include( content: have_attributes(value: Themes::THEME_COLORS[:dark]), @@ -68,10 +68,10 @@ RSpec.describe ThemeHelper do end end - context 'when using mastodon-light theme' do - let(:theme) { 'mastodon-light' } + context 'when light color scheme' do + let(:color_scheme) { 'light' } - it 'returns the theme stylesheet without color scheme information' do + it 'returns the light color' do expect(html_theme_colors.first.attributes.symbolize_keys) .to include( content: have_attributes(value: Themes::THEME_COLORS[:light]) @@ -79,10 +79,10 @@ RSpec.describe ThemeHelper do end end - context 'when using other theme' do - let(:theme) { 'contrast' } + context 'when using dark color scheme' do + let(:color_scheme) { 'dark' } - it 'returns the theme stylesheet without color scheme information' do + it 'returns the dark color' do expect(html_theme_colors.first.attributes.symbolize_keys) .to include( content: have_attributes(value: Themes::THEME_COLORS[:dark]) From 918563704f5ff5eeb1efa31a412ac38f97781e9e Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 16 Jan 2026 11:28:50 +0100 Subject: [PATCH 5/5] =?UTF-8?q?Update=20the=20=E2=80=9Cembedded=E2=80=9D?= =?UTF-8?q?=20styling=20to=20the=20new=20theme=20infrastructure=20(#37520)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/embedded.html.haml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/embedded.html.haml b/app/views/layouts/embedded.html.haml index b802854ae7..d815b59140 100644 --- a/app/views/layouts/embedded.html.haml +++ b/app/views/layouts/embedded.html.haml @@ -1,5 +1,5 @@ !!! 5 -%html{ lang: I18n.locale } +%html{ lang: I18n.locale, 'data-contrast': 'auto', 'data-color-scheme': 'light' } %head %meta{ charset: 'utf-8' }/ %meta{ name: 'robots', content: 'noindex' }/ @@ -11,10 +11,11 @@ - if storage_host? %link{ rel: 'dns-prefetch', href: storage_host }/ + = javascript_inline_tag 'theme-selection.js' = vite_client_tag = vite_react_refresh_tag = vite_polyfills_tag - = theme_style_tags 'mastodon-light' + = theme_style_tags 'system' = vite_preload_file_tag "mastodon/locales/#{I18n.locale}.json" = render_initial_state = vite_typescript_tag 'embed.tsx', integrity: true, crossorigin: 'anonymous'