Skip to content

AO3-7397 Configurable page for skin previews#5744

Open
nicolacleary wants to merge 3 commits intootwcode:masterfrom
nicolacleary:AO3-7397_skin_preview_page
Open

AO3-7397 Configurable page for skin previews#5744
nicolacleary wants to merge 3 commits intootwcode:masterfrom
nicolacleary:AO3-7397_skin_preview_page

Conversation

@nicolacleary
Copy link
Copy Markdown
Contributor

@nicolacleary nicolacleary commented Apr 18, 2026

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-7397

Purpose

Redirect to the URL specified in the config with SKIN_PREVIEW_URL when previewing a skin.

Remove the functionality to redirect to the works index of a random tag - this provided no guarantees on the kind of content shown and would sometimes choose tags that no longer existed (resulting in 500 errors).

Credit

nicolacleary (she/her)

@nicolacleary nicolacleary force-pushed the AO3-7397_skin_preview_page branch from 779a5ad to c92baf3 Compare April 18, 2026 19:02
Comment thread app/controllers/skins_controller.rb
Comment thread config/config.yml Outdated
flash[:notice] << t(".remove_skin")
flash[:notice] << t(".tip")
flash[:notice] << ("<a href='#{skin_path(@skin)}' class='action' role='button'>".html_safe + t(".return_to_skin") + "</a>".html_safe)
redirect_to "#{ArchiveConfig.SKIN_PREVIEW_URL}?site_skin=#{@skin.id}"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This provides no guarantees that the url is correct (formatting or exists) - e.g. if you configure "/idonotexist" then you would get an error only when you tried to preview a skin.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, but thanks for noting it!

@nicolacleary nicolacleary marked this pull request as ready for review April 18, 2026 19:33
Copy link
Copy Markdown
Contributor

@Bilka2 Bilka2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a full review now, but it's just one thing :D

flash[:notice] << t(".remove_skin")
flash[:notice] << t(".tip")
flash[:notice] << ("<a href='#{skin_path(@skin)}' class='action' role='button'>".html_safe + t(".return_to_skin") + "</a>".html_safe)
redirect_to "#{ArchiveConfig.SKIN_PREVIEW_URL}?site_skin=#{@skin.id}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, but thanks for noting it!

flash[:notice] << t(".skin_title", title: @skin.title)
flash[:notice] << t(".remove_skin")
flash[:notice] << t(".tip")
flash[:notice] << ("<a href='#{skin_path(@skin)}' class='action' role='button'>".html_safe + t(".return_to_skin") + "</a>".html_safe)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use helpers.link_to to create this link HTML so that we can avoid the html_safe call? If you need to remove the role='button' for that, that's fine, it should be removed per AO3-6765 anyway.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Speaking of AO3-6765, the PR for it has been in "Reviewed: Action Needed" without changes for over a year, which makes it adoptable for AD&T volunteers like me. However, if I adopted it now, we'd have loads of merge conflicts between the changes here and the changes for AO3-6765.

Would you be up for adding AO3-6765 into the PR here, since you're already doing the i18n it should just be a matter of changing the text in the locale file and changing the construction of the flash here to not be an array (looks like we usually do multiline flashes with <br />)? If yes, you have my official AD&T blessing to adopt AO3-6765

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants