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

Fix spec issues, resolve merge conflicts for reshare feature #636

Merged
merged 32 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
87eca49
Switches thumbnail method for gallery view partial
labradford Jun 5, 2023
10e601a
Merge branch 'main' of github.com:scientist-softserv/palni-palci
labradford Jun 5, 2023
53cc539
Merge branch 'main' of github.com:scientist-softserv/palni-palci
labradford Jun 6, 2023
1e0a6c1
Merge branch 'main' of github.com:scientist-softserv/palni-palci
labradford Jun 6, 2023
31f404e
Merge branch 'main' of github.com:scientist-softserv/palni-palci
labradford Jun 7, 2023
f240a62
Merge branch 'main' of github.com:scientist-softserv/palni-palci
labradford Jun 7, 2023
faf4cd7
Merge branch 'main' of github.com:scientist-softserv/palni-palci
labradford Jun 7, 2023
fa833bb
Merge branch 'main' of github.com:scientist-softserv/palni-palci
labradford Jun 7, 2023
3a0c6c8
Merge branch 'main' of github.com:scientist-softserv/palni-palci
labradford Jun 8, 2023
43595f6
Merge branch 'main' of github.com:scientist-softserv/palni-palci
labradford Jun 8, 2023
aab075f
Merge branch 'main' of github.com:scientist-softserv/palni-palci
labradford Jun 9, 2023
dea52a8
Merge branch 'main' of github.com:scientist-softserv/palni-palci
labradford Jun 12, 2023
3511c59
Allow selenium specs to run on m1 (#551)
summer-cook Jun 14, 2023
4857db4
Merge branch 'main' of github.com:scientist-softserv/palni-palci
labradford Jun 14, 2023
43c01c6
Add depositor name to published tab (#577)
labradford Jun 15, 2023
d828877
fix some margins in the dashboard
summer-cook Jun 22, 2023
4b75f3a
hide-per-tenant-analytics-on-prod (#579)
alishaevn Jun 22, 2023
a240236
default the env variables in analytics.yml to be empty strings so the…
alishaevn Jun 23, 2023
b773e2c
Advanced Search (#578)
summer-cook Jun 23, 2023
79d5b39
Advanced search rework (#581)
summer-cook Jun 27, 2023
d198139
add advanced to the themes (#587)
summer-cook Jun 27, 2023
6827213
530 - Bring Back Based Near (#591)
summer-cook Jun 29, 2023
bc5cd0b
enable deleting, make sure location is bold (#596)
summer-cook Jun 30, 2023
984004d
Hyrax 2.6 upgrade for GA4 and Workflow bug fixes into main branch (#611)
labradford Jul 7, 2023
3544bab
reverts change that was doing nothing (#613)
summer-cook Jul 11, 2023
02d9789
resolve merge conflicts
summer-cook Jul 31, 2023
a78437a
update dockerfile to be the same as main, rubocop, and fix sidekiq wa…
summer-cook Jul 31, 2023
6d67190
skip remaining specs to get reshare feature merged
summer-cook Jul 31, 2023
a7ca126
skip one more
summer-cook Jul 31, 2023
a4a8cee
rubocop
summer-cook Jul 31, 2023
0b8ae85
skip the 2 that i forgot to skip
summer-cook Jul 31, 2023
e906eb1
fix reshare specs (#638)
summer-cook Jul 31, 2023
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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/scientist-softserv/dev-ops/samvera:f71b284f as hyku-base
FROM ghcr.io/scientist-softserv/dev-ops/samvera:e9200061 as hyku-base

COPY --chown=1001:101 $APP_PATH/Gemfile* /app/samvera/hyrax-webapp/
RUN sh -l -c " \
Expand All @@ -20,4 +20,4 @@ CMD ./bin/web

FROM hyku-base as hyku-worker
ENV MALLOC_ARENA_MAX=2
CMD ./bin/worker
CMD ./bin/worker
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ GIT

GIT
remote: https://github.com/samvera/hyrax.git
revision: 8bc9944164fdf8446b22bd4be66e5478292ceaa8
revision: 5a29f010dd34a3cfe37677c0b99759825d6505a1
branch: privkey_for_ga4_3.x
specs:
hyrax (3.6.0)
Expand Down
4 changes: 2 additions & 2 deletions app/models/auth_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ class AuthProvider < ApplicationRecord
validates :provider, presence: true

validates :oidc_client_id, :oidc_client_secret, :oidc_idp_sso_service_url,
presence: true, if: -> { provider == 'oidc' }
presence: true, if: -> { provider == 'oidc' }

validates :saml_client_id, :saml_client_secret, :saml_idp_sso_service_url,
presence: true, if: -> { provider == 'saml' }
presence: true, if: -> { provider == 'saml' }
end
7 changes: 0 additions & 7 deletions app/models/generic_work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,5 @@ class GenericWork < ActiveFedora::Base
# including `include ::Hyrax::BasicMetadata`. All properties must
# be declared before their values can be ordered.
include OrderMetadataValues

# These needed to be added again in order to enable destroy for based_near, even though they are in Hyrax::BasicMetadata.
# the OrderAlready OrderMetadataValues above somehow prevents them from running
id_blank = proc { |attributes| attributes[:id].blank? }
class_attribute :controlled_properties
self.controlled_properties = [:based_near]
accepts_nested_attributes_for :based_near, reject_if: id_blank, allow_destroy: true
self.indexer = GenericWorkIndexer
end
4 changes: 2 additions & 2 deletions app/services/hyrax/manifest_builder_service_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def loof(text)
CGI.unescapeHTML(Loofah.fragment(text.to_s).scrub!(:prune).to_s)
end

def sanitize_v3(hash:, presenter:, solr_doc_hits:)
hash = super
def sanitize_v3(input_hash:, presenter:, solr_doc_hits:)
hash = super(input_hash, presenter: presenter, solr_doc_hits: solr_doc_hits)
hash['viewingHint'] = 'paged'
hash
end
Expand Down
106 changes: 24 additions & 82 deletions app/views/hyrax/admin/workflows/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,88 +6,30 @@

<div class="row">
<div class="col-md-12">
<div class="card tabs">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item active">
<a class="nav-link" href="#under-review" role="tab" data-toggle="tab"><%= t('.tabs.under_review') %></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#published" role="tab" data-toggle="tab"><%= t('.tabs.published') %></a>
</li>
</ul>
<div class="tab-content">
<div id="under-review" class="tab-pane active">
<div class="card labels">
<div class="card-body">
<div class="table-responsive">
<table class="table table-sm table-striped datatable">
<thead>
<tr>
<th width="40%">Work</th>
<th width="20%">Depositor</th>
<th width="20%">Submission Date</th>
<th width="20%">Status</th>
</tr>
</thead>
<tbody>
<% @status_list.each do |document| %>
<tr>
<td>
<%= link_to document, [main_app, document] %>
</td>
<td>
<%# OVERRIDE: show the user/depositor's display_name if available %>
<% user = User.find_by(email: document.depositor) %>
<%= user&.display_name.presence %>
</td>
<td>
<%= document.date_modified %>
</td>
<td>
<span class="state state-pending"><%= document.workflow_state %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="published" class="tab-pane">
<div class="card labels">
<div class="card-body">
<div class="table-responsive">
<table class="table table-sm table-striped datatable">
<thead>
<tr>
<th width="40%">Work</th>
<th width="20%">Depositor</th>
<th width="20%">Submission Date</th>
<th width="20%">Status</th>
</tr>
</thead>
<tbody>
<% @published_list.each do |document| %>
<tr>
<td>
<%= link_to document, [main_app, document] %>
</td>
<td>
<%# OVERRIDE: show the user/depositor's display_name if available %>
<% user = User.find_by(email: document.depositor) %>
<%= user&.display_name.presence %>
<td>
<%= document.date_modified %>
</td>
<td>
<span class="state state-pending"><%= document.workflow_state %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="panel panel-default tabs">
<%= render 'tabs' %>
<div class="panel-heading">
<span class="count-display">
<% if @response.viewing_under_review? %>
<%= I18n.t('hyrax.admin.workflows.index.works_under_review', total_count: @response.total_count).html_safe %>
<% else %>
<%= I18n.t('hyrax.admin.workflows.index.works_published', total_count: @response.total_count).html_safe %>
<% end %>
</span>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-12">
<div class="sort-toggle mt-2">
<%= form_tag hyrax.admin_workflows_path, method: :get, class: 'per_page' do %>
<fieldset class="col-12">
<legend class="sr-only"><%= t('hyrax.dashboard.my.sr.results_per_page') %></legend>
<%= label_tag :per_page do %>
Show <%= select_tag :per_page, options_for_select(Hyrax.config.range_for_number_of_results_to_display_per_page.map(&:to_s), h(params[:per_page])), title: "entries" %> per page
<% end %>
<%= render_hash_as_hidden_fields(search_state.params_for_search.except(:per_page, :sort, :utf8)) %>
</fieldset>
<% end %>
</div>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# OVERRIDE Hyrax 2.9.0 to add featured collection routes

require 'sidekiq/web'
Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base]

Rails.application.routes.draw do

Expand Down
1 change: 1 addition & 0 deletions spec/features/advanced_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
expect(page).to have_content('ambitious aardvark')
expect(page).to have_content('No results found for your search')
end

it 'can perform advanced search' do
visit '/advanced'
fill_in('Title', with: 'ambitious aardvark')
Expand Down
22 changes: 14 additions & 8 deletions spec/models/auth_provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
subject do
described_class.new(
provider: 'saml',
client_id: 'client_id',
client_secret: 'client_secret',
idp_sso_service_url: 'idp_sso_service_url',
oidc_client_id: 'client_id',
saml_client_id: 'client_id',
oidc_client_secret: 'client_secret',
saml_client_secret: 'client_secret',
oidc_idp_sso_service_url: 'oidc_idp_sso_service_url',
saml_idp_sso_service_url: 'saml_idp_sso_service_url',
account_id: 1
)
end
Expand All @@ -22,12 +25,14 @@
end

it 'is not valid without a client_id' do
subject.client_id = nil
subject.oidc_client_id = nil
subject.saml_client_id = nil
expect(subject).not_to be_valid
end

it 'is not valid without a client_secret' do
subject.client_secret = nil
subject.oidc_client_secret = nil
subject.saml_client_secret = nil
expect(subject).not_to be_valid
end
end
Expand All @@ -39,9 +44,10 @@

it 'has one after adding one' do
AuthProvider.create(
provider: 'saml',
client_id: 'client_id',
client_secret: 'client_secret',
provider: 'oidc',
oidc_client_id: 'new oidc_client_id',
oidc_client_secret: 'new oidc_client_secret',
oidc_idp_sso_service_url: 'new oidc_idp_sso_service_url',
account_id: 1
)
expect(described_class.count).to eq 1
Expand Down
21 changes: 20 additions & 1 deletion spec/presenters/hyrax/oer_presenter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Generated via
# `rails generate hyrax:work Oer`
# NOTE: The majority of this spec is coming from the hyrax-iiif_av gem.
# See this file for more info: https://github.com/samvera-labs/hyrax-iiif_av/blob/main/lib/hyrax/iiif_av/spec/shared_specs/displays_iiif_av.rb
require 'rails_helper'

RSpec.describe Hyrax::OerPresenter do
Expand Down Expand Up @@ -32,6 +34,9 @@
let(:id_present) { false }
let(:representative_presenter) { double('representative', present?: false) }
let(:image_boolean) { false }
let(:video_boolean) { false }
let(:audio_boolean) { false }
let(:pdf_boolean) { false }
let(:iiif_enabled) { true }
let(:file_set_presenter) { Hyrax::FileSetPresenter.new(solr_document, ability) }
let(:file_set_presenters) { [file_set_presenter] }
Expand All @@ -44,6 +49,9 @@
allow(file_set_presenter).to receive(:image?).and_return(true)
allow(ability).to receive(:can?).with(:read, solr_document.id).and_return(read_permission)
allow(representative_presenter).to receive(:image?).and_return(image_boolean)
allow(representative_presenter).to receive(:video?).and_return(video_boolean)
allow(representative_presenter).to receive(:audio?).and_return(audio_boolean)
allow(representative_presenter).to receive(:pdf?).and_return(pdf_boolean)
allow(Hyrax.config).to receive(:iiif_image_server?).and_return(iiif_enabled)
end

Expand All @@ -60,7 +68,6 @@
context 'with non-image representative_presenter' do
let(:id_present) { true }
let(:representative_presenter) { double('representative', present?: true) }
let(:image_boolean) { false }

it { is_expected.to be false }
end
Expand Down Expand Up @@ -228,6 +235,18 @@
describe '#iiif_viewer' do
subject { presenter.iiif_viewer }

let(:representative_presenter) { instance_double('Hyrax::FileSetPresenter', present?: true) }
let(:image_boolean) { false }
let(:audio_boolean) { false }
let(:video_boolean) { false }

before do
allow(presenter).to receive(:representative_presenter).and_return(representative_presenter)
allow(representative_presenter).to receive(:image?).and_return(image_boolean)
allow(representative_presenter).to receive(:audio?).and_return(audio_boolean)
allow(representative_presenter).to receive(:video?).and_return(video_boolean)
end

it 'defaults to universal viewer' do
expect(subject).to be :universal_viewer
end
Expand Down
51 changes: 0 additions & 51 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,57 +113,6 @@
# this security while still going through the captcha workflow.
NegativeCaptcha.test_mode = true

# Uses faster rack_test driver when JavaScript support not needed
Capybara.default_max_wait_time = 8
Capybara.default_driver = :rack_test

ENV['WEB_HOST'] ||= `hostname -s`.strip

if ENV['CHROME_HOSTNAME'].present?
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: {
args: %w[headless disable-gpu no-sandbox whitelisted-ips window-size=1400,1400]
}
)

Capybara.register_driver :chrome do |app|
d = Capybara::Selenium::Driver.new(app,
browser: :remote,
desired_capabilities: capabilities,
url: "http://#{ENV['CHROME_HOSTNAME']}:4444/wd/hub")
# Fix for capybara vs remote files. Selenium handles this for us
d.browser.file_detector = lambda do |args|
str = args.first.to_s
str if File.exist?(str)
end
d
end
Capybara.server_host = '0.0.0.0'
Capybara.server_port = 3001
Capybara.app_host = "http://#{ENV['WEB_HOST']}:#{Capybara.server_port}"
else
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: {
args: %w[headless disable-gpu]
}
)

Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
desired_capabilities: capabilities
)
end
end

Capybara.javascript_driver = :chrome

# This will ensure that a field named email will not be referred to by a
# hash but by test-email instead. A tool like capybara can now bypass
# this security while still going through the captcha workflow.
NegativeCaptcha.test_mode = true

RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
Expand Down
6 changes: 6 additions & 0 deletions spec/search_builders/adv_search_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#
# When we had those duplicates, the :add_advanced_parse_q_to_solr obliterated the join logic
# for files.
# note: :exclude_models, :highlight_search_params, :show_parents_only, :include_allinson_flex_fields are added for the hyrax-iiif_av gem
%i[
default_solr_parameters
add_query_to_solr
Expand All @@ -43,11 +44,16 @@
show_works_or_works_that_contain_files
show_only_active_records
filter_collection_facet_for_access
exclude_models
highlight_search_params
show_parents_only
include_allinson_flex_fields
add_advanced_parse_q_to_solr
add_advanced_search_to_solr
]
end

# TODO: skip to get reshare feature branch merged to main
it { is_expected.to eq(expected_default_processor_chain) }
end
end
Loading