-
Notifications
You must be signed in to change notification settings - Fork 650
AO3-3245 Manually entering the post link for a closed collection gives a misleading error #5504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
marcus8448
left a comment
There was a problem hiding this 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!
| @unposted = current_user.unposted_work | ||
|
|
||
| # Check if collection is closed and user doesn't have permission to post | ||
| if @collection&.closed? && !@collection&.user_is_owner?(current_user) && !@collection&.user_is_maintainer?(current_user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user_is_maintainer? should already include all owners.
| edit_tags: | ||
| page_title: Edit Work Tags | ||
| new: | ||
| closed_collection_error: Sorry, the collection %{collection_title} is closed, new works cannot be added to it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we prefer to not have an _error suffix on translation keys.
| closed_collection_error: Sorry, the collection %{collection_title} is closed, new works cannot be added to it. | |
| closed_collection: Sorry, the collection %{collection_title} is closed. New works cannot be added to it. |
| include LoginMacros | ||
| include RedirectExpectationHelper | ||
|
|
||
| describe "GET #new" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The work spec is split across multiple files, so these tests should join the rest of the new tests in default_rails_actions_spec.rb:
| describe "new" do |
|
|
||
| before do | ||
| fake_login_known_user(user) | ||
| collection.collection_participants.create(pseud: user.default_pseud, participant_role: CollectionParticipant::OWNER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be a bit nicer to create the participant in a let statement.
Pull Request Checklist
as the first thing in your pull request title (e.g.
AO3-1234 Fix thing)until they are reviewed and merged before creating new pull requests.
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)