Skip to content

Commit

Permalink
fix rubocop errors and fix per tenant redis caching
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf committed May 6, 2024
1 parent e91327f commit b972749
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def setup_tenant_cache(is_enabled)
ActionController::Base.perform_caching = is_enabled
# rubocop:disable Style/ConditionalAssignment
if is_enabled
Rails.application.config.cache_store = :redis_cache_store, { url: Redis.current.id }
Rails.application.config.cache_store = :redis_cache_store, { redis: Hyrax::RedisEventStore.instance }
else
Rails.application.config.cache_store = :file_store, ENV.fetch('HYKU_CACHE_ROOT', '/app/samvera/file_cache')
end
Expand Down
66 changes: 33 additions & 33 deletions app/presenters/hyrax/iiif_manifest_presenter_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,49 +88,49 @@ def supplementing_content

private

TRANSCRIPT_RDF_TYPE = "http://pcdm.org/use#Transcript"
TRANSCRIPT_RDF_TYPE = "http://pcdm.org/use#Transcript"

def media_and_transcript?
(audio? || video?) && transcript_attachments.present?
end
def media_and_transcript?
(audio? || video?) && transcript_attachments.present?
end

def transcript_attachments
parent = ::FileSet.find(id).parent.member_of.first
return [] unless parent
def transcript_attachments
parent = ::FileSet.find(id).parent.member_of.first
return [] unless parent

parent.members.select { |member| member.rdf_type == [TRANSCRIPT_RDF_TYPE] }
end
parent.members.select { |member| member.rdf_type == [TRANSCRIPT_RDF_TYPE] }
end

def create_supplementing_content(attachment)
hash = get_file_set_ids_and_languages(attachment)
captions_url = get_captions_url(hash[:file_set_id])
IIIFManifest::V3::SupplementingContent.new(captions_url,
type: 'Text',
format: 'text/vtt',
label: hash[:title],
language: hash[:language].first || 'en')
end
def create_supplementing_content(attachment)
hash = get_file_set_ids_and_languages(attachment)
captions_url = get_captions_url(hash[:file_set_id])
IIIFManifest::V3::SupplementingContent.new(captions_url,
type: 'Text',
format: 'text/vtt',
label: hash[:title],
language: hash[:language].first || 'en')
end

def get_file_set_ids_and_languages(attachment)
{
file_set_id: attachment.file_sets.first.id,
title: attachment.title.first,
language: attachment.file_language
}
end
def get_file_set_ids_and_languages(attachment)
{
file_set_id: attachment.file_sets.first.id,
title: attachment.title.first,
language: attachment.file_language
}
end

def get_captions_url(file_set_id)
captions_url = Hyrax::Engine.routes.url_helpers.download_url(file_set_id, host: hostname)
ssl_configured = Site.account.ssl_configured
ssl_configured ? captions_url.sub!(/\Ahttp:/, 'https:') : captions_url
end
def get_captions_url(file_set_id)
captions_url = Hyrax::Engine.routes.url_helpers.download_url(file_set_id, host: hostname)
ssl_configured = Site.account.ssl_configured
ssl_configured ? captions_url.sub!(/\Ahttp:/, 'https:') : captions_url
end
end

private

def scrub(value)
CGI.unescapeHTML(Loofah.fragment(value).scrub!(:whitewash).to_s)
end
def scrub(value)
CGI.unescapeHTML(Loofah.fragment(value).scrub!(:whitewash).to_s)
end
end
end

Expand Down

0 comments on commit b972749

Please sign in to comment.