From 0b6a262e010c350b1f916066fa9cb31e81a26fb3 Mon Sep 17 00:00:00 2001 From: Ravi <7014230+arelra@users.noreply.github.com> Date: Tue, 7 Jan 2025 17:17:56 +0000 Subject: [PATCH] Use id from AudioBlockElement for media-id if available --- dotcom-rendering/src/lib/audio-data.ts | 4 ++-- dotcom-rendering/src/model/article-schema.json | 3 +++ dotcom-rendering/src/model/block-schema.json | 3 +++ dotcom-rendering/src/types/content.ts | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dotcom-rendering/src/lib/audio-data.ts b/dotcom-rendering/src/lib/audio-data.ts index 08ba3e9c8d3..f7fe490d379 100644 --- a/dotcom-rendering/src/lib/audio-data.ts +++ b/dotcom-rendering/src/lib/audio-data.ts @@ -8,10 +8,10 @@ export const getAudioData = ( element._type === 'model.dotcomrendering.pageElements.AudioBlockElement', ); - if (audioBlockElement?.assets[0] && audioBlockElement.elementId) { + if (audioBlockElement?.assets[0] && audioBlockElement.id) { return { audioDownloadUrl: audioBlockElement.assets[0].url, - mediaId: audioBlockElement.elementId, + mediaId: audioBlockElement.id, }; } return undefined; diff --git a/dotcom-rendering/src/model/article-schema.json b/dotcom-rendering/src/model/article-schema.json index 0009dcbdcc8..803b4d4ef89 100644 --- a/dotcom-rendering/src/model/article-schema.json +++ b/dotcom-rendering/src/model/article-schema.json @@ -841,6 +841,9 @@ "type": "string", "const": "model.dotcomrendering.pageElements.AudioBlockElement" }, + "id": { + "type": "string" + }, "elementId": { "type": "string" }, diff --git a/dotcom-rendering/src/model/block-schema.json b/dotcom-rendering/src/model/block-schema.json index 1e5a59c7c95..97709519086 100644 --- a/dotcom-rendering/src/model/block-schema.json +++ b/dotcom-rendering/src/model/block-schema.json @@ -428,6 +428,9 @@ "type": "string", "const": "model.dotcomrendering.pageElements.AudioBlockElement" }, + "id": { + "type": "string" + }, "elementId": { "type": "string" }, diff --git a/dotcom-rendering/src/types/content.ts b/dotcom-rendering/src/types/content.ts index 6d7bcd7fa5c..8656a692bee 100644 --- a/dotcom-rendering/src/types/content.ts +++ b/dotcom-rendering/src/types/content.ts @@ -45,6 +45,7 @@ export interface AudioAtomBlockElement { interface AudioBlockElement { _type: 'model.dotcomrendering.pageElements.AudioBlockElement'; + id?: string; elementId: string; assets: AudioAsset[]; }