Skip to content

Commit

Permalink
Revert "Issue 4067: Respond with 404 instead of redirect: chapters, u…
Browse files Browse the repository at this point in the history
…sers"
  • Loading branch information
zz9pzza committed Oct 5, 2014
1 parent 3537b0c commit 7368999
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/controllers/chapters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def show
end
@chapter = @work.chapters.find_by_id(params[:id])
unless @chapter
raise ActiveRecord::RecordNotFound, "Couldn't find the chapter '#{params[:id]}' belonging to work '#{params[:work_id]}'"
flash[:error] = ts("Sorry, we couldn't find the chapter you were looking for.")
redirect_to work_path(@work) and return
end
@chapters = @work.chapters_in_order(false)
if !logged_in? || !current_user.is_author_of?(@work)
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def new
def create
@user = User.find_by_login(params[:login]) || User.find_by_email(params[:login])
if @user.nil?
raise ActiveRecord::RecordNotFound, "Couldn't find user with username or email '#{params[:login]}'"
flash[:notice] = ts("We couldn't find an account with that email address or username. Please try again?")
render :action => "new"
elsif !@user.active?
flash.now[:error] = ts("Your account has not been activated. Please check your email (including your spam folder) for the activation link or <a href=\"#{new_feedback_report_url}\">contact Support</a>.".html_safe)
render :action => "new"
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def index
# GET /users/1
def show
if @user.blank?
raise ActiveRecord::RecordNotFound, "Couldn't find user '#{params[:id]}'"
flash[:error] = ts("Sorry, could not find this user.")
redirect_to people_path and return
end
@page_subtitle = @user.login

Expand Down
12 changes: 12 additions & 0 deletions features/works/work_view.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,15 @@ Feature: View a work with various options
And I follow "Site Map"
And I should not see "Sorry, we couldn't find the work you were looking for."



Scenario: viewing a deleted chapter on a work that still exists
Given I am logged in as a random user
And I view a deleted chapter
And I should see "Sorry, we couldn't find the chapter you were looking for."
And I should see "DeletedChapterWork"
And I follow "Site Map"
Then I should not see "Sorry, we couldn't find the chapter you were looking for."



0 comments on commit 7368999

Please sign in to comment.