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

Allow tenant configuration to ignore showing PDFs in universal viewer #659

Closed
Tracked by #656
jeremyf opened this issue Aug 8, 2023 · 3 comments · Fixed by #675
Closed
Tracked by #656

Allow tenant configuration to ignore showing PDFs in universal viewer #659

jeremyf opened this issue Aug 8, 2023 · 3 comments · Fixed by #675
Assignees
Labels
Needs Rework ReShare https://docs.google.com/document/d/1vcA7NNNHuQMn6ocg2LvSNQpcXGzua3cEGyswKQvjEIc/edit#

Comments

@jeremyf
Copy link
Contributor

jeremyf commented Aug 8, 2023

Summary

We want a feature flipper that turns on and off the PDF processing for iiif print. This means a tenant can decide if they want PDFs showing in the viewer or not.

Testing instructions

Create a PDF work. Go view it to see that it creates with a thumbnail.
Go to the Settings, Features, and toggle the use iiif print feature.
Upload a PDF and allow it to process.
View the work and confirm you can see the PDF in the viewer.

Notes

There should be one single flipflop feature for the following tickets:

Testing Instructions can be found here:

The three tickets can all be tested in one swoop.

@jeremyf jeremyf assigned jeremyf and unassigned jeremyf Aug 8, 2023
jeremyf added a commit that referenced this issue Aug 10, 2023
The current (as of <2023-08-10 Thu>) implementation of IIIF Print
assumes that we generate derivatives at the application level.  However,
we want options for generating at the tenant level.

As noted, I have chosen to default using IIIF print to `true` because
that was the behavior before this commit.

In other words, this commit is functionally a non-change to
the production code-base (assuming no one goes and flips some switches).

Related to:

- #656
- #657
- #658
- #659
@crisr15
Copy link
Contributor

crisr15 commented Aug 11, 2023

This fails SoftServ QA:

Screenshot:

Image

jeremyf added a commit that referenced this issue Aug 11, 2023
There is a conflict between the `IiifPrint` and `Hyrax::IiifAv` gems;
namely they both have strong opinions about how to sniff out if we
should use the `iiif_viewer?`.  Compounding this, is that IiifPrint
decorates `Hyrax::WorkShowPresenter` and Hyku extends
`Hyrax::WorkShowPresenter` then includes
`Hyrax::IiifAv::DisplaysIiifAv`.

The end result is that the logic to determine if we should show pages
split from the PDF is never called.  Yet, if we were to solely use
IiifPrint we'd ignore rendering audio and vidoe in the iiif viewer.

So this commit peels that back so that we're using the logic (brought
forward by IiifPrint) but ensuring our Hyku presenters are using that
logic.

Why move the logic out of the Hyku instance and into a module?  Because
that module contains the per-tenant antics of IiifPrint and its PDF
relationship.

There is larger work to do in regards to incorporating this logic into
IiifPrint and the Hyrax::IiifAv gem.

Does this work?  Please pull down a branch and check.  I'm at the end of
my day (and then some).

Related to:

- #659
@crisr15 crisr15 added the ReShare https://docs.google.com/document/d/1vcA7NNNHuQMn6ocg2LvSNQpcXGzua3cEGyswKQvjEIc/edit# label Aug 14, 2023
jeremyf added a commit that referenced this issue Aug 15, 2023
There is a conflict between the `IiifPrint` and `Hyrax::IiifAv` gems;
namely they both have strong opinions about how to sniff out if we
should use the `iiif_viewer?`.  Compounding this, is that IiifPrint
decorates `Hyrax::WorkShowPresenter` and Hyku extends
`Hyrax::WorkShowPresenter` then includes
`Hyrax::IiifAv::DisplaysIiifAv`.

The end result is that the logic to determine if we should show pages
split from the PDF is never called.  Yet, if we were to solely use
IiifPrint we'd ignore rendering audio and vidoe in the iiif viewer.

So this commit peels that back so that we're using the logic (brought
forward by IiifPrint) but ensuring our Hyku presenters are using that
logic.

Why move the logic out of the Hyku instance and into a module?  Because
that module contains the per-tenant antics of IiifPrint and its PDF
relationship.

There is larger work to do in regards to incorporating this logic into
IiifPrint and the Hyrax::IiifAv gem.

Does this work?  Please pull down a branch and check.  I'm at the end of
my day (and then some).

Related to:

- #659
jeremyf added a commit that referenced this issue Aug 15, 2023
There is a conflict between the `IiifPrint` and `Hyrax::IiifAv` gems;
namely they both have strong opinions about how to sniff out if we
should use the `iiif_viewer?`.  Compounding this, is that IiifPrint
decorates `Hyrax::WorkShowPresenter` and Hyku extends
`Hyrax::WorkShowPresenter` then includes
`Hyrax::IiifAv::DisplaysIiifAv`.

The end result is that the logic to determine if we should show pages
split from the PDF is never called.  Yet, if we were to solely use
IiifPrint we'd ignore rendering audio and vidoe in the iiif viewer.

So this commit peels that back so that we're using the logic (brought
forward by IiifPrint) but ensuring our Hyku presenters are using that
logic.

Why move the logic out of the Hyku instance and into a module?  Because
that module contains the per-tenant antics of IiifPrint and its PDF
relationship.

There is larger work to do in regards to incorporating this logic into
IiifPrint and the Hyrax::IiifAv gem.

Does this work?  Please pull down a branch and check.  I'm at the end of
my day (and then some).

Related to:

- #659
jeremyf added a commit that referenced this issue Aug 15, 2023
There is a conflict between the `IiifPrint` and `Hyrax::IiifAv` gems;
namely they both have strong opinions about how to sniff out if we
should use the `iiif_viewer?`.  Compounding this, is that IiifPrint
decorates `Hyrax::WorkShowPresenter` and Hyku extends
`Hyrax::WorkShowPresenter` then includes
`Hyrax::IiifAv::DisplaysIiifAv`.

The end result is that the logic to determine if we should show pages
split from the PDF is never called.  Yet, if we were to solely use
IiifPrint we'd ignore rendering audio and vidoe in the iiif viewer.

So this commit peels that back so that we're using the logic (brought
forward by IiifPrint) but ensuring our Hyku presenters are using that
logic.

Why move the logic out of the Hyku instance and into a module?  Because
that module contains the per-tenant antics of IiifPrint and its PDF
relationship.

There is larger work to do in regards to incorporating this logic into
IiifPrint and the Hyrax::IiifAv gem.

Does this work?  Please pull down a branch and check.  I'm at the end of
my day (and then some).

Related to:

- #659
@jeremyf jeremyf linked a pull request Aug 15, 2023 that will close this issue
@crisr15
Copy link
Contributor

crisr15 commented Aug 16, 2023

Passes internal QA. Viewer does not show on works that do not have processed files.

Image

@jeremyf
Copy link
Contributor Author

jeremyf commented Aug 17, 2023

Here's a thread reporting that this has been returned to SoftServ for further fixes: https://assaydepot.slack.com/archives/C0313NKC08L/p1692255870043969

Looking at the logs I'm seeing:

F, [2023-08-17T15:35:26.309458 #1] FATAL -- : [a0b4305bc8cff4fdb06cd6a1ffc94499] ActionView::Template::Error (private method `solr_document' called for #<Hyrax::IiifAv::IiifFileSetPresenter:0x00007f34682eab00>
Did you mean?  solr_document=):
F, [2023-08-17T15:35:26.309569 #1] FATAL -- : [a0b4305bc8cff4fdb06cd6a1ffc94499]     1: <%# Overridden from Hyrax 3.5.0 - To add extra download restrictions %>
[a0b4305bc8cff4fdb06cd6a1ffc94499]     2: <% if display_media_download_link?(file_set: file_set) && (Site.account.settings[:allow_downloads].nil? || Site.account.settings[:allow_downloads].to_i.nonzero?) %>
[a0b4305bc8cff4fdb06cd6a1ffc94499]     3:   <div>
[a0b4305bc8cff4fdb06cd6a1ffc94499]     4:       <h2 class="sr-only"><%= t('hyrax.file_set.show.downloadable_content.heading') %></h2>
[a0b4305bc8cff4fdb06cd6a1ffc94499]     5:       <%= image_tag thumbnail_url(file_set),
F, [2023-08-17T15:35:26.309598 #1] FATAL -- : [a0b4305bc8cff4fdb06cd6a1ffc94499]   
F, [2023-08-17T15:35:26.309625 #1] FATAL -- : [a0b4305bc8cff4fdb06cd6a1ffc94499] app/helpers/hyrax/file_set_helper.rb:16:in 

And here's the exception : https://scientist-inc.sentry.io/issues/4368889816/?environment=production&project=6707374&referrer=project-issue-stream

jeremyf added a commit that referenced this issue Aug 17, 2023
Prior to this commit, we had a private `#solr_document` method.  This
resulted in an error in the `Hyrax::Ability` as follows:

```
NoMethodError
private method `solr_document' called for #<Hyrax::IiifAv::IiifFileSetPresenter:0x00007ff118124808>
Did you mean?  solr_document=
```

With this commit, I'm making public two methods that might cause issues
being private.  (And adding a test verifying the interface)

Oh dear reviewer, were that I were able to duplicate the bug locally.  I
tried toggling on and off the feature flag.  I also tried toggling the
allow downloads.  But to no avail.  Alas, I cannot replicate but must
instead rely on addressing the specific error.

Related to:

- #659
- https://scientist-inc.sentry.io/issues/4368889816/?environment=production&project=6707374&referrer=project-issue-stream
@jeremyf jeremyf moved this from PALs QA to Code Review in palni-palci Aug 17, 2023
jeremyf added a commit that referenced this issue Aug 17, 2023
Prior to this commit, we had a private `#solr_document` method.  This
resulted in an error in the `Hyrax::Ability` as follows:

```
NoMethodError
private method `solr_document' called for #<Hyrax::IiifAv::IiifFileSetPresenter:0x00007ff118124808>
Did you mean?  solr_document=
```

With this commit, I'm making public two methods that might cause issues
being private.  (And adding a test verifying the interface)

Oh dear reviewer, were that I were able to duplicate the bug locally.  I
tried toggling on and off the feature flag.  I also tried toggling the
allow downloads.  But to no avail.  Alas, I cannot replicate but must
instead rely on addressing the specific error.

Related to:

- #659
- https://scientist-inc.sentry.io/issues/4368889816/?environment=production&project=6707374&referrer=project-issue-stream
@jeremyf jeremyf moved this from Code Review to Deploy to Staging in palni-palci Aug 17, 2023
@labradford labradford moved this from Deploy to Staging to SoftServ QA in palni-palci Aug 17, 2023
@labradford labradford moved this from SoftServ QA to Client Verification in palni-palci Aug 17, 2023
@ndroark ndroark moved this from Client Verification to Done in palni-palci Aug 24, 2023
jeremyf added a commit to samvera/hyku that referenced this issue Dec 15, 2023
The current (as of <2023-08-10 Thu>) implementation of IIIF Print
assumes that we generate derivatives at the application level.  However,
we want options for generating at the tenant level.

As noted, I have chosen to default using IIIF print to `true` because
that was the behavior before this commit.

In other words, this commit is functionally a non-change to
the production code-base (assuming no one goes and flips some switches).

Related to:

- scientist-softserv/palni-palci#656
- scientist-softserv/palni-palci#657
- scientist-softserv/palni-palci#658
- scientist-softserv/palni-palci#659
jeremyf added a commit to samvera/hyku that referenced this issue Dec 18, 2023
From scientist-softserv/palni-palci#675

> 🐛 Ensure consistent logic path for when iiif viewer
>
> There is a conflict between the `IiifPrint` and `Hyrax::IiifAv` gems;
> namely they both have strong opinions about how to sniff out if we
> should use the `iiif_viewer?`.  Compounding this, is that IiifPrint
> decorates `Hyrax::WorkShowPresenter` and Hyku extends
> `Hyrax::WorkShowPresenter` then includes
> `Hyrax::IiifAv::DisplaysIiifAv`.
>
> The end result is that the logic to determine if we should show pages
> split from the PDF is never called.  Yet, if we were to solely use
> IiifPrint we'd ignore rendering audio and vidoe in the iiif viewer.
>
> So this commit peels that back so that we're using the logic (brought
> forward by IiifPrint) but ensuring our Hyku presenters are using that
> logic.
>
> Why move the logic out of the Hyku instance and into a module?  Because
> that module contains the per-tenant antics of IiifPrint and its PDF
> relationship.
>
> There is larger work to do in regards to incorporating this logic into
> IiifPrint and the Hyrax::IiifAv gem.
>
> Does this work?  Please pull down a branch and check.  I'm at the end of
> my day (and then some).
>
> Related to:
>
> - scientist-softserv/palni-palci#659

Related to:
- scientist-softserv/palni-palci#659
- scientist-softserv/palni-palci#675
@jeremyf jeremyf closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Rework ReShare https://docs.google.com/document/d/1vcA7NNNHuQMn6ocg2LvSNQpcXGzua3cEGyswKQvjEIc/edit#
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants