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

Ensure object being viewed is an archival object #2301

Merged
merged 1 commit into from Jun 15, 2021
Merged

Ensure object being viewed is an archival object #2301

merged 1 commit into from Jun 15, 2021

Conversation

andrew-morrison
Copy link
Contributor

@andrew-morrison andrew-morrison commented Jun 15, 2021

Description

This is a fix for a bug I introduced in #1831. I thought, because I was adding code inside this existing if statement...

<% if !@result.instance_of?(DigitalObject) || @has_children %>

...that I didn't need to test that the object being rendered is not a digital object. But, because we don't use digital object components where I work, I had forgotten that if those are present then @has_children is true. In which case, it will cause undefined method `resource_uri' errors.

It only occurs when AppConfig[:pui_search_collection_from_archival_objects] is set to true in config.rb (by default it is false) which is probably why it wasn't picked up in testing.

To fix this, I have added an extra check that the object is an archival object, thus ensuring @result.resource_uri is always defined.

Related JIRA Ticket or GitHub Issue

Fix for http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/2021-June/008532.html

How Has This Been Tested?

On a dev system.

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have read the CONTRIBUTING document.
  • I have authority to submit this code.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@lorawoodford lorawoodford self-requested a review June 15, 2021 19:24
@lorawoodford lorawoodford self-assigned this Jun 15, 2021
Copy link
Contributor

@lorawoodford lorawoodford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @andrew-morrison Looks good to go.

@lorawoodford lorawoodford merged commit 9363b0e into archivesspace:master Jun 15, 2021
@cdibella cdibella added this to the 3.1.0 milestone Aug 19, 2021
@cdibella cdibella added the community code contributed by community members not on or contracted by the ArchivesSpace program team label Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community code contributed by community members not on or contracted by the ArchivesSpace program team pui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants