diff --git a/app/models/challenge_claim.rb b/app/models/challenge_claim.rb index ea104c56d03..5841ee42843 100755 --- a/app/models/challenge_claim.rb +++ b/app/models/challenge_claim.rb @@ -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") } diff --git a/app/models/prompt.rb b/app/models/prompt.rb index cdae4bb6a4a..9f18cef92d8 100755 --- a/app/models/prompt.rb +++ b/app/models/prompt.rb @@ -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 diff --git a/app/views/prompts/_prompt_blurb.html.erb b/app/views/prompts/_prompt_blurb.html.erb index d4834502206..be901dc41e7 100755 --- a/app/views/prompts/_prompt_blurb.html.erb +++ b/app/views/prompts/_prompt_blurb.html.erb @@ -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?) %>