From 1bcc21fe510152f0e644a1a66efd1f6bfae6e001 Mon Sep 17 00:00:00 2001 From: nicolacleary <62173794+nicolacleary@users.noreply.github.com> Date: Sat, 18 Apr 2026 12:18:50 +0200 Subject: [PATCH 1/9] AO3-7397 Use t() for skin preview notice text --- app/controllers/skins_controller.rb | 8 ++++---- config/locales/controllers/en.yml | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/controllers/skins_controller.rb b/app/controllers/skins_controller.rb index 4adef9bdff5..ffe35c87a94 100644 --- a/app/controllers/skins_controller.rb +++ b/app/controllers/skins_controller.rb @@ -130,10 +130,10 @@ def update # Get /skins/1/preview def preview flash[:notice] = [] - flash[:notice] << ts("You are previewing the skin %{title}. This is a randomly chosen page.", title: @skin.title) - flash[:notice] << ts("Go back or click any link to remove the skin.") - flash[:notice] << ts("Tip: You can preview any archive page you want by tacking on '?site_skin=[skin_id]' like you can see in the url above.") - flash[:notice] << "".html_safe + ts("Return To Skin To Use") + "".html_safe + flash[:notice] << t(".skin_title", title: @skin.title) + flash[:notice] << t(".remove_skin") + flash[:notice] << t(".tip") + flash[:notice] << ("".html_safe + t(".return_to_skin") + "".html_safe) tag = FilterCount.where("public_works_count BETWEEN 10 AND 20").random_order.first.filter redirect_to tag_works_path(tag, site_skin: @skin.id) end diff --git a/config/locales/controllers/en.yml b/config/locales/controllers/en.yml index 367fe48184d..35306f5efbb 100644 --- a/config/locales/controllers/en.yml +++ b/config/locales/controllers/en.yml @@ -309,6 +309,11 @@ en: index: public_site_page_title: Public Site Skins public_work_page_title: Public Work Skins + preview: + remove_skin: Go back or click any link to remove the skin. + return_to_skin: Return To Skin To Use + skin_title: You are previewing the skin %{title}. This is a randomly chosen page. + tip: 'Tip: You can preview any archive page you want by tacking on ''?site_skin=[skin_id]'' like you can see in the url above.' stats: index: page_title: "%{username} - Stats" From c92baf3c30e75a8d22466927f524ee7a418aec34 Mon Sep 17 00:00:00 2001 From: nicolacleary <62173794+nicolacleary@users.noreply.github.com> Date: Sat, 18 Apr 2026 12:02:24 +0200 Subject: [PATCH 2/9] AO3-7397 Make skin preview page configurable --- app/controllers/skins_controller.rb | 3 +-- config/config.yml | 6 ++++++ config/locales/controllers/en.yml | 2 +- features/other_b/skin_public.feature | 9 +++------ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/controllers/skins_controller.rb b/app/controllers/skins_controller.rb index ffe35c87a94..f9b9f7adcd6 100644 --- a/app/controllers/skins_controller.rb +++ b/app/controllers/skins_controller.rb @@ -134,8 +134,7 @@ def preview flash[:notice] << t(".remove_skin") flash[:notice] << t(".tip") flash[:notice] << ("".html_safe + t(".return_to_skin") + "".html_safe) - tag = FilterCount.where("public_works_count BETWEEN 10 AND 20").random_order.first.filter - redirect_to tag_works_path(tag, site_skin: @skin.id) + redirect_to "#{ArchiveConfig.SKIN_PREVIEW_URL}?site_skin=#{@skin.id}" end def set diff --git a/config/config.yml b/config/config.yml index bd8c99fdc76..6c98d349193 100644 --- a/config/config.yml +++ b/config/config.yml @@ -802,3 +802,9 @@ PSEUD_SHARDS: 5 TAG_SHARDS: 5 USER_SHARDS: 5 WORKS_SHARDS: 5 + +# The relative URL to redirect to when previewing a skin +# e.g. /works -> http://test.archiveofourown.org/works?site_skin=[skin_id] +# Production should pick something more suitable with roughly 1-20 works and +# predictable content such as /users/OTW_Translation/works +SKIN_PREVIEW_URL: '/works' diff --git a/config/locales/controllers/en.yml b/config/locales/controllers/en.yml index 35306f5efbb..ac10348e54a 100644 --- a/config/locales/controllers/en.yml +++ b/config/locales/controllers/en.yml @@ -312,7 +312,7 @@ en: preview: remove_skin: Go back or click any link to remove the skin. return_to_skin: Return To Skin To Use - skin_title: You are previewing the skin %{title}. This is a randomly chosen page. + skin_title: You are previewing the skin %{title}. tip: 'Tip: You can preview any archive page you want by tacking on ''?site_skin=[skin_id]'' like you can see in the url above.' stats: index: diff --git a/features/other_b/skin_public.feature b/features/other_b/skin_public.feature index 98b274a99fb..96ef5c8034f 100644 --- a/features/other_b/skin_public.feature +++ b/features/other_b/skin_public.feature @@ -103,17 +103,14 @@ Feature: Public skins And I should not see "Uncached skin" Scenario: A user can preview a cached public site skin, and it will take the - user to the works page for a canonical tag with between 10 and 20 works + user to the configured page for skin previews Given the approved public skin "Usable Skin" And the skin "Usable Skin" is cached - And the canonical fandom "Dallas" with 2 works - And the canonical fandom "Major Crimes" with 11 works - And the canonical fandom "Rizzoli and Isles" with 21 works And I am logged in as "skinner" When I go to the public skins page And I follow "Preview" - Then I should be on the works tagged "Major Crimes" - And I should see "You are previewing the skin Usable Skin. This is a randomly chosen page." + Then I should be on the works page + And I should see "You are previewing the skin Usable Skin." And I should see "Go back or click any link to remove the skin" And I should see "Tip: You can preview any archive page you want by tacking on '?site_skin=[skin_id]' like you can see in the url above." When I follow "Return To Skin To Use" From 2278c5b0f36d32c791d7374dfeb583bc2744652d Mon Sep 17 00:00:00 2001 From: nicolacleary <62173794+nicolacleary@users.noreply.github.com> Date: Mon, 20 Apr 2026 11:15:56 +0200 Subject: [PATCH 3/9] AO3-7397 Use prod-ready config value --- config/config.yml | 8 ++++---- features/other_b/skin_public.feature | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config/config.yml b/config/config.yml index 6c98d349193..fe4348738e8 100644 --- a/config/config.yml +++ b/config/config.yml @@ -804,7 +804,7 @@ USER_SHARDS: 5 WORKS_SHARDS: 5 # The relative URL to redirect to when previewing a skin -# e.g. /works -> http://test.archiveofourown.org/works?site_skin=[skin_id] -# Production should pick something more suitable with roughly 1-20 works and -# predictable content such as /users/OTW_Translation/works -SKIN_PREVIEW_URL: '/works' +# e.g. /users/OTW_Translation/works -> +# http://test.archiveofourown.org/users/OTW_Translation/works?site_skin=[skin_id] +# This will not work in dev unless you manually create the OTW_Translation user +SKIN_PREVIEW_URL: '/users/OTW_Translation/works' diff --git a/features/other_b/skin_public.feature b/features/other_b/skin_public.feature index 96ef5c8034f..9a805e6ff13 100644 --- a/features/other_b/skin_public.feature +++ b/features/other_b/skin_public.feature @@ -105,11 +105,12 @@ Feature: Public skins Scenario: A user can preview a cached public site skin, and it will take the user to the configured page for skin previews Given the approved public skin "Usable Skin" + And the user "OTW_Translation" exists and is activated And the skin "Usable Skin" is cached And I am logged in as "skinner" When I go to the public skins page And I follow "Preview" - Then I should be on the works page + Then I should be on OTW_Translation's works page And I should see "You are previewing the skin Usable Skin." And I should see "Go back or click any link to remove the skin" And I should see "Tip: You can preview any archive page you want by tacking on '?site_skin=[skin_id]' like you can see in the url above." From f0f19d7d1f9030645e0e4b713aee0c12a598d6ed Mon Sep 17 00:00:00 2001 From: nicolacleary <62173794+nicolacleary@users.noreply.github.com> Date: Mon, 25 May 2026 14:49:48 +0200 Subject: [PATCH 4/9] AO3-7397 Update site skin tests Some extra tests were added to master in AO3-7388 that enforced the old behaviour (redirecting to a random tag for previewing a site skin) Updated so that they check for the value from config.yml '/users/OTW_Translation/works' --- spec/controllers/skins_controller_spec.rb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/spec/controllers/skins_controller_spec.rb b/spec/controllers/skins_controller_spec.rb index 9fa98ff6050..9a1a64f3fdc 100644 --- a/spec/controllers/skins_controller_spec.rb +++ b/spec/controllers/skins_controller_spec.rb @@ -750,16 +750,8 @@ end context "with accessible site skin" do - let(:success) { it_redirects_to_simple(tag_works_path(tag, site_skin: skin.id)) } - let(:tag) { create(:canonical_fandom) } - - before do - FilterCount.create!( - filter: tag, - public_works_count: 10, - unhidden_works_count: 10 - ) - end + let(:success) { it_redirects_to_simple(user_works_path(otw_translation_user, site_skin: skin.id)) } + let(:otw_translation_user) { create(:user, login: "OTW_Translation") } context "when site skin is public" do let(:skin) { create(:skin, :public, title: "Accessible Site Skin", author: skin_creator) } From e58a4e986bb2e27be9490ee127d73d3b560975d7 Mon Sep 17 00:00:00 2001 From: nicolacleary <62173794+nicolacleary@users.noreply.github.com> Date: Mon, 25 May 2026 15:04:43 +0200 Subject: [PATCH 5/9] AO3-7397 Use link_to instead of html_safe in site skin preview. This removes role 'button' but this will be removed as part of AO3-6765 anyways. --- app/controllers/skins_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/skins_controller.rb b/app/controllers/skins_controller.rb index fe76b0a3c55..124f2934559 100644 --- a/app/controllers/skins_controller.rb +++ b/app/controllers/skins_controller.rb @@ -138,7 +138,7 @@ def preview flash[:notice] << t(".skin_title", title: @skin.title) flash[:notice] << t(".remove_skin") flash[:notice] << t(".tip") - flash[:notice] << ("".html_safe + t(".return_to_skin") + "".html_safe) + flash[:notice] << helpers.link_to(t(".return_to_skin"), skin_path(@skin), class: "action") redirect_to "#{ArchiveConfig.SKIN_PREVIEW_URL}?site_skin=#{@skin.id}" end From 40a8901e1915d05809299ca0dbe9cd3058badc0a Mon Sep 17 00:00:00 2001 From: nicolacleary <62173794+nicolacleary@users.noreply.github.com> Date: Mon, 25 May 2026 15:26:08 +0200 Subject: [PATCH 6/9] AO3-6765 Improve Skin Preview Message Adopt changes from PR #4934: - Adjust skin preview message text - Include skin id in preview message - Update text on return to skin link (role=button removed in a previous commit) --- app/controllers/skins_controller.rb | 2 +- config/locales/controllers/en.yml | 6 +++--- features/other_b/skin_public.feature | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/controllers/skins_controller.rb b/app/controllers/skins_controller.rb index 124f2934559..1f2f0e8110d 100644 --- a/app/controllers/skins_controller.rb +++ b/app/controllers/skins_controller.rb @@ -137,7 +137,7 @@ def preview flash[:notice] = [] flash[:notice] << t(".skin_title", title: @skin.title) flash[:notice] << t(".remove_skin") - flash[:notice] << t(".tip") + flash[:notice] << t(".tip", site_skin_id: @skin.id) flash[:notice] << helpers.link_to(t(".return_to_skin"), skin_path(@skin), class: "action") redirect_to "#{ArchiveConfig.SKIN_PREVIEW_URL}?site_skin=#{@skin.id}" end diff --git a/config/locales/controllers/en.yml b/config/locales/controllers/en.yml index b9393b0d9d3..a0d31fb474e 100644 --- a/config/locales/controllers/en.yml +++ b/config/locales/controllers/en.yml @@ -316,10 +316,10 @@ en: public_work_page_title: Public Work Skins preview: cannot_preview: Sorry, you can't preview that skin. - remove_skin: Go back or click any link to remove the skin. - return_to_skin: Return To Skin To Use + remove_skin: Go back or follow any link to remove the skin. + return_to_skin: Return to Skin to Use skin_title: You are previewing the skin %{title}. - tip: 'Tip: You can preview any archive page you want by tacking on ''?site_skin=[skin_id]'' like you can see in the url above.' + tip: 'Tip: You can preview any archive page you want by adding ''?site_skin=%{site_skin_id}'' to the end of the URL.' set: failure: Sorry, but only certain skins can be used this way (for performance reasons). Please drop a support request if you'd like %{skin_title} to be added! skin_page: "%{skin_title} skin page" diff --git a/features/other_b/skin_public.feature b/features/other_b/skin_public.feature index 27989aa224e..cf2a424f903 100644 --- a/features/other_b/skin_public.feature +++ b/features/other_b/skin_public.feature @@ -112,9 +112,10 @@ Feature: Public skins And I follow "Preview" Then I should be on OTW_Translation's works page And I should see "You are previewing the skin Usable Skin." - And I should see "Go back or click any link to remove the skin" - And I should see "Tip: You can preview any archive page you want by tacking on '?site_skin=[skin_id]' like you can see in the url above." - When I follow "Return To Skin To Use" + And I should see "Go back or follow any link to remove the skin" + And I should see "Tip: You can preview any archive page you want by adding '?site_skin=" + And I should see "' to the end of the URL" + When I follow "Return to Skin to Use" Then I should be on "Usable Skin" skin page Scenario: Setting a skin from the footer maintains the same page From b304d6087e4b3c9a6251c4922ed9cacfe32a36a5 Mon Sep 17 00:00:00 2001 From: nicolacleary <62173794+nicolacleary@users.noreply.github.com> Date: Tue, 26 May 2026 12:56:10 +0200 Subject: [PATCH 7/9] AO3-6765 Use double quotes in skin preview message --- config/locales/controllers/en.yml | 2 +- features/other_b/skin_public.feature | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/locales/controllers/en.yml b/config/locales/controllers/en.yml index a0d31fb474e..7da508e4b4b 100644 --- a/config/locales/controllers/en.yml +++ b/config/locales/controllers/en.yml @@ -319,7 +319,7 @@ en: remove_skin: Go back or follow any link to remove the skin. return_to_skin: Return to Skin to Use skin_title: You are previewing the skin %{title}. - tip: 'Tip: You can preview any archive page you want by adding ''?site_skin=%{site_skin_id}'' to the end of the URL.' + tip: 'Tip: You can preview any archive page you want by adding "?site_skin=%{site_skin_id}" to the end of the URL.' set: failure: Sorry, but only certain skins can be used this way (for performance reasons). Please drop a support request if you'd like %{skin_title} to be added! skin_page: "%{skin_title} skin page" diff --git a/features/other_b/skin_public.feature b/features/other_b/skin_public.feature index cf2a424f903..3c4f4faba5a 100644 --- a/features/other_b/skin_public.feature +++ b/features/other_b/skin_public.feature @@ -113,8 +113,8 @@ Feature: Public skins Then I should be on OTW_Translation's works page And I should see "You are previewing the skin Usable Skin." And I should see "Go back or follow any link to remove the skin" - And I should see "Tip: You can preview any archive page you want by adding '?site_skin=" - And I should see "' to the end of the URL" + And I should see 'Tip: You can preview any archive page you want by adding "?site_skin=' + And I should see '" to the end of the URL' When I follow "Return to Skin to Use" Then I should be on "Usable Skin" skin page From 1a37970e0e0dfb3baef3ee0ec623a78ae1201a7f Mon Sep 17 00:00:00 2001 From: nicolacleary <62173794+nicolacleary@users.noreply.github.com> Date: Tue, 26 May 2026 13:26:30 +0200 Subject: [PATCH 8/9] AO3-7397 Standardise skin preview flash Use
to form the multiline flash message for skin previews, rather than an array which turns it into an unordered list with