Skip to content

AO3-3245 Manually entering the post link for a closed collection gives a misleading error#5504

Merged
Bilka2 merged 6 commits intootwcode:masterfrom
scottsds:AO3-3245
Feb 3, 2026
Merged

AO3-3245 Manually entering the post link for a closed collection gives a misleading error#5504
Bilka2 merged 6 commits intootwcode:masterfrom
scottsds:AO3-3245

Conversation

@scottsds
Copy link
Copy Markdown
Member

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-3245 (Please fill in issue number and remove this comment.)

Purpose

Adds a check in the Works Controller to make sure a Collection isn't closed. If it is, and the User is not Owner or Moderator, it redirects them back to the collection index page with a message.

Credit

Scott (he/him)

@Bilka2 Bilka2 changed the title AO3-3245 - Manually entering the post link for a closed collection gives a misleading error AO3-3245 Manually entering the post link for a closed collection gives a misleading error Dec 15, 2025
Copy link
Copy Markdown
Member

@marcus8448 marcus8448 left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

Comment thread app/controllers/works_controller.rb Outdated
Comment thread config/locales/controllers/en.yml Outdated
Comment thread spec/controllers/works/works_controller_spec.rb Outdated
Comment thread spec/controllers/works/works_controller_spec.rb Outdated
@scottsds
Copy link
Copy Markdown
Member Author

Updated, thanks for the review marcus!

Copy link
Copy Markdown
Member

@marcus8448 marcus8448 left a comment

Choose a reason for hiding this comment

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

Looks good! Just a minor (non-blocking) potential simplification in the tests.

context "when collection is closed but user is maintainer" do
let(:user) { create(:user) }
let(:collection) { create(:collection, title: "Excalibur", collection_preference: create(:collection_preference, closed: true)) }
let!(:participant) { collection.collection_participants.create(pseud: user.default_pseud, participant_role: CollectionParticipant::MODERATOR) }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you want to make this a bit more concise (and drop the eager let!) you could create the participant with factorybot and just use participant.user (superseding the user declaration).

@Bilka2 Bilka2 merged commit 1dab266 into otwcode:master Feb 3, 2026
29 checks passed
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