Skip to content

Commit 2b6ef99

Browse files
author
Andrea Barbasso
committed
[DSC-2140] avoid showing placeholder metadata values
1 parent 867f416 commit 2b6ef99

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/app/core/shared/metadata.utils.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { validate as uuidValidate } from 'uuid';
1414

1515
export const AUTHORITY_GENERATE = 'will be generated::';
1616
export const AUTHORITY_REFERENCE = 'will be referenced::';
17+
export const PLACEHOLDER_VALUE = '#PLACEHOLDER_PARENT_METADATA_VALUE#';
18+
1719

1820
/**
1921
* Utility class for working with DSpace object metadata.
@@ -29,7 +31,6 @@ export const AUTHORITY_REFERENCE = 'will be referenced::';
2931
* followed by any other (non-dc) metadata values.
3032
*/
3133
export class Metadata {
32-
3334
/**
3435
* Gets all matching metadata in the map(s).
3536
*
@@ -152,7 +153,7 @@ export class Metadata {
152153
* Returns true if this Metadatum's value is defined
153154
*/
154155
public static hasValue(value: MetadataValue|string): boolean {
155-
if (isEmpty(value)) {
156+
if (isEmpty(value) || value === PLACEHOLDER_VALUE) {
156157
return false;
157158
}
158159
if (isObject(value) && value.hasOwnProperty('value')) {
@@ -169,7 +170,9 @@ export class Metadata {
169170
* @returns {boolean} whether the filter matches, or true if no filter is given.
170171
*/
171172
public static valueMatches(mdValue: MetadataValue, filter: MetadataValueFilter) {
172-
if (!filter) {
173+
if (mdValue.value === PLACEHOLDER_VALUE) {
174+
return false;
175+
} else if (!filter) {
173176
return true;
174177
} else if (filter.language && filter.language !== mdValue.language) {
175178
return false;

0 commit comments

Comments
 (0)