Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2598 visibility badge #5524

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
3 changes: 1 addition & 2 deletions app/models/folder_workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ def translate_state_from(workflow)
end

# States in which the record can be publicly viewable
# All states must be included here because any state is viewable if its container allows it
# @return array of strings
def self.public_read_states
[:needs_qa, :complete].map(&:to_s)
[:complete].map(&:to_s)
end

# States in which read groups for the record are indexable
Expand Down
8 changes: 8 additions & 0 deletions spec/decorators/valkyrie/resource_decorator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@ class MyResource < Resource
expect(decorator.visibility.first).to have_selector("div.alert-warning", text: "Users will not be able to view this digital object on discovery sites due to the workflow status.")
end
end

context "needs_qa open resource" do
let(:resource) { FactoryBot.build(:needs_qa_ephemera_folder) }

it "has a warning about the workflow" do
expect(decorator.visibility.first).to have_selector("div.alert-warning", text: "Users will not be able to view this digital object on discovery sites due to the workflow status.")
end
end

context "complete netid resource" do
let(:resource) { FactoryBot.build(:complete_campus_only_scanned_resource) }
Expand Down
4 changes: 4 additions & 0 deletions spec/factories/ephemera_folder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
factory :complete_ephemera_folder do
state { "complete" }
end
factory :needs_qa_ephemera_folder do
visibility { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC }
state { "needs_qa" }
end
factory :non_validating_ephemera_folder do
barcode { nil }
end
Expand Down
3 changes: 3 additions & 0 deletions spec/factories/scanned_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
factory :pending_scanned_resource do
state { "pending" }
end
factory :needs_qa_scanned_resource do
state { "needs_qa" }
end
factory :draft_cdl_resource do
state { "draft" }
change_set { "CDL::Resource" }
Expand Down