Skip to content

Commit

Permalink
AO3-5502 correct page title on adult content warning chapters
Browse files Browse the repository at this point in the history
  • Loading branch information
slavalamp committed Jan 6, 2025
1 parent e785293 commit 193aa0d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/controllers/chapters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,11 @@ def manage
# GET /work/:work_id/chapters/:id.xml
def show
@tag_groups = @work.tag_groups
if params[:view_adult]
cookies[:view_adult] = "true"
elsif @work.adult? && !see_adult?
render "works/_adult", layout: "application" and return
end

if params[:selected_id]
redirect_to url_for(controller: :chapters, action: :show, work_id: @work.id, id: params[:selected_id]) and return
end

@chapters = @work.chapters_in_order(
include_content: false,
include_drafts: (logged_in_as_admin? ||
Expand All @@ -61,6 +57,12 @@ def show
@page_title = get_page_title(title_fandom, author, @work.title + t(".chapter_position", position: @chapter.position.to_s))
end

if params[:view_adult]
cookies[:view_adult] = "true"
elsif @work.adult? && !see_adult?
render "works/_adult", layout: "application" and return
end

@kudos = @work.kudos.with_user.includes(:user)

if current_user.respond_to?(:subscriptions)
Expand Down

0 comments on commit 193aa0d

Please sign in to comment.