Skip to content

Commit

Permalink
SYS-1637: Remove master file URLs from OAI feed (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
akohler authored Jun 12, 2024
1 parent 29cd809 commit 875bfd0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion charts/prod-ohstaff-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replicaCount: 1

image:
repository: uclalibrary/oral-history-staff-ui
tag: v1.1.10
tag: v1.1.11
pullPolicy: Always

nameOverride: ""
Expand Down
9 changes: 6 additions & 3 deletions oh_staff_ui/classes/OralHistoryMods.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ def _create_relateditem_audio(self, mi: MediaFile) -> MODSv34:
for ts in MediaFile.objects.filter(
item=pi, file_type__file_code="text_master_transcript"
):
if ts.file_url != "" and ts.file_url.endswith(".xml"):
# Add only for submasters, the public-access copy
if ts.file_url.endswith("submaster.xml"):
# Due to legacy design the text_master_transcript can have 2 file types
# associated with it, we only want to show xml (TEI), and ignore html files
ri.locations.append(LocationOH(url=ts.file_url, usage="timed log"))
Expand Down Expand Up @@ -208,7 +209,8 @@ def _populate_interview_content(self):
for f in MediaFile.objects.filter(
item=self._item, file_type__file_code__in=fc_to_label.keys()
).order_by("sequence"):
if f.file_url != "":
# Add only for submasters, the public-access copy
if "submaster" in f.file_url:
label = fc_to_label[f.file_type.file_code]
usage = ""

Expand All @@ -219,7 +221,8 @@ def _populate_interview_content(self):
label = f"{label} (TEI/P5 XML)"
usage = "timed log"

# If our MediaFile is TEI/P5 XML, a usage attribute is populated and should be included
# If our MediaFile is TEI/P5 XML, a usage attribute is populated
# and should be included
if usage:
self.locations.append(
LocationOH(url=f.file_url, label=label, usage=usage)
Expand Down
8 changes: 7 additions & 1 deletion oh_staff_ui/templates/oh_staff_ui/release_notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
{% block content %}
<h3>Release Notes</h3>
<hr/>
<h4>1.1.11</h4>
<p><i>June 12, 2024</i></p>
<ul>
<li>Fixed bug which included master file URLs in the OAI feed.</li>
</ul>

<h4>1.1.10</h4>
<p><i>June 6, 2024</i></p>
<ul>
<li>Fix alignment of item metadata form fields.</li>
<li>Fixed alignment of item metadata form fields.</li>
</ul>

<h4>1.1.9</h4>
Expand Down
6 changes: 6 additions & 0 deletions oh_staff_ui/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,12 @@ def test_sealed_audio_metadata_is_excluded(self):
# That title should not be present, since that item has been Sealed.
self.assertNotIn("Fake audio", related_titles)

def test_master_file_urls_are_excluded(self):
# Confirm that master file URLs, which are only used in the staff UI,
# are not included in the OAI feed.
ohmods = self.get_mods_from_interview_item()
self.assertFalse(b"/oh_masters/" in ohmods.serializeDocument())


class FileMetadataMigrationTestCase(SimpleTestCase):
# Test logic not already covered by OralHistoryFile tests.
Expand Down

0 comments on commit 875bfd0

Please sign in to comment.