From 3f22a0c63cdf48d77c3c9d2c0466cce9fac2fb75 Mon Sep 17 00:00:00 2001 From: Smulligan Date: Tue, 6 Jan 2026 13:14:33 -0500 Subject: [PATCH 1/9] add fourth embargo for graduate liberal arts students only --- Gemfile.lock | 2 +- app/javascript/author/invention_disclosure.js | 3 +- app/models/concerns/admin_statuses.rb | 2 +- .../lionpath/lionpath_export_payload.rb | 1 + app/models/submission.rb | 15 +++++++--- app/presenters/admin/submission_form_view.rb | 6 ++-- app/services/submission_release_service.rb | 4 +-- .../edit/_final_submission_fields.html.erb | 13 ++++++--- .../_access_level_standard.html.erb | 24 +++++++++------ .../partners/en/graduate/graduate.en.yml | 4 +++ .../submissions/admin_access_level_spec.rb | 26 +++++++++++++++++ .../author/submission_access_level_spec.rb | 27 +++++++++++++++++ spec/models/access_level_spec.rb | 11 +++++-- spec/models/concerns/admin_statuses.rb | 21 ++++++++++---- spec/models/submission_spec.rb | 29 +++++++++++++++++-- .../admin/submission_form_view_spec.rb | 27 ++++++++++++----- .../final_submission_files_view_spec.rb | 7 +++++ spec/services/auto_release_service_spec.rb | 10 +++++-- .../submission_release_service_spec.rb | 12 ++++++++ 19 files changed, 200 insertions(+), 44 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index aeec422f1..7540c49c6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -168,7 +168,7 @@ GEM rubocop (>= 1) smart_properties erubi (1.13.1) - etda_utilities (0.21.0) + etda_utilities (0.21.1) factory_bot (6.5.1) activesupport (>= 6.1.0) factory_bot_rails (6.4.4) diff --git a/app/javascript/author/invention_disclosure.js b/app/javascript/author/invention_disclosure.js index 33bb722a0..ebc701bba 100644 --- a/app/javascript/author/invention_disclosure.js +++ b/app/javascript/author/invention_disclosure.js @@ -18,7 +18,8 @@ const bind_to_access_level = () => e.preventDefault; } - if ($('div.author #submission_access_level_restricted_to_institution').prop('checked')) { + if ($('div.author #submission_access_level_restricted_to_institution').prop('checked') || + $('div.author #submission_access_level_restricted_liberal_arts').prop('checked')) { $('div#restricted_note').removeClass('d-none'); return $('#submission_restricted_notes').focus(); } else { diff --git a/app/models/concerns/admin_statuses.rb b/app/models/concerns/admin_statuses.rb index 255460eaa..9822a126e 100644 --- a/app/models/concerns/admin_statuses.rb +++ b/app/models/concerns/admin_statuses.rb @@ -84,7 +84,7 @@ def final_submission_on_hold end def final_restricted_institution - access_level == 'restricted_to_institution' && status.start_with?('released for publication') + access_level.in?(['restricted_to_institution', 'restricted_liberal_arts']) && status.start_with?('released for publication') end def final_withheld diff --git a/app/models/lionpath/lionpath_export_payload.rb b/app/models/lionpath/lionpath_export_payload.rb index 764fed2b2..1c2cfe283 100644 --- a/app/models/lionpath/lionpath_export_payload.rb +++ b/app/models/lionpath/lionpath_export_payload.rb @@ -48,6 +48,7 @@ def embargo_type access_level_map = { 'open_access' => 'OPEN', 'restricted_to_institution' => 'RPSU', + 'restricted_liberal_arts' => 'RLA', 'restricted' => 'RSTR' } access_level_map[submission.access_level] diff --git a/app/models/submission.rb b/app/models/submission.rb index db43f0e05..08eebdeba 100755 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -140,18 +140,21 @@ def program_head scope :final_submission_is_approved, -> { where(status: 'waiting for publication release') } scope :final_submission_is_on_hold, -> { where(status: 'waiting in final submission on hold') } scope :released_for_publication, -> { where('status LIKE "released for publication%"') } - scope :final_is_restricted_institution, -> { where('status LIKE "released for publication%"').where(access_level: 'restricted_to_institution') } + scope :final_is_restricted_institution, -> { where('status LIKE "released for publication%"').where(access_level: ['restricted_to_institution', 'restricted_liberal_arts']) } scope :final_is_withheld, -> { where('status LIKE "released for publication%"').where(access_level: 'restricted') } scope :ok_to_release, -> { where('released_for_publication_at <= ?', Time.zone.today.end_of_day) } scope :ok_to_autorelease, -> { - ok_to_release.where(access_level: 'restricted_to_institution') + ok_to_release.where(access_level: ['restricted_to_institution', 'restricted_liberal_arts']) .where(status: 'released for publication metadata only') } scope :release_warning_needed?, -> { - where('released_metadata_at >= ?', Time.zone.today.years_ago(2).end_of_day) + where( + '(released_metadata_at >= ? AND access_level = ?) OR (released_metadata_at >= ? AND access_level = ?)', + Time.zone.today.years_ago(2).end_of_day, 'restricted_to_institution', + Time.zone.today.years_ago(5).end_of_day, 'restricted_liberal_arts' + ) .where('released_for_publication_at <= ?', Time.zone.today.next_month) .where(author_release_warning_sent_at: nil) - .where(access_level: 'restricted_to_institution') } def advisor @@ -334,6 +337,8 @@ def final_submission_rejected? delegate :restricted_to_institution?, to: :access_level + delegate :restricted_liberal_arts?, to: :access_level + def publication_release_access_level return 'open_access' if status_behavior.released_for_publication? # full release of submission that was held for 2 years @@ -349,6 +354,8 @@ def publication_release_date(date_to_release) # released_fo_publication_at = date_to_release return date_to_release if open_access? + return date_to_release.to_date + 5.years if restricted_liberal_arts? + date_to_release.to_date + 2.years end diff --git a/app/presenters/admin/submission_form_view.rb b/app/presenters/admin/submission_form_view.rb index f31c1fb41..46bdb0cbb 100644 --- a/app/presenters/admin/submission_form_view.rb +++ b/app/presenters/admin/submission_form_view.rb @@ -29,7 +29,7 @@ def title return 'Edit Final Submission On Hold' if status_behavior.waiting_in_final_submission_on_hold? return 'Edit Released Submission' if status_behavior.released_for_publication? && open_access? return 'Edit Restricted Submission' if status_behavior.released_for_publication_metadata_only? && restricted? - return 'Edit Final Submission is Restricted to Penn State' if status_behavior.released_for_publication? && access_level == 'restricted_to_institution' + return 'Edit Final Submission is Restricted to Penn State' if status_behavior.released_for_publication? && (access_level == 'restricted_to_institution' || access_level == 'restricted_liberal_arts') 'Edit Incomplete Format Review' end @@ -79,7 +79,7 @@ def release_date_history case access_level when 'restricted' "Metadata released: #{date_information(released_metadata_at)}
Scheduled for full release: #{date_information(released_for_publication_at)}".html_safe - when 'restricted_to_institution' + when 'restricted_to_institution', 'restricted_liberal_arts' "Released to Penn State Community: #{date_information(released_metadata_at)}
Scheduled for full release: #{date_information(released_for_publication_at)}".html_safe else metadata_str = '' @@ -139,7 +139,7 @@ def cancel_url # return "/admin/#{degree_type}/released_for_publication" if status_behavior.released_for_publication? && open_access? TOO SLOW; RETURN TO DASHBOARD return "/admin/#{degree_type.slug}" if status_behavior.released_for_publication? && open_access? return "/admin/#{degree_type.slug}/final_withheld" if status_behavior.released_for_publication_metadata_only? && restricted? - return "/admin/#{degree_type.slug}/final_restricted_institution" if status_behavior.released_for_publication? && access_level == 'restricted_to_institution' + return "/admin/#{degree_type.slug}/final_restricted_institution" if status_behavior.released_for_publication? && (access_level == 'restricted_to_institution' || access_level == 'restricted_liberal_arts') "/admin/#{degree_type.slug}/format_review_incomplete" end diff --git a/app/services/submission_release_service.rb b/app/services/submission_release_service.rb index 48174f671..f8f634cfd 100644 --- a/app/services/submission_release_service.rb +++ b/app/services/submission_release_service.rb @@ -73,7 +73,7 @@ def publish_a_submission(submission, date_to_release, original_final_files) status_giver = SubmissionStatusGiver.new(submission) status_giver.can_release_for_publication? - if submission.restricted? || submission.restricted_to_institution? + if submission.restricted? || submission.restricted_to_institution? || submission.restricted_liberal_arts? status_giver.released_for_publication_metadata_only! else status_giver.released_for_publication! @@ -97,7 +97,7 @@ def update_restricted_submission_to_open_access(submission, date_to_release, ori new_public_id = submission.public_id.presence || PublicIdMinter.new(submission).id return unless public_id_ok(new_public_id) - return if new_access_level == 'restricted' || new_access_level == 'restricted to institution' + return if new_access_level == 'restricted' || new_access_level == 'restricted to institution' || new_access_level == 'restricted liberal arts' status_giver = SubmissionStatusGiver.new(submission) status_giver.can_release_for_publication? diff --git a/app/views/admin/submissions/edit/_final_submission_fields.html.erb b/app/views/admin/submissions/edit/_final_submission_fields.html.erb index f0e659278..2194561f6 100644 --- a/app/views/admin/submissions/edit/_final_submission_fields.html.erb +++ b/app/views/admin/submissions/edit/_final_submission_fields.html.erb @@ -26,11 +26,16 @@ <% end %>
+ <% access_level_collection = AccessLevel.display.filter_map do |k| + next if k[:type] == 'restricted_liberal_arts' && @submission.academic_program != 'LA' - <%= f.input :access_level, as: :radio_buttons, - collection: AccessLevel.display.map { |k| [" #{k[:label]} -- #{k[:description]} #{render partial: 'restricted_notes', locals: {f: f} if @view.psu_only(k[:label])}".html_safe, k[:type], { class: "#{k[:type]}" }] }, - wrapper: :vertical_radio_and_checkboxes, - label: 'Access level*'.html_safe %> + ["#{k[:label]} -- #{k[:description]}".html_safe, k[:type], { class: "#{k[:type]}" }] + end %> + <%= f.input :access_level, as: :radio_buttons, + label: 'Access level*'.html_safe, + required: true, + collection: access_level_collection, + wrapper: :vertical_radio_and_checkboxes %> <%= render partial: 'admin_invention_disclosure_information', locals: {f: f} %> <% end %> -
- <%= f.input :access_level, - as: :radio_buttons, - label: "Access Level", - required: true, - collection: AccessLevel.display.map{ |k| ["#{k[:label]} -- #{k[:description]}".html_safe, - k[:type], { class: "#{k[:type]}" }]}, - wrapper: :vertical_radio_and_checkboxes %> -
+
+ <% + access_level_collection = AccessLevel.display.filter_map do |k| + next if k[:type] == 'restricted_liberal_arts' && @submission.academic_program != 'LA' + + ["#{k[:label]} -- #{k[:description]}".html_safe, k[:type], { class: "#{k[:type]}" }] + end + %> + <%= f.input :access_level, + as: :radio_buttons, + label: "Access Level", + required: true, + collection: access_level_collection, + wrapper: :vertical_radio_and_checkboxes %> +
<%= render partial: 'invention_disclosure_information', locals: {f: f} %> diff --git a/config/locales/partners/en/graduate/graduate.en.yml b/config/locales/partners/en/graduate/graduate.en.yml index bf3ee3be1..258dbc80a 100644 --- a/config/locales/partners/en/graduate/graduate.en.yml +++ b/config/locales/partners/en/graduate/graduate.en.yml @@ -345,6 +345,10 @@ en: restricted_to_institution_attr: description_html: 'Access restricted to individuals having a valid Penn State Access Account, for a period of two years. Allows restricted access of the entire work beginning immediately after degree conferral. At the end of the two-year period, the status will automatically change to Open Access. Intended for use by authors in cases where prior public release of the work may compromise its acceptance for publication.' scope: final_restricted_institution + restricted_liberal_arts: 'Restricted (Liberal Arts Only)' + restricted_liberal_arts_attr: + description_html: 'Immediately after the conferral of the degree, the abstract becomes accessible worldwide. All other parts of the document are restricted to Penn State only for an embargo period of five (5) years for dissertations/thesis from the College of the Liberal Arts. No extensions will be granted beyond five (5) years.' + scope: final_restricted_institution restricted: 'Restricted' restricted_attr: description_html: 'Restricts the entire work for the purpose of filing a patent. At the end of the two-year period, the status will automatically change to Open Access. Selection of this option requires that an invention disclosure (ID) be filed with the Office of Technology Management (OTM) prior to submission of the final thesis/dissertation, and confirmed by OTM.' diff --git a/spec/integration/admin/submissions/admin_access_level_spec.rb b/spec/integration/admin/submissions/admin_access_level_spec.rb index fdece7f73..fbba38e1a 100644 --- a/spec/integration/admin/submissions/admin_access_level_spec.rb +++ b/spec/integration/admin/submissions/admin_access_level_spec.rb @@ -53,5 +53,31 @@ click_button('Update Metadata Only') expect(page).not_to have_content('Invention disclosure number is required for Restricted submissions.') end + + context 'when author is in college of liberal arts' do + unless current_partner.milsch? + before do + submission.update(academic_program: 'LA') + page.refresh + end + + it 'has a restricted_liberal_arts radio button' do + page.find("input#submission_access_level_restricted_liberal_arts").click + expect(page.find("input#submission_access_level_restricted_liberal_arts")).to be_checked + expect(page).to have_field('submission_invention_disclosures_attributes_0_id_number') + end + end + end + + context 'when author is not in college of liberal arts' do + before do + submission.update(academic_program: 'CA') + page.refresh + end + + it 'does not have a restricted_liberal_arts radio button' do + expect(page).not_to have_selector("input#submission_access_level_restricted_liberal_arts") + end + end end end diff --git a/spec/integration/author/submission_access_level_spec.rb b/spec/integration/author/submission_access_level_spec.rb index eff5bb2de..8b9b70c4a 100644 --- a/spec/integration/author/submission_access_level_spec.rb +++ b/spec/integration/author/submission_access_level_spec.rb @@ -46,6 +46,33 @@ click_button('Submit final files for review') expect(page).not_to have_content('Invention disclosure number is required for Restricted submissions.') end + + context 'when graduate author is in college of liberal arts' do + unless current_partner.honors? + before do + submission.update(academic_program: 'LA') + page.refresh + end + + it 'has a restricted_liberal_arts radio button' do + page.find("input#submission_access_level_restricted_liberal_arts").click + expect(page.find("input#submission_access_level_restricted_liberal_arts")).to be_checked + expect(page).not_to have_content('Enter justification') + expect(page).not_to have_field('submission_invention_disclosures_attributes_0_id_number') + end + end + end + + context 'when author is not in college of liberal arts' do + before do + submission.update(academic_program: 'CA') + page.refresh + end + + it 'does not have a restricted_liberal_arts radio button' do + expect(page).not_to have_selector("input#submission_access_level_restricted_liberal_arts") + end + end end end diff --git a/spec/models/access_level_spec.rb b/spec/models/access_level_spec.rb index e8d5a54da..bfa9ea06a 100755 --- a/spec/models/access_level_spec.rb +++ b/spec/models/access_level_spec.rb @@ -6,15 +6,17 @@ let(:open_access_view_struct) { { type: 'open_access', label: 'Open Access', description: EtdaUtilities::AccessLevel.partner_access_levels['access_level']['open_access_attr']['description_html'] } } let(:restricted_view_struct) { { type: 'restricted', label: 'Restricted', description: EtdaUtilities::AccessLevel.partner_access_levels['access_level']['restricted_attr']['description_html'] } } let(:restricted_to_institution_view_struct) { { type: 'restricted_to_institution', label: 'Restricted (Penn State Only)', description: EtdaUtilities::AccessLevel.partner_access_levels['access_level']['restricted_to_institution_attr']['description_html'] } } + let(:restricted_liberal_arts_view_struct) { { type: 'restricted_liberal_arts', label: 'Restricted (Liberal Arts Only)', description: EtdaUtilities::AccessLevel.partner_access_levels['access_level']['restricted_liberal_arts_attr']['description_html'] } } describe '#ACCESS_LEVEL_KEYS' do it 'constant containing all access levels' do - expect(described_class::ACCESS_LEVEL_KEYS).to contain_exactly('open_access', 'restricted_to_institution', 'restricted', '') + expect(described_class::ACCESS_LEVEL_KEYS).to contain_exactly('open_access', 'restricted_to_institution', 'restricted', 'restricted_liberal_arts', '') expect(described_class::ACCESS_LEVEL_KEYS).to include('open_access') expect(described_class::ACCESS_LEVEL_KEYS).to include('restricted') expect(described_class::ACCESS_LEVEL_KEYS).to include('restricted_to_institution') + expect(described_class::ACCESS_LEVEL_KEYS).to include('restricted_liberal_arts') expect(described_class::ACCESS_LEVEL_KEYS).to include('') - expect(described_class::ACCESS_LEVEL_KEYS.length).to eq(4) + expect(described_class::ACCESS_LEVEL_KEYS.length).to eq(5) end end @@ -45,14 +47,17 @@ expect(described_class.paper_access_levels).to include(open_access_view_struct) expect(described_class.paper_access_levels).to include(restricted_view_struct) expect(described_class.paper_access_levels).to include(restricted_to_institution_view_struct) + expect(described_class.paper_access_levels).to include(restricted_liberal_arts_view_struct) end end describe 'ordering' do - it "levels should evaluate int he correct order" do + it "levels should evaluate in the correct order" do expect(described_class.OPEN_ACCESS.to_i < described_class.RESTRICTED.to_i).to be_truthy expect(described_class.OPEN_ACCESS.to_i < described_class.RESTRICTED_TO_INSTITUTION.to_i).to be_truthy + expect(described_class.OPEN_ACCESS.to_i < described_class.RESTRICTED_LIBERAL_ARTS.to_i).to be_truthy expect(described_class.RESTRICTED_TO_INSTITUTION.to_i < described_class.RESTRICTED.to_i).to be_truthy + expect(described_class.RESTRICTED_LIBERAL_ARTS.to_i < described_class.RESTRICTED.to_i).to be_truthy end end end diff --git a/spec/models/concerns/admin_statuses.rb b/spec/models/concerns/admin_statuses.rb index bc2a4d16d..68373ca89 100644 --- a/spec/models/concerns/admin_statuses.rb +++ b/spec/models/concerns/admin_statuses.rb @@ -78,11 +78,22 @@ end context 'when the admin status is final_restricted_institution' do - it 'returns the correct label' do - status = 'final_restricted_institution' - submission = Submission.new(status: 'released for publication!!!', - access_level: 'restricted_to_institution') - expect(submission.admin_status).to eq I18n.t!("#{current_partner.id}.admin_filters.#{status}.title") + context 'when access level is restricted to institution' do + it 'returns the correct label' do + status = 'final_restricted_institution' + submission = Submission.new(status: 'released for publication!!!', + access_level: 'restricted_to_institution') + expect(submission.admin_status).to eq I18n.t!("#{current_partner.id}.admin_filters.#{status}.title") + end + end + + context 'when access level is restricted liberal arts' do + it 'returns the correct label' do + status = 'final_restricted_institution' + submission = Submission.new(status: 'released for publication!!!', + access_level: 'restricted_liberal_arts') + expect(submission.admin_status).to eq I18n.t!("#{current_partner.id}.admin_filters.#{status}.title") + end end end diff --git a/spec/models/submission_spec.rb b/spec/models/submission_spec.rb index 28b3ee508..9ad08b9d4 100755 --- a/spec/models/submission_spec.rb +++ b/spec/models/submission_spec.rb @@ -135,9 +135,15 @@ access_level: 'restricted_to_institution', status: 'waiting for publication release' end + let!(:sub6) do + FactoryBot.create :submission, + released_for_publication_at: Time.zone.today.days_ago(1), + access_level: 'restricted_liberal_arts', + status: 'released for publication metadata only' + end it 'returns submissions that are ready for autorelease' do - expect(described_class.ok_to_autorelease).to contain_exactly(sub1, sub2) + expect(described_class.ok_to_autorelease).to contain_exactly(sub1, sub2, sub6) end end @@ -165,9 +171,21 @@ released_for_publication_at: Time.zone.today + 6.weeks, released_metadata_at: Time.zone.today.years_ago(1) end + let!(:sub5) do + FactoryBot.create :submission, + released_for_publication_at: Time.zone.today.next_month, + released_metadata_at: Time.zone.today.years_ago(4), + access_level: 'restricted_liberal_arts' + end + let!(:sub6) do + FactoryBot.create :submission, + released_for_publication_at: Time.zone.today.next_month, + released_metadata_at: Time.zone.today.years_ago(6), + access_level: 'restricted_liberal_arts' + end it 'returns submissions that are ready for autorelease' do - expect(described_class.release_warning_needed?).to contain_exactly(sub1) + expect(described_class.release_warning_needed?).to contain_exactly(sub1, sub5) end end @@ -830,6 +848,13 @@ date_to_release = Time.zone.tomorrow expect(submission.publication_release_date(date_to_release)).to eq(date_to_release + 2.years) end + + it 'returns the release date plus 5 years for submissions not yet published and are liberal arts restricted' do + submission = FactoryBot.create :submission, :waiting_for_publication_release + submission.access_level = 'restricted_liberal_arts' + date_to_release = Time.zone.tomorrow + expect(submission.publication_release_date(date_to_release)).to eq(date_to_release + 5.years) + end end context 'update timestamps' do diff --git a/spec/presenters/admin/submission_form_view_spec.rb b/spec/presenters/admin/submission_form_view_spec.rb index 6cdb910c2..e33413841 100644 --- a/spec/presenters/admin/submission_form_view_spec.rb +++ b/spec/presenters/admin/submission_form_view_spec.rb @@ -141,13 +141,26 @@ end context "When the status is 'psu-only'" do - before do - submission.status = 'released for publication' - submission.access_level = 'restricted_to_institution' - end - - it "returns 'final_restricted_institution'" do - expect(view.actions_partial_name).to eq 'restricted_institution_actions' + context 'when access level is restricted to institution' do + before do + submission.status = 'released for publication' + submission.access_level = 'restricted_to_institution' + end + + it "returns 'final_restricted_institution'" do + expect(view.actions_partial_name).to eq 'restricted_institution_actions' + end + end + + context 'when access level is restricted to liberal arts' do + before do + submission.status = 'released for publication' + submission.access_level = 'restricted_liberal_arts' + end + + it "returns 'final_restricted_institution'" do + expect(view.actions_partial_name).to eq 'restricted_institution_actions' + end end end end diff --git a/spec/presenters/author/final_submission_files_view_spec.rb b/spec/presenters/author/final_submission_files_view_spec.rb index cbb98d6d5..11b57f1db 100644 --- a/spec/presenters/author/final_submission_files_view_spec.rb +++ b/spec/presenters/author/final_submission_files_view_spec.rb @@ -74,6 +74,13 @@ end end + context 'restricted_liberal_arts' do + it 'returns restricted_liberal_arts label' do + submission.access_level = 'restricted_liberal_arts' + expect(view.selected_access_level).to eq(submission.current_access_level.label) + end + end + context 'restricted' do it 'returns restricted label' do submission.access_level = 'restricted' diff --git a/spec/services/auto_release_service_spec.rb b/spec/services/auto_release_service_spec.rb index e0c4049ff..e06dd7cb8 100644 --- a/spec/services/auto_release_service_spec.rb +++ b/spec/services/auto_release_service_spec.rb @@ -35,12 +35,18 @@ access_level: 'restricted_to_institution', status: 'waiting for publication release' end + let!(:sub6) do + FactoryBot.create :submission, + released_for_publication_at: Time.zone.today.days_ago(1), + access_level: 'restricted_liberal_arts', + status: 'released for publication metadata only' + end - before { allow(Submission).to receive(:release_for_publication).with([sub1.id, sub3.id], DateTime.now.end_of_day, 'Release as Open Access') } + before { allow(Submission).to receive(:release_for_publication).with([sub1.id, sub3.id, sub6.id], DateTime.now.end_of_day, 'Release as Open Access') } it 'sends eligible submissions for release to publication' do described_class.new.release - expect(Submission).to have_received(:release_for_publication).with([sub1.id, sub3.id], DateTime.now.end_of_day, 'Release as Open Access') + expect(Submission).to have_received(:release_for_publication).with([sub1.id, sub3.id, sub6.id], DateTime.now.end_of_day, 'Release as Open Access') end end diff --git a/spec/services/submission_release_service_spec.rb b/spec/services/submission_release_service_spec.rb index b2309c269..a2e675efb 100644 --- a/spec/services/submission_release_service_spec.rb +++ b/spec/services/submission_release_service_spec.rb @@ -36,6 +36,18 @@ end end + context "when submission's access_level is restricted_liberal_arts" do + let(:submission) do + FactoryBot.create :submission, :waiting_for_publication_release, access_level: 'restricted_liberal_arts' + end + + it "changes the submission's status to 'released for publication metadata only'" do + service.publish([submission.id], DateTime.now, release_type) + submission.reload + expect(submission.status).to eq 'released for publication metadata only' + end + end + context "when submission's access_level is restricted" do let(:submission) do FactoryBot.create :submission, :waiting_for_publication_release, access_level: 'restricted_to_institution' From 4eec25a3cf3c524c75c933845a2f34c995f99e85 Mon Sep 17 00:00:00 2001 From: Smulligan Date: Tue, 6 Jan 2026 13:20:47 -0500 Subject: [PATCH 2/9] add check for graduate partner to liberal arts only embargo field --- .../admin/submissions/edit/_final_submission_fields.html.erb | 2 +- app/views/author/submissions/_access_level_standard.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/submissions/edit/_final_submission_fields.html.erb b/app/views/admin/submissions/edit/_final_submission_fields.html.erb index 2194561f6..dadfd79fe 100644 --- a/app/views/admin/submissions/edit/_final_submission_fields.html.erb +++ b/app/views/admin/submissions/edit/_final_submission_fields.html.erb @@ -27,7 +27,7 @@
<% access_level_collection = AccessLevel.display.filter_map do |k| - next if k[:type] == 'restricted_liberal_arts' && @submission.academic_program != 'LA' + next if k[:type] == 'restricted_liberal_arts' && @submission.academic_program != 'LA' && !current_partner.graduate? ["#{k[:label]} -- #{k[:description]}".html_safe, k[:type], { class: "#{k[:type]}" }] end %> diff --git a/app/views/author/submissions/_access_level_standard.html.erb b/app/views/author/submissions/_access_level_standard.html.erb index d3ffc70cd..b089aaa98 100644 --- a/app/views/author/submissions/_access_level_standard.html.erb +++ b/app/views/author/submissions/_access_level_standard.html.erb @@ -8,7 +8,7 @@
<% access_level_collection = AccessLevel.display.filter_map do |k| - next if k[:type] == 'restricted_liberal_arts' && @submission.academic_program != 'LA' + next if k[:type] == 'restricted_liberal_arts' && @submission.academic_program != 'LA' && !current_partner.graduate? ["#{k[:label]} -- #{k[:description]}".html_safe, k[:type], { class: "#{k[:type]}" }] end From 33b87b97ac30937050c88f1702ac83527f2aafdc Mon Sep 17 00:00:00 2001 From: Smulligan Date: Tue, 6 Jan 2026 14:35:48 -0500 Subject: [PATCH 3/9] correct admin embargo filter --- .../admin/submissions/edit/_final_submission_fields.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/submissions/edit/_final_submission_fields.html.erb b/app/views/admin/submissions/edit/_final_submission_fields.html.erb index dadfd79fe..3ef2a5135 100644 --- a/app/views/admin/submissions/edit/_final_submission_fields.html.erb +++ b/app/views/admin/submissions/edit/_final_submission_fields.html.erb @@ -27,7 +27,7 @@

<% access_level_collection = AccessLevel.display.filter_map do |k| - next if k[:type] == 'restricted_liberal_arts' && @submission.academic_program != 'LA' && !current_partner.graduate? + next if k[:type] == 'restricted_liberal_arts' && (@submission.academic_program != 'LA' || !current_partner.graduate?) ["#{k[:label]} -- #{k[:description]}".html_safe, k[:type], { class: "#{k[:type]}" }] end %> From e4f04b05cd67a8a091f4c8627fc85f3e0c030bee Mon Sep 17 00:00:00 2001 From: Smulligan Date: Wed, 7 Jan 2026 11:16:16 -0500 Subject: [PATCH 4/9] update etda_utilities --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7540c49c6..de13f2fe9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -168,7 +168,7 @@ GEM rubocop (>= 1) smart_properties erubi (1.13.1) - etda_utilities (0.21.1) + etda_utilities (0.21.2) factory_bot (6.5.1) activesupport (>= 6.1.0) factory_bot_rails (6.4.4) From 8817066aafef55c7c30403de270472a9ae24aef8 Mon Sep 17 00:00:00 2001 From: Smulligan Date: Mon, 12 Jan 2026 11:04:16 -0500 Subject: [PATCH 5/9] remove restricted liberal arts embargo from milsch --- app/views/author/submissions/_access_level_static.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/author/submissions/_access_level_static.html.erb b/app/views/author/submissions/_access_level_static.html.erb index 008b39cb2..0512203a5 100644 --- a/app/views/author/submissions/_access_level_static.html.erb +++ b/app/views/author/submissions/_access_level_static.html.erb @@ -3,6 +3,7 @@ <%= f.input :access_level, as: :hidden, input_html: { value: "#{@submission.access_level}" } %>
    <% AccessLevel.display.each do |k| %> + <% next if k[:type] == 'restricted_liberal_arts' %>
  • <%= k[:label] %> -- <%= k[:description].html_safe %>
  • <%= render partial: 'restricted_note_field', locals: {f: f} if @view.psu_only(k[:label]) %> <%= render partial: 'invention_disclosure_information', locals: {f: f} if k[:label] == 'Restricted' %> From 490810d87e2fd4db50d149e0a54698b2241c5e33 Mon Sep 17 00:00:00 2001 From: Smulligan Date: Mon, 12 Jan 2026 12:19:20 -0500 Subject: [PATCH 6/9] add justification field back to admin embargo fields --- .../admin/submissions/edit/_final_submission_fields.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/submissions/edit/_final_submission_fields.html.erb b/app/views/admin/submissions/edit/_final_submission_fields.html.erb index 3ef2a5135..52a87f497 100644 --- a/app/views/admin/submissions/edit/_final_submission_fields.html.erb +++ b/app/views/admin/submissions/edit/_final_submission_fields.html.erb @@ -29,7 +29,7 @@ <% access_level_collection = AccessLevel.display.filter_map do |k| next if k[:type] == 'restricted_liberal_arts' && (@submission.academic_program != 'LA' || !current_partner.graduate?) - ["#{k[:label]} -- #{k[:description]}".html_safe, k[:type], { class: "#{k[:type]}" }] + [" #{k[:label]} -- #{k[:description]} #{render partial: 'restricted_notes', locals: {f: f} if @view.psu_only(k[:label])}".html_safe, k[:type], { class: "#{k[:type]}" }] end %> <%= f.input :access_level, as: :radio_buttons, label: 'Access level*'.html_safe, From be10c816350264ee416486859f6dad4510b9bb90 Mon Sep 17 00:00:00 2001 From: Smulligan Date: Tue, 13 Jan 2026 13:21:05 -0500 Subject: [PATCH 7/9] refactor tests --- .../submissions/admin_access_level_spec.rb | 16 ++++--- .../author/submission_access_level_spec.rb | 42 +++++++++++-------- spec/models/submission_spec.rb | 2 +- 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/spec/integration/admin/submissions/admin_access_level_spec.rb b/spec/integration/admin/submissions/admin_access_level_spec.rb index fbba38e1a..d85a70220 100644 --- a/spec/integration/admin/submissions/admin_access_level_spec.rb +++ b/spec/integration/admin/submissions/admin_access_level_spec.rb @@ -55,18 +55,24 @@ end context 'when author is in college of liberal arts' do - unless current_partner.milsch? - before do - submission.update(academic_program: 'LA') - page.refresh - end + before do + submission.update(academic_program: 'LA') + page.refresh + end + if current_partner.graduate? it 'has a restricted_liberal_arts radio button' do page.find("input#submission_access_level_restricted_liberal_arts").click expect(page.find("input#submission_access_level_restricted_liberal_arts")).to be_checked expect(page).to have_field('submission_invention_disclosures_attributes_0_id_number') end end + + unless current_partner.graduate? + it 'does not have a restricted_liberal_arts radio button' do + expect(page).not_to have_selector("input#submission_access_level_restricted_liberal_arts") + end + end end context 'when author is not in college of liberal arts' do diff --git a/spec/integration/author/submission_access_level_spec.rb b/spec/integration/author/submission_access_level_spec.rb index 8b9b70c4a..5215a2259 100644 --- a/spec/integration/author/submission_access_level_spec.rb +++ b/spec/integration/author/submission_access_level_spec.rb @@ -46,34 +46,40 @@ click_button('Submit final files for review') expect(page).not_to have_content('Invention disclosure number is required for Restricted submissions.') end + end - context 'when graduate author is in college of liberal arts' do - unless current_partner.honors? - before do - submission.update(academic_program: 'LA') - page.refresh - end - - it 'has a restricted_liberal_arts radio button' do - page.find("input#submission_access_level_restricted_liberal_arts").click - expect(page.find("input#submission_access_level_restricted_liberal_arts")).to be_checked - expect(page).not_to have_content('Enter justification') - expect(page).not_to have_field('submission_invention_disclosures_attributes_0_id_number') - end - end + context 'when author is in college of liberal arts' do + before do + submission.update(academic_program: 'LA') + page.refresh end - context 'when author is not in college of liberal arts' do - before do - submission.update(academic_program: 'CA') - page.refresh + if current_partner.graduate? + it 'has a restricted_liberal_arts radio button' do + page.find("input#submission_access_level_restricted_liberal_arts").click + expect(page.find("input#submission_access_level_restricted_liberal_arts")).to be_checked + expect(page).not_to have_content('Enter justification') + expect(page).not_to have_field('submission_invention_disclosures_attributes_0_id_number') end + end + unless current_partner.graduate? it 'does not have a restricted_liberal_arts radio button' do expect(page).not_to have_selector("input#submission_access_level_restricted_liberal_arts") end end end + + context 'when author is not in college of liberal arts' do + before do + submission.update(academic_program: 'CA') + page.refresh + end + + it 'does not have a restricted_liberal_arts radio button' do + expect(page).not_to have_selector("input#submission_access_level_restricted_liberal_arts") + end + end end context 'milsch authors cannot choose the access level', :milsch do diff --git a/spec/models/submission_spec.rb b/spec/models/submission_spec.rb index 9ad08b9d4..c67ba319c 100755 --- a/spec/models/submission_spec.rb +++ b/spec/models/submission_spec.rb @@ -184,7 +184,7 @@ access_level: 'restricted_liberal_arts' end - it 'returns submissions that are ready for autorelease' do + it 'returns submissions that need a release warning' do expect(described_class.release_warning_needed?).to contain_exactly(sub1, sub5) end end From cc5b76b4388661bbfd009471277319db687d2143 Mon Sep 17 00:00:00 2001 From: Smulligan Date: Tue, 20 Jan 2026 09:13:15 -0500 Subject: [PATCH 8/9] move logic to consolidate restricted liberal arts and restricted to institution facets to solr indexing --- app/models/solr_submission.rb | 6 +++++- spec/models/solr_submission_spec.rb | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/models/solr_submission.rb b/app/models/solr_submission.rb index 71634f936..b3ac78e12 100644 --- a/app/models/solr_submission.rb +++ b/app/models/solr_submission.rb @@ -39,7 +39,7 @@ def field_semantics keyword_list: ['keyword_ssim', 'keyword_tesim'], title: ['title_ssi', 'title_tesi'], id: ['db_id'], - access_level: 'access_level_ss', + adjusted_access_level: 'access_level_ss', semester: 'semester_ssi', abstract: 'abstract_tesi', defended_at_dtsi: 'defended_at_dtsi', @@ -92,6 +92,10 @@ def committee_member_names names end + def adjusted_access_level + access_level=='restricted_liberal_arts' ? 'restricted_to_institution' : access_level + end + def author_name_tesi "#{author.last_name}, #{author.first_name} #{author.middle_name}" end diff --git a/spec/models/solr_submission_spec.rb b/spec/models/solr_submission_spec.rb index 6061810a8..fec2d6de7 100644 --- a/spec/models/solr_submission_spec.rb +++ b/spec/models/solr_submission_spec.rb @@ -17,6 +17,8 @@ final_submission_files_uploaded_at: DateTime.now, # Test that nil stays nil defended_at: nil, + # Test that restricted liberal arts maps to restricted to institution + access_level: 'restricted_liberal_arts', program_id: program.id end let(:final_submission_file_1) { create :final_submission_file } @@ -26,6 +28,7 @@ let(:committee_member_2) { create :committee_member } let(:program) { create :program, name: 'Mechanical Engineering (DED)' } let(:program_name_condensed) { 'Mechanical Engineering' } + let(:converted_access_level) { 'restricted_to_institution' } it 'generates solr doc from submission attributes' do submission.committee_members << committee_member_1 @@ -36,7 +39,7 @@ submission.save expect(solr_submission.to_solr).to eq({ "abstract_tesi" => submission.abstract, - "access_level_ss" => submission.access_level, + "access_level_ss" => converted_access_level, "author_name_tesi" => "#{submission.author_last_name}, #{submission.author_first_name} #{submission.author_middle_name}", "committee_member_and_role_tesim" => ["#{committee_member_1.name}, #{committee_member_1.committee_role.name}", "#{committee_member_2.name}, #{committee_member_2.committee_role.name}"], From e19eb0a0893853740ba56bba2b40273611037fa2 Mon Sep 17 00:00:00 2001 From: Smulligan Date: Tue, 20 Jan 2026 10:07:30 -0500 Subject: [PATCH 9/9] niftany --- .rubocop.yml | 1 + app/models/solr_submission.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index ef75d6df9..b211470ed 100755 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -71,6 +71,7 @@ Metrics/ClassLength: - app/controllers/author/submissions_controller.rb - app/models/committee_member.rb - app/models/export_report.rb + - app/models/solr_submission.rb Metrics/CyclomaticComplexity: Exclude: diff --git a/app/models/solr_submission.rb b/app/models/solr_submission.rb index b3ac78e12..85affda8d 100644 --- a/app/models/solr_submission.rb +++ b/app/models/solr_submission.rb @@ -93,7 +93,7 @@ def committee_member_names end def adjusted_access_level - access_level=='restricted_liberal_arts' ? 'restricted_to_institution' : access_level + access_level == 'restricted_liberal_arts' ? 'restricted_to_institution' : access_level end def author_name_tesi