Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/models/challenge_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def self.order_by_offering_pseud(dir="ASC")
CollectionItem.user_approval_statuses[:approved], CollectionItem.collection_approval_statuses[:approved])
}

# TODO: AO3-6024 for making sure we also exclude works hidden by admin
scope :work_visible_to_all, -> { where("works.restricted = 0") }

scope :posted, -> { joins(WORKS_JOIN).where("challenge_claims.creation_id IS NOT NULL AND works.posted = 1") }

Expand Down
3 changes: 3 additions & 0 deletions app/models/prompt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ def fulfilled_claims
self.request_claims.fulfilled
end

def fulfilled_claims_visible_to_all
self.request_claims.fulfilled.work_visible_to_all
end
# Computes the "full" tag set (tag_set + optional_tag_set), and stores the
# result as an instance variable for speed. This is used by the matching
# algorithm, which doesn't change any signup/prompt/tagset information, so
Expand Down
6 changes: 4 additions & 2 deletions app/views/prompts/_prompt_blurb.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@
<% end %>

<% # if prompt has been fulfilled list works %>
<% unless prompt.unfulfilled? %>
<% unless prompt.unfulfilled? || (guest? && prompt.fulfilled_claims_visible_to_all.empty?) %>
<div class="work listbox group">
<h5 class="heading"><%= ts("Fulfilled By")%></h5>
<ul class="index group">
<% prompt.fulfilled_claims.map(&:creation).each do |creation| %>
<% if creation.is_a?(Work) %>
<%= render "works/work_blurb", :work => creation %>
<% unless guest? && creation.restricted %>
<%= render "works/work_blurb", work: creation %>
<% end %>
<% end %>
<% end %>
</ul>
Expand Down
19 changes: 19 additions & 0 deletions features/prompt_memes_b/challenge_promptmeme_posting_fills.feature
Original file line number Diff line number Diff line change
Expand Up @@ -593,3 +593,22 @@ Feature: Prompt Meme Challenge
And I uncheck "Battle 12 (prompter)"
And I press "Update"
Then I should see "For prompter."

Scenario: When a prompt is filled with a restricted work, the work should only be visible to logged-in users

Given I have Battle 12 prompt meme fully set up
And I am logged in as "myname1"
And I sign up for Battle 12
And I am logged in as "myname2"
And I claim a prompt from "Battle 12"
And I start to fulfill my claim with "Restricted Fill"
And I lock the work
And I press "Post"
When I view prompts for "Battle 12"
Then I should see "Fulfilled By"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be extra thorough and also check for the work with And I should see "Restricted Fill" (and do the opposite at the end, with And I should not see "Restricted Fill")

And I should see "Restricted Fill"
When I log out
And I go to "Battle 12" collection's page
And I follow "Prompts ("
Then I should not see "Fulfilled By"
And I should not see "Restricted Fill"
Loading