Skip to content

Commit ab2c5ab

Browse files
committed
replace last references to original-media-id (with derivative-of-media-ids & replaces-media-id)
1 parent fef509a commit ab2c5ab

5 files changed

Lines changed: 21 additions & 13 deletions

File tree

common-lib/src/main/scala/com/gu/mediaservice/lib/config/CommonConfigWithElastic.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.gu.mediaservice.lib.config
22

3+
import com.gu.mediaservice.lib.ImageStorageProps
34
import com.gu.mediaservice.lib.elasticsearch.{ElasticSearchAliases, ElasticSearchConfig}
45

56
class CommonConfigWithElastic(resources: GridConfigResources) extends CommonConfig(resources) {
@@ -15,7 +16,10 @@ class CommonConfigWithElastic(resources: GridConfigResources) extends CommonConf
1516
)
1617

1718
val persistenceIdentifier = string("persistence.identifier")
18-
val queriableIdentifiers = Seq(persistenceIdentifier)
19+
val queriableIdentifiers = Seq(
20+
persistenceIdentifier,
21+
ImageStorageProps.derivativeOfMediaIdsIdentifierKey,
22+
)
1923

2024
// note this will match any part of the collection path, e.g. "bar" will match "bar", "foo/bar", "bar/baz"
2125
val maybePersistOnlyTheseCollections: Option[Set[String]] = getOptionalStringSet("persistence.onlyTheseCollections")

kahuna/public/js/components/gr-image-metadata/gr-image-metadata.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -766,10 +766,14 @@
766766
<dl ng-repeat="(key, value) in ctrl.identifiers" class="metadata__body image-info__group--dl">
767767
<dt class="metadata-line__key image-info__group--dl__key--full-metadata">{{key | spaceWords}}</dt>
768768
<dd class="metadata-line__info image-info__group--dl__value--full-metadata">
769-
<a ng-if="ctrl.isSearchableIdentifier(key)"
770-
ui-sref="search.results({query: value, nonFree: true})"
771-
aria-label="Search for images with '{{value}}'">{{value}}</a>
772-
<span ng-if="!ctrl.isSearchableIdentifier(key)">{{value}}</span>
769+
<span ng-if="ctrl.isSearchableIdentifier(key)">
770+
<a ng-repeat="id in value.split(','))"
771+
ui-sref="search.results({query: id.trim(), nonFree: true})"
772+
aria-label="Search for images with '{{id.trim()}}'">{{id.trim()}}<br/></a>
773+
</span>
774+
<span ng-if="!ctrl.isSearchableIdentifier(key)">
775+
<a ui-sref="key === 'replaces-media-id' ? image({imageId: value}) : ''">{{value}}</a>
776+
</span>
773777
</dd>
774778
</dl>
775779
</div>

kahuna/public/js/components/gr-image-metadata/gr-image-metadata.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export const module = angular.module('gr.imageMetadata', [
2424
'gr.usageRightsSummary'
2525
]);
2626

27+
const SEARCHABLE_IDENTIFIERS = ["derivative-of-media-ids"];
28+
2729
module.controller('grImageMetadataCtrl', [
2830
'$rootScope',
2931
'$scope',
@@ -421,7 +423,7 @@ module.controller('grImageMetadataCtrl', [
421423

422424
ctrl.isUsefulMetadata = isUsefulMetadata;
423425

424-
ctrl.isSearchableIdentifier = (identifier) => ["original-media-id"].includes(identifier);
426+
ctrl.isSearchableIdentifier = (identifier) => SEARCHABLE_IDENTIFIERS.includes(identifier);
425427

426428
function hasLocationInformation() {
427429
return ctrl.metadata && (

kahuna/public/js/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ kahuna.filter('getInitials', function() {
443443
kahuna.filter('spaceWords', () => str => {
444444
switch (str) {
445445
case 'picdarurn': return 'Picdar URN';
446-
case 'original-media-id': return 'Original Media ID';
446+
case 'derivative-of-media-ids': return 'Derivative of Media ID(s)';
447+
case 'replaces-media-id': return 'Replaces Media ID';
447448
default: return str.charAt(0).toUpperCase() + str.replace( /([A-Z]+)/g, " $1").slice(1)
448449
}
449450
});

media-api/test/scala/lib/querysyntax/ParserTest.scala

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,14 @@ class ParserTest extends AnyFunSpec with Matchers with BeforeAndAfter with Image
7979
Parser.run("label:cats label:dogs") should be (List(
8080
Match(labelsField, Words("cats")),
8181
Match(labelsField, Words("dogs")),
82-
) ++ standardNegations
83-
))
82+
) ++ standardNegations)
8483
}
8584

8685
it("should match multiple faceted terms on different facets") {
8786
Parser.run("credit:cats label:dogs") should be (List(
8887
Match(creditField, Words("cats")),
8988
Match(labelsField, Words("dogs")),
90-
) ++ standardNegations
91-
))
89+
) ++ standardNegations)
9290
}
9391
}
9492

@@ -374,8 +372,7 @@ class ParserTest extends AnyFunSpec with Matchers with BeforeAndAfter with Image
374372
it("should ignore an invalid date argument") {
375373
Parser.run("date:NAZGUL") should be (List(
376374
Match(SingleField("date"), Words("NAZGUL")),
377-
) ++ standardNegations
378-
))
375+
) ++ standardNegations)
379376
}
380377

381378
}

0 commit comments

Comments
 (0)