Skip to content

AO3-7671 Don't error on works with no posted chapters - #6123

Open
pmonfort wants to merge 3 commits into
otwcode:masterfrom
pmonfort:AO3-7671
Open

pmonfort wants to merge 3 commits into
otwcode:masterfrom
pmonfort:AO3-7671

Conversation

@pmonfort

Copy link
Copy Markdown
Contributor

Pull Request Checklist

Issue

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

Purpose

Some historic works were created before the check that prevents works without chapters, and viewing them gives a 500 error. There are two cases.

  • The work has chapters, but none of them are posted. This is the error in the issue. The work page now skips the work text when there's no chapter to show.
  • The work has no chapters at all. The work stats now leave out the "Published" date when there's no chapter to take it from.

Adds controller specs for both cases.

Testing Instructions

These works can't be created through the site anymore, so testing needs console access on test.

  1. Post a work and note its ID
  2. In a console, mark its chapters as unposted with Chapter.where(work_id: WORK_ID).update_all(posted: false)
  3. Log out and view the work. It should load without the work text instead of giving an error
  4. In a console, delete its chapters with Chapter.where(work_id: WORK_ID).delete_all
  5. View the work again, logged in as the creator and logged out. It should load without the work text and without a "Published" date

Credit

Pablo Monfort (he/him)

This branch has not been deployed

No deployments
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.

1 participant