From 1c0cc28dd1d239e28d44307e6b037b28b53e17a8 Mon Sep 17 00:00:00 2001 From: Codex Night Worker Date: Sat, 21 Nov 2026 01:11:13 +0900 Subject: [PATCH] WIP: unverified Codex job issue-485-obzs08at --- .../requests/post_history_privacy_spec.rb | 11 +++++-- frontend/server.ssr.test.mjs | 31 +++++++++++++++++++ frontend/src/lib/prefetchers.test.ts | 12 +++++-- frontend/vite.config.ts | 6 ++-- frontend/vitest.config.ts | 15 +++++---- 5 files changed, 61 insertions(+), 14 deletions(-) diff --git a/backend/spec/requests/post_history_privacy_spec.rb b/backend/spec/requests/post_history_privacy_spec.rb index d17de9b..72ef086 100644 --- a/backend/spec/requests/post_history_privacy_spec.rb +++ b/backend/spec/requests/post_history_privacy_spec.rb @@ -8,7 +8,12 @@ RSpec.describe 'Post history privacy', type: :request do let!(:other_post) do create(:post, created_at: origin, updated_at: origin + 3.days + 1.hour) end - let!(:tag) { create(:tag, primary_name: 'private-history-tag') } + let!(:tag) do + # Locale completion in the tag factory can create its own version 1. + create(:tag, primary_tag_name: nil).tap do |record| + create(:tag_name, tag: record, name: 'private-history-tag') + end + end let!(:external) { create(:external_tag, name: 'external-history-tag') } before do @@ -138,7 +143,9 @@ RSpec.describe 'Post history privacy', type: :request do end it 'paginates public tag additions and removals using the same exact count' do - public_tag = create(:tag, primary_name: 'public-history-tag') + public_tag = create(:tag, primary_tag_name: nil).tap do |record| + create(:tag_name, tag: record, name: 'public-history-tag') + end public_external = create(:external_tag) TagVersion.create!(tag: public_tag, version_no: 1, event_type: 'create', name: 'public-history-tag', category: 'general', aliases: '', parent_tag_ids: '', diff --git a/frontend/server.ssr.test.mjs b/frontend/server.ssr.test.mjs index cae7986..873060b 100644 --- a/frontend/server.ssr.test.mjs +++ b/frontend/server.ssr.test.mjs @@ -418,6 +418,37 @@ test ('YouTube posts return HTTP 200 with the embed rendered by SSR', async t => } }) +test ('post history HTTP requests preserve filters for every role', async t => { + const accounts = [ + { role: 'guest', cookie: null }, + { role: 'member', cookie: await authenticatedCookie ('second-recovery-secret') }, + { role: 'admin', cookie: await authenticatedCookie () }] + for (const account of accounts) { + for (const prefix of ['', '/ja', '/ain-Kana']) { + await t.test (`${account.role} ${prefix || 'no locale prefix'}`, async () => { + for (const query of ['', '?id=1&page=2&limit=5']) { + const start = requests.length + const response = await fetch ( + `${httpOrigin}${prefix}/posts/changes${query}`, { + headers: account.cookie == null ? {} : { Cookie: account.cookie } }) + assert.equal (response.status, 200) + const html = await response.text () + assert.match (html, /