From 9a0a4e82c248d0cb3b2297283122902ed63819cc Mon Sep 17 00:00:00 2001 From: techlingyi <166869872+techlingyi@users.noreply.github.com> Date: Sun, 3 May 2026 06:36:40 +0000 Subject: [PATCH 1/4] AO3-6857 Improve prompt meme anon tickbox logic --- app/views/prompts/_prompt_form.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/prompts/_prompt_form.html.erb b/app/views/prompts/_prompt_form.html.erb index 9454d37b7b7..8b9c239dc6e 100755 --- a/app/views/prompts/_prompt_form.html.erb +++ b/app/views/prompts/_prompt_form.html.erb @@ -88,7 +88,8 @@ %>
<%= form.label :anonymous, ts("Semi-anonymous Prompt?") %>
- <%= form.check_box :anonymous, :checked => @collection.challenge.anonymous? ? true : form.object.anonymous %> + <% # Default to the prompt's original anonymity value, unless we're making a new prompt and the challenge is anonymous. %> + <%= form.check_box :anonymous, :checked => form.object.anonymous? || (form.object.new_record? && @collection.challenge.anonymous?) %>

<%= ts("(Note: This is not totally secure, and is still guessable in some places.)") %>

<% end %> From 4da40d5ac284b688cde631488a057f1b7c82d3ca Mon Sep 17 00:00:00 2001 From: techlingyi <166869872+techlingyi@users.noreply.github.com> Date: Sun, 3 May 2026 08:25:52 +0000 Subject: [PATCH 2/4] AO3-6857 Add testing for anonymity status when editing signup --- .../challenge_promptmeme_claims.feature | 31 +++++++++++++++++-- .../challenge_promptmeme_steps.rb | 5 ++- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/features/prompt_memes_c/challenge_promptmeme_claims.feature b/features/prompt_memes_c/challenge_promptmeme_claims.feature index 7078d18a22d..57d0145b665 100644 --- a/features/prompt_memes_c/challenge_promptmeme_claims.feature +++ b/features/prompt_memes_c/challenge_promptmeme_claims.feature @@ -399,17 +399,42 @@ Feature: Prompt Meme Challenge When I go to the "Battle 12" requests page Then I should not see "Download (CSV)" - Scenario: Validation error doesn't cause semi-anon ticky to lose state (Issue 2617) + Scenario: Validation error doesn't cause semi-anon ticky to lose state (default non-anonymous) (Issue 2617) Given I set up an anon promptmeme "Scotts Prompt" with name "scotts_prompt" And I am logged in as "Scott" with password "password" And I go to "Scotts Prompt" collection's page And I follow "Prompt Form" - And I check "Semi-anonymous Prompt" - And I press "Submit" + And I check the 1st checkbox with id matching "anonymous" + When I press "Submit" Then I should see "There were some problems with this submission. Please correct the mistakes below." And I should see "Your Request must include between 1 and 2 fandom tags, but you have included 0 fandom tags in your current Request." And the "Semi-anonymous Prompt" checkbox should be checked + Scenario: Editing prompt form doesn't cause semi-anon ticky to lose state (default semi-anonymous) + Given I set up an anon promptmeme "Scotts Prompt" with name "scotts_prompt" that is semi-anon + And a canonical fandom "Stargate Atlantis" + And I am logged in as "Scott" with password "password" + And I go to "Scotts Prompt" collection's page + And I follow "Prompt Form" + And I fill in the 1st field with id matching "fandom_tagnames" with "Stargate Atlantis" + And I uncheck "challenge_signup_requests_attributes_0_anonymous" + And I press "Submit" + Then I should see "Sign-up was successfully created." + And I should see "Request 1 by Scott" + When I follow "Edit Sign-up" + Then the "challenge_signup_requests_attributes_0_anonymous" checkbox should not be checked + # note: if ArchiveConfig.PROMPT_MEME_PROMPTS_MAX is ever changed this must be too + When I follow "My Prompts" + And I follow "Add Prompt" + When I fill in the 1st field with id matching "fandom_tagnames" with "Stargate Atlantis" + And I press "Submit" + Then I should see "Prompt was successfully added." + And I should see "Request 1 by Scott" + And I should see "Request 2 by Anonymous" + When I follow "Edit Sign-up" + Then the "challenge_signup_requests_attributes_0_anonymous" checkbox should not be checked + And the "challenge_signup_requests_attributes_1_anonymous" checkbox should be checked + Scenario: Dates should be correctly set on PromptMemes Given it is currently 2015-09-21 12:40 AM And I am logged in as "mod1" diff --git a/features/step_definitions/challenge_promptmeme_steps.rb b/features/step_definitions/challenge_promptmeme_steps.rb index b4582c23294..d36066bc24d 100644 --- a/features/step_definitions/challenge_promptmeme_steps.rb +++ b/features/step_definitions/challenge_promptmeme_steps.rb @@ -76,7 +76,7 @@ step %{I claim a prompt from "Battle 12"} end -When /^I set up an?(?: ([^"]*)) promptmeme "([^\"]*)"(?: with name "([^"]*)")?$/ do |type, title, name| +When /^I set up an?(?: ([^"]*)) promptmeme "([^\"]*)"(?: with name "([^"]*)")?(?: that is ([^\"]*))?$/ do |type, title, name, semianon| step %{I am logged in as "mod1"} visit new_collection_path if name.nil? @@ -100,6 +100,9 @@ fill_in("prompt_meme_request_restriction_attributes_fandom_num_allowed", with: 2) fill_in("Sign-up opens:", with: Date.yesterday) fill_in("Sign-up closes:", with: Date.tomorrow) + if semianon == "semi-anon" + check("Prompts anonymous by default?") + end step %{I submit} step "I should see \"Challenge was successfully created\"" end From 90324d5d623ff15b775eb138421bf3f978a68f55 Mon Sep 17 00:00:00 2001 From: techlingyi <166869872+techlingyi@users.noreply.github.com> Date: Sun, 3 May 2026 09:13:03 +0000 Subject: [PATCH 3/4] AO3-6857 Appease linter --- app/views/prompts/_prompt_form.html.erb | 4 ++-- features/step_definitions/challenge_promptmeme_steps.rb | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/views/prompts/_prompt_form.html.erb b/app/views/prompts/_prompt_form.html.erb index 8b9c239dc6e..954f6585527 100755 --- a/app/views/prompts/_prompt_form.html.erb +++ b/app/views/prompts/_prompt_form.html.erb @@ -88,8 +88,8 @@ %>
<%= form.label :anonymous, ts("Semi-anonymous Prompt?") %>
- <% # Default to the prompt's original anonymity value, unless we're making a new prompt and the challenge is anonymous. %> - <%= form.check_box :anonymous, :checked => form.object.anonymous? || (form.object.new_record? && @collection.challenge.anonymous?) %> + <%# Default to the prompt's original anonymity value, unless we're making a new prompt and the challenge is anonymous. %> + <%= form.check_box :anonymous, checked: form.object.anonymous? || (form.object.new_record? && @collection.challenge.anonymous?) %>

<%= ts("(Note: This is not totally secure, and is still guessable in some places.)") %>

<% end %> diff --git a/features/step_definitions/challenge_promptmeme_steps.rb b/features/step_definitions/challenge_promptmeme_steps.rb index d36066bc24d..0373914ec84 100644 --- a/features/step_definitions/challenge_promptmeme_steps.rb +++ b/features/step_definitions/challenge_promptmeme_steps.rb @@ -76,7 +76,7 @@ step %{I claim a prompt from "Battle 12"} end -When /^I set up an?(?: ([^"]*)) promptmeme "([^\"]*)"(?: with name "([^"]*)")?(?: that is ([^\"]*))?$/ do |type, title, name, semianon| +When /^I set up an?(?: ([^"]*)) promptmeme "([^"]*)"(?: with name "([^"]*)")?(?: that is ([^"]*))?$/ do |type, title, name, semianon| # rubocop:disable Cucumber/RegexStepName step %{I am logged in as "mod1"} visit new_collection_path if name.nil? @@ -100,9 +100,7 @@ fill_in("prompt_meme_request_restriction_attributes_fandom_num_allowed", with: 2) fill_in("Sign-up opens:", with: Date.yesterday) fill_in("Sign-up closes:", with: Date.tomorrow) - if semianon == "semi-anon" - check("Prompts anonymous by default?") - end + check("Prompts anonymous by default?") if semianon == "semi-anon" step %{I submit} step "I should see \"Challenge was successfully created\"" end From bec2de7b25939e12cb8fdcd8edc54c7a960fa765 Mon Sep 17 00:00:00 2001 From: techlingyi <166869872+techlingyi@users.noreply.github.com> Date: Mon, 4 May 2026 01:01:32 -0700 Subject: [PATCH 4/4] AO3-6857 Minor clean-up of cucumber tests --- features/prompt_memes_c/challenge_promptmeme_claims.feature | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/features/prompt_memes_c/challenge_promptmeme_claims.feature b/features/prompt_memes_c/challenge_promptmeme_claims.feature index 57d0145b665..2ec345812db 100644 --- a/features/prompt_memes_c/challenge_promptmeme_claims.feature +++ b/features/prompt_memes_c/challenge_promptmeme_claims.feature @@ -404,7 +404,7 @@ Feature: Prompt Meme Challenge And I am logged in as "Scott" with password "password" And I go to "Scotts Prompt" collection's page And I follow "Prompt Form" - And I check the 1st checkbox with id matching "anonymous" + And I check "Semi-anonymous Prompt" When I press "Submit" Then I should see "There were some problems with this submission. Please correct the mistakes below." And I should see "Your Request must include between 1 and 2 fandom tags, but you have included 0 fandom tags in your current Request." @@ -423,7 +423,6 @@ Feature: Prompt Meme Challenge And I should see "Request 1 by Scott" When I follow "Edit Sign-up" Then the "challenge_signup_requests_attributes_0_anonymous" checkbox should not be checked - # note: if ArchiveConfig.PROMPT_MEME_PROMPTS_MAX is ever changed this must be too When I follow "My Prompts" And I follow "Add Prompt" When I fill in the 1st field with id matching "fandom_tagnames" with "Stargate Atlantis" @@ -478,4 +477,4 @@ Feature: Prompt Meme Challenge When I am logged in as "myname1" And I claim a prompt from "Battle 12" And I fulfill my claim - Then I should see "In response to a prompt by myname4 in the Battle 12 collection" \ No newline at end of file + Then I should see "In response to a prompt by myname4 in the Battle 12 collection"