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 on lines +133 to +136
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 Author

Choose a reason for hiding this comment

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

Rubocop would complain on the usage of ts when I removed "This is a randomly chosen page" from the notice.
I decided it made sense to convert all of the lines rather than just one

Comment thread config/config.yml Outdated
# 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'
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.

The ticket asks for /users/OTW_Translation/works but this user is not present in the development data. I chose /works for this value since it should always be available, but this should be changed the proper value in the production config.

Copy link
Copy Markdown
Contributor

@slavalamp slavalamp Apr 19, 2026

Choose a reason for hiding this comment

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

this user exists on staging (the test.ao3.org site linked in the issue, for testers who have access to it) and you can create it in your local environment for testing it yourself (see Creating Development Data in the wiki)

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.

I understand that it's possible to create it locally, and I have successfully created users in my dev environment.

I worry that configuring a user not in the dev data could negatively impact the dev experience:

  • In order for the preview function to work in dev, devs will have to manually create a user or update the config
  • If this happens with multiple features the dev setup instructions become complicated and hard to follow and maintain
  • It won't be clear that it's a config error and not a bug

I could:

  1. Add the OTW_Translation user in the fixtures - I believe this would then be part of the dev/test data for new installations
  2. Configure an existing dev user here - the config would still need to be changed before testing/prod
  3. Override the config in development.rb - I think this is possible but I would have to check

I am not sure what would be the preferred approach would be here. If the config.yml file shouldn't be changed before testing then naturally I can adjust it. Cheers

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.

oh yeah good point, defaulting to a page that would exist with the dev data makes sense

setting a user works page by default as an example for people making their own archives is probably a good idea, but idk if option 1 or 2 is better (probably not 3, i don't think using the .rb files to override these configs like that is done)

maybe ask bilka since he made the ticket?

Copy link
Copy Markdown
Contributor

@Bilka2 Bilka2 Apr 19, 2026

Choose a reason for hiding this comment

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

Not a full review, but yes please change the URL here to the URL desired in the issue without further changes to dev data. It will simply 404 in dev, which isn't an issue - this is not a commonly used page so I don't expect a significant impact to the experience there.

It vastly simplifies the timing/organisation of testing and deploying if we don't have to fit in config changes between that, so we prefer to use production-ready values in this file

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.

Clear, thanks both! I have updated the config as asked

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.

@nicolacleary nicolacleary marked this pull request as ready for review April 18, 2026 19:33
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