Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates mp3 resource previewer metadata to include has captions and s… #3999

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,11 @@
inline
/>
</DetailsRow>
<DetailsRow v-if="node.kind === 'video'" :label="$tr('subtitles')">
<DetailsRow
v-if="node.kind === 'video' ||
node.kind === 'audio'"
:label="$tr('subtitles')"
>
<ExpandableList :noItemsText="defaultText" :items="subtitleFileLanguages" inline />
</DetailsRow>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,7 @@
return this.firstNode.original_channel_name;
},
requiresAccessibility() {
return (
this.oneSelected &&
this.nodes.every(
node => node.kind !== ContentKindsNames.AUDIO && node.kind !== ContentKindsNames.TOPIC
)
);
return this.oneSelected && this.nodes.every(node => node.kind !== ContentKindsNames.TOPIC);
},
audioAccessibility() {
return this.oneSelected && this.firstNode.kind === 'audio';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ describe('AccessibilityOptions', () => {
expect(wrapper.find('[data-test="checkbox-audioDescription"]').exists()).toBe(false);
});

it('should display the correct list of accessibility options if resource is an audio', () => {
const wrapper = mount(AccessibilityOptions, {
propsData: {
kind: 'audio',
},
});

expect(wrapper.find('[data-test="checkbox-captionsSubtitles"]').exists()).toBe(true);
expect(wrapper.find('[data-test="tooltip-captionsSubtitles"]').exists()).toBe(false);
});

it('should render appropriate tooltips along with the checkbox', () => {
const wrapper = mount(AccessibilityOptions, {
propsData: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ export const ContentModalities = {
};

export const AccessibilityCategoriesMap = {
// Note: audio is not included, as it is rendered in the UI differently.
document: ['ALT_TEXT', 'HIGH_CONTRAST', 'TAGGED_PDF'],
video: ['CAPTIONS_SUBTITLES', 'AUDIO_DESCRIPTION', 'SIGN_LANGUAGE'],
exercise: ['ALT_TEXT'],
html5: ['ALT_TEXT', 'HIGH_CONTRAST'],
audio: ['CAPTIONS_SUBTITLES'],
};

export const CompletionDropdownMap = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ class Command(BaseCommand):
def handle(self, *args, **options):
start = time.time()

logging.info("Setting 'has captions' for video kinds")
logging.info("Setting 'has captions' for audio kinds")

has_captions_subquery = Exists(File.objects.filter(contentnode=OuterRef("id"), language=OuterRef("language"), preset_id=format_presets.VIDEO_SUBTITLE))
# Only try to update video nodes which have not had any accessibility labels set on them
# Only try to update audio nodes which have not had any accessibility labels set on them
# this will allow this management command to be rerun and resume from where it left off
# and also prevent stomping previous edits to the accessibility_labels field.
updateable_nodes = ContentNode.objects.filter(has_captions_subquery, kind=content_kinds.VIDEO, accessibility_labels__isnull=True)
updateable_nodes = ContentNode.objects.filter(has_captions_subquery, kind=content_kinds.AUDIO, accessibility_labels__isnull=True)

updateable_node_slice = updateable_nodes.values_list("id", flat=True)[0:CHUNKSIZE]

Expand Down