From f1212a036d3e5054e736f30d87b2f8e43ad666f7 Mon Sep 17 00:00:00 2001 From: mellowmarsach Date: Mon, 11 May 2026 19:03:15 +0800 Subject: [PATCH 1/2] AO3-7425 - Fix word count when posting draft from Edit Tag page --- app/controllers/works_controller.rb | 2 ++ features/works/work_edit_tags.feature | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index 61e6ad43a02..bade7193ed3 100755 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -405,6 +405,8 @@ def update_tags @work.posted = true @work.minor_version = @work.minor_version + 1 @work.save + @work.word_count = @work.first_chapter.word_count + @work.save flash[:notice] = ts('Work was successfully updated.') redirect_to(@work) end diff --git a/features/works/work_edit_tags.feature b/features/works/work_edit_tags.feature index 73fad2066c1..acd503ad856 100644 --- a/features/works/work_edit_tags.feature +++ b/features/works/work_edit_tags.feature @@ -52,6 +52,21 @@ Feature: Edit tags on a work And I should see "Anthropomorphic" And I should see "The cooler version of tag" + Scenario: See correct word count when posting draft from Edit Tags + Given I am logged in as "imit" with password "tagyoure" + And the draft "Freeze Tag" + When I am on imit's works page + Then I should see "Drafts (1)" + When I follow "Drafts (1)" + Then I should see "Freeze Tag" + And I should see "Edit Tags" within "#main .own.work.blurb .actions" + When I follow "Edit Tags" + Then I should see "Post" + When I press "Post" + Then I should see "Work was successfully updated." + And I should not see "This work is a draft and has not been posted" + And I should see "Words:6" + Scenario: Ampersands and angle brackets should display in work titles on Edit Tags page Given the work "I am <strong>er Than Yesterday & Other Lies" by "testuser2" And I am logged in as "testuser2" From c586f06571562ae889fb9a9cbd09276e3953d1dc Mon Sep 17 00:00:00 2001 From: mellowmarsach Date: Sun, 24 May 2026 00:44:48 +0800 Subject: [PATCH 2/2] AO3-7425 - Suggested edits (simplify cucumber test, remove comment) --- app/controllers/works_controller.rb | 2 +- features/works/work_edit_tags.feature | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index bade7193ed3..de4a6ce992e 100755 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -401,7 +401,7 @@ def update_tags @work.save flash[:notice] = ts('Tags were successfully updated.') redirect_to(@work) - else # Save Draft + else @work.posted = true @work.minor_version = @work.minor_version + 1 @work.save diff --git a/features/works/work_edit_tags.feature b/features/works/work_edit_tags.feature index acd503ad856..3d0bfc1c468 100644 --- a/features/works/work_edit_tags.feature +++ b/features/works/work_edit_tags.feature @@ -55,14 +55,9 @@ Feature: Edit tags on a work Scenario: See correct word count when posting draft from Edit Tags Given I am logged in as "imit" with password "tagyoure" And the draft "Freeze Tag" - When I am on imit's works page - Then I should see "Drafts (1)" - When I follow "Drafts (1)" - Then I should see "Freeze Tag" - And I should see "Edit Tags" within "#main .own.work.blurb .actions" + And I view the work "Freeze Tag" When I follow "Edit Tags" - Then I should see "Post" - When I press "Post" + And I press "Post" Then I should see "Work was successfully updated." And I should not see "This work is a draft and has not been posted" And I should see "Words:6"