Skip to content

Commit

Permalink
A03-3536 Show validation error message when parent Url unreachable (#…
Browse files Browse the repository at this point in the history
…2954)

When an archive work is associated with an external work that has
an unreachable URL, the previous behavior was to display a generic
"Parent work couldn't be saved" message.  Now we will instead show
the first validation error message for that external work, which
should provide enough information for the user to deal with the
underlying problem.
  • Loading branch information
maryalice0 authored and zz9pzza committed Jul 18, 2017
1 parent c880047 commit 9842370
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ def parent_attributes=(attributes)
if ew.save
self.new_parent = {parent: ew, translation: translation}
else
self.errors.add(:base, "Parent work info would not save.")
self.errors.add(:base, "Parent work " + ew.errors.full_messages[0])
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion features/works/work_related.feature
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,14 @@ Scenario: Listing external works as inspirations
When I view my related works
Then I should see "From N/A to English"
# inactive URL should give a helpful message (AO3-1783)
# unreachable URL should give a more helpful message (A03-3536)
When I edit the work "Followup"
And I check "parent-options-show"
And I fill in "URL" with "http://example.org/404"
And I fill in "Title" with "Worldbuilding Two"
And I fill in "Author" with "BNF"
And I press "Preview"
Then I should see "Parent work info would not save."
Then I should see "Parent work Url could not be reached. If the URL is correct and the site is currently down, please try again later."

Scenario: External work language

Expand Down

0 comments on commit 9842370

Please sign in to comment.