Skip to content

Commit 8693d3d

Browse files
committed
replace last references to original-media-id (with derivative-of-media-ids & replaces-media-id)
1 parent 7e8412f commit 8693d3d

File tree

5 files changed

+21
-15
lines changed

5 files changed

+21
-15
lines changed

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: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -765,11 +765,17 @@
765765

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>
768-
<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>
768+
<dd class="metadata-line__info image-info__group--dl__value--full-metadata" >
769+
<span ng-switch="key">
770+
<a ng-switch-when="derivative-of-media-ids"
771+
ng-repeat="id in value.split(',')"
772+
ui-sref="search.results({query: id.trim(), nonFree: true})"
773+
aria-label="Search for images with id '{{id.trim()}}'">{{id.trim()}}<br/></a>
774+
<a ng-switch-when="replaces-media-id"
775+
ui-sref="image({imageId: value})"
776+
aria-label="This image replaces image with id '{{value}}'">{{value}}</a>
777+
<span ng-switch-default>{{value}}</span>
778+
</span>
773779
</dd>
774780
</dl>
775781
</div>

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,6 @@ module.controller('grImageMetadataCtrl', [
421421

422422
ctrl.isUsefulMetadata = isUsefulMetadata;
423423

424-
ctrl.isSearchableIdentifier = (identifier) => ["original-media-id"].includes(identifier);
425-
426424
function hasLocationInformation() {
427425
return ctrl.metadata && (
428426
ctrl.metadata.subLocation ||

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)