diff --git a/app/views/prompts/_prompt_form.html.erb b/app/views/prompts/_prompt_form.html.erb
index 9454d37b7b7..954f6585527 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?) %>
<% end %>
diff --git a/features/prompt_memes_c/challenge_promptmeme_claims.feature b/features/prompt_memes_c/challenge_promptmeme_claims.feature
index 7078d18a22d..2ec345812db 100644
--- a/features/prompt_memes_c/challenge_promptmeme_claims.feature
+++ b/features/prompt_memes_c/challenge_promptmeme_claims.feature
@@ -399,17 +399,41 @@ 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"
+ 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
+ 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"
@@ -453,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"
diff --git a/features/step_definitions/challenge_promptmeme_steps.rb b/features/step_definitions/challenge_promptmeme_steps.rb
index b4582c23294..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 "([^"]*)")?$/ do |type, title, name|
+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,6 +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)
+ check("Prompts anonymous by default?") if semianon == "semi-anon"
step %{I submit}
step "I should see \"Challenge was successfully created\""
end