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

Remove voiceover from exp schema #20675

Draft
wants to merge 39 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f003882
Adds conversions function for exploration migration.
Nik-09 Apr 19, 2024
71a0266
Removes recorded voiceover fields from exploration states backend
Nik-09 Apr 22, 2024
d000747
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Jun 8, 2024
68b14ad
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Jun 9, 2024
a930682
Fixes merge conflict
Nik-09 Jul 8, 2024
17f95f4
Removed recorded voiceover from exploration
Nik-09 Jul 9, 2024
d9e5a91
Removes feature flag
Nik-09 Jul 9, 2024
2214f8b
Removes voice artist models and UI
Nik-09 Jul 10, 2024
7f21430
Removes audio translation service files and uses.
Nik-09 Jul 14, 2024
d62e948
Fixes merge conflict
Nik-09 Jul 15, 2024
e7a8ac4
Fixes backend tests
Nik-09 Jul 15, 2024
16eacbc
Fixes backend tests
Nik-09 Jul 15, 2024
9fb7eca
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Jul 16, 2024
49380f3
Fixes frontend tests
Nik-09 Jul 21, 2024
439c490
Fixes merge conflict and frontend test
Nik-09 Jul 29, 2024
79c333b
Fixes frontend tests
Nik-09 Jul 29, 2024
7de0993
Fixes frontend tests
Nik-09 Aug 1, 2024
a348168
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Aug 1, 2024
827700f
Fixes lint issues
Nik-09 Aug 1, 2024
789cb77
Fixes lint issues
Nik-09 Aug 3, 2024
7519f17
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Aug 3, 2024
77ce7d1
Fixes merge conflict
Nik-09 Aug 7, 2024
23661e3
Fixes typescript checks
Nik-09 Aug 8, 2024
ff67301
Fixes merge conflict
Nik-09 Aug 18, 2024
4acb589
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Sep 4, 2024
8072d16
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Sep 21, 2024
3ea710d
Fixes frontend tests
Nik-09 Sep 23, 2024
a06d486
Fixes merge conflicts
Nik-09 Sep 30, 2024
c8a2218
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Oct 7, 2024
7f34239
Fixes merge conflict
Nik-09 Oct 30, 2024
11942df
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Nov 2, 2024
e89e16c
Fixes frontend tests
Nik-09 Nov 7, 2024
a8ab730
Fixes merge conflict
Nik-09 Nov 11, 2024
fc155ba
Reverts unnecessary changes.
Nik-09 Nov 24, 2024
bd34115
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Nov 24, 2024
95d39fa
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Dec 1, 2024
c49c609
Fixes backend and lint checks
Nik-09 Dec 1, 2024
a87e250
Fixes merge conflict
Nik-09 Dec 10, 2024
446684c
Merge branch 'develop' into remove_voiceover_from_exp_schema
seanlip Dec 12, 2024
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
Prev Previous commit
Next Next commit
Removed recorded voiceover from exploration
  • Loading branch information
Nik-09 committed Jul 9, 2024
commit 17f95f4a3110e374df2bf1bd4f04df2c364637cb
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,9 @@ export class Exploration extends BaseTranslatableObject {
return this.getState(stateName).content.html;
}

getAllVoiceovers(languageCode: string): VoiceoverObjectsDict {
return this.states.getAllVoiceovers(languageCode);
}

getLanguageCode(): string {
return this.languageCode;
}

getAllVoiceoverLanguageCodes(): string[] {
return this.states.getAllVoiceoverLanguageCodes();
}
}

@Injectable({
Expand Down
29 changes: 0 additions & 29 deletions core/templates/domain/exploration/StatesObjectFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,35 +155,6 @@ export class States {
}
return finalStateNames;
}

getAllVoiceoverLanguageCodes(): string[] {
const allLanguageCodes = new Set<string>();
Object.values(this._states).forEach(state => {
state.recordedVoiceovers.getAllContentIds().forEach(contentId => {
const contentLanguageCodes =
state.recordedVoiceovers.getLanguageCodes(contentId);
contentLanguageCodes.forEach(allLanguageCodes.add, allLanguageCodes);
});
});
return [...allLanguageCodes];
}

getAllVoiceovers(languageCode: string): VoiceoverObjectsDict {
let allAudioTranslations: VoiceoverObjectsDict = {};
for (let stateName in this._states) {
let state = this._states[stateName];
allAudioTranslations[stateName] = [];
let contentIdsList = state.recordedVoiceovers.getAllContentIds();
contentIdsList.forEach(contentId => {
let audioTranslations =
state.recordedVoiceovers.getBindableVoiceovers(contentId);
if (audioTranslations.hasOwnProperty(languageCode)) {
allAudioTranslations[stateName].push(audioTranslations[languageCode]);
}
});
}
return allAudioTranslations;
}
}

@Injectable({
Expand Down
6 changes: 0 additions & 6 deletions core/templates/domain/question/question-update.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,6 @@ export class QuestionUpdateService {
newContentIds,
oldContentIds
);
contentIdsToDelete.forEach(contentId => {
newState.recordedVoiceovers.deleteContentId(contentId);
});
contentIdsToAdd.forEach(contentId => {
newState.recordedVoiceovers.addContentId(contentId);
});
}

setQuestionLanguageCode(question: Question, newLanguageCode: string): void {
Expand Down
10 changes: 0 additions & 10 deletions core/templates/domain/state/StateObjectFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export interface StateBackendDict {
content: SubtitledHtmlBackendDict;
interaction: InteractionBackendDict;
param_changes: readonly ParamChangeBackendDict[];
recorded_voiceovers: RecordedVoiceOverBackendDict;
solicit_answer_details: boolean;
card_is_checkpoint: boolean;
// This property is null if no skill is linked to the State.
Expand All @@ -63,7 +62,6 @@ export class State extends BaseTranslatableObject {
content: SubtitledHtml;
interaction: Interaction;
paramChanges: ParamChange[];
recordedVoiceovers: RecordedVoiceovers;
solicitAnswerDetails: boolean;
cardIsCheckpoint: boolean;

Expand All @@ -74,7 +72,6 @@ export class State extends BaseTranslatableObject {
content: SubtitledHtml,
interaction: Interaction,
paramChanges: ParamChange[],
recordedVoiceovers: RecordedVoiceovers,
solicitAnswerDetails: boolean,
cardIsCheckpoint: boolean
) {
Expand All @@ -85,7 +82,6 @@ export class State extends BaseTranslatableObject {
this.content = content;
this.interaction = interaction;
this.paramChanges = paramChanges;
this.recordedVoiceovers = recordedVoiceovers;
this.solicitAnswerDetails = solicitAnswerDetails;
this.cardIsCheckpoint = cardIsCheckpoint;
}
Expand All @@ -111,7 +107,6 @@ export class State extends BaseTranslatableObject {
param_changes: this.paramChanges.map(paramChange => {
return paramChange.toBackendDict();
}),
recorded_voiceovers: this.recordedVoiceovers.toBackendDict(),
solicit_answer_details: this.solicitAnswerDetails,
card_is_checkpoint: this.cardIsCheckpoint,
};
Expand All @@ -123,7 +118,6 @@ export class State extends BaseTranslatableObject {
this.content = otherState.content;
this.interaction.copy(otherState.interaction);
this.paramChanges = otherState.paramChanges;
this.recordedVoiceovers = otherState.recordedVoiceovers;
this.solicitAnswerDetails = otherState.solicitAnswerDetails;
this.cardIsCheckpoint = otherState.cardIsCheckpoint;
}
Expand Down Expand Up @@ -158,7 +152,6 @@ export class StateObjectFactory {
content: newStateTemplate.content,
interaction: newStateTemplate.interaction,
param_changes: newStateTemplate.param_changes,
recorded_voiceovers: newStateTemplate.recorded_voiceovers,
solicit_answer_details: newStateTemplate.solicit_answer_details,
card_is_checkpoint: newStateTemplate.card_is_checkpoint,
});
Expand All @@ -171,8 +164,6 @@ export class StateObjectFactory {
if (defaultOutcome !== null && newStateName !== null) {
defaultOutcome.dest = newStateName as string;
}
newState.recordedVoiceovers.addContentId(contentIdForContent);
newState.recordedVoiceovers.addContentId(contentIdForDefaultOutcome);

return newState;
}
Expand All @@ -189,7 +180,6 @@ export class StateObjectFactory {
SubtitledHtml.createFromBackendDict(stateDict.content),
this.interactionObject.createFromBackendDict(stateDict.interaction),
this.paramchangesObject.createFromBackendList(stateDict.param_changes),
RecordedVoiceovers.createFromBackendDict(stateDict.recorded_voiceovers),
stateDict.solicit_answer_details,
stateDict.card_is_checkpoint
);
Expand Down
25 changes: 0 additions & 25 deletions core/templates/domain/state_card/state-card.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export class StateCard {
_interactionHtml: string;
_interaction: Interaction;
_inputResponsePairs: InputResponsePair[];
_recordedVoiceovers: RecordedVoiceovers;
_contentId: string;
_completed: boolean;
audioTranslationLanguageService: AudioTranslationLanguageService;
Expand All @@ -62,7 +61,6 @@ export class StateCard {
interactionHtml: string,
interaction: Interaction,
inputResponsePairs: InputResponsePair[],
recordedVoiceovers: RecordedVoiceovers,
contentId: string,
audioTranslationLanguageService: AudioTranslationLanguageService
) {
Expand All @@ -71,7 +69,6 @@ export class StateCard {
this._interactionHtml = interactionHtml;
this._inputResponsePairs = inputResponsePairs;
this._interaction = interaction;
this._recordedVoiceovers = recordedVoiceovers;
this._contentId = contentId;
this._completed = false;
this.audioTranslationLanguageService = audioTranslationLanguageService;
Expand Down Expand Up @@ -111,26 +108,6 @@ export class StateCard {
return this._interaction;
}

getVoiceovers(): BindableVoiceovers {
let recordedVoiceovers = this._recordedVoiceovers;
let contentId = this._contentId;
if (recordedVoiceovers) {
return recordedVoiceovers.getBindableVoiceovers(contentId);
}
return {};
}

getRecordedVoiceovers(): RecordedVoiceovers {
return this._recordedVoiceovers;
}

isContentAudioTranslationAvailable(): boolean {
return (
Object.keys(this.getVoiceovers()).length > 0 ||
this.audioTranslationLanguageService.isAutogeneratedAudioAllowed()
);
}

getInteractionId(): string | null {
if (this.getInteraction()) {
return this.getInteraction().id;
Expand Down Expand Up @@ -342,7 +319,6 @@ export class StateCard {
contentHtml: string,
interactionHtml: string,
interaction: Interaction,
recordedVoiceovers: RecordedVoiceovers,
contentId: string,
audioTranslationLanguageService: AudioTranslationLanguageService
): StateCard {
Expand All @@ -352,7 +328,6 @@ export class StateCard {
interactionHtml,
cloneDeep(interaction),
[],
recordedVoiceovers,
contentId,
audioTranslationLanguageService
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,22 +294,22 @@ export class ExplorationStatesService {
this.changeListService.markTranslationsAsNeedingUpdate(contentId);
let stateName = this.stateEditorService.getActiveStateName();
let state = this.getState(stateName);
let recordedVoiceovers = state.recordedVoiceovers;
if (recordedVoiceovers.hasUnflaggedVoiceovers(contentId)) {
recordedVoiceovers.markAllVoiceoversAsNeedingUpdate(contentId);
this.saveRecordedVoiceovers(stateName, recordedVoiceovers);
}
// let recordedVoiceovers = state.recordedVoiceovers;
// if (recordedVoiceovers.hasUnflaggedVoiceovers(contentId)) {
// recordedVoiceovers.markAllVoiceoversAsNeedingUpdate(contentId);
// this.saveRecordedVoiceovers(stateName, recordedVoiceovers);
// }
}

removeTranslationAndVoiceover(contentId: string): void {
this.changeListService.removeTranslations(contentId);
let stateName = this.stateEditorService.getActiveStateName();
let state = this.getState(stateName);
let recordedVoiceovers = state.recordedVoiceovers;
if (recordedVoiceovers.hasVoiceovers(contentId)) {
recordedVoiceovers.voiceoversMapping[contentId] = {};
this.saveRecordedVoiceovers(stateName, recordedVoiceovers);
}
// let recordedVoiceovers = state.recordedVoiceovers;
// if (recordedVoiceovers.hasVoiceovers(contentId)) {
// recordedVoiceovers.voiceoversMapping[contentId] = {};
// this.saveRecordedVoiceovers(stateName, recordedVoiceovers);
// }
this.entityTranslationsService.removeAllTranslationsForContent(contentId);
}

Expand Down Expand Up @@ -517,12 +517,6 @@ export class ExplorationStatesService {
newContentIds,
oldContentIds
);
contentIdsToDelete.forEach(contentId => {
newStateData.recordedVoiceovers.deleteContentId(contentId);
});
contentIdsToAdd.forEach(contentId => {
newStateData.recordedVoiceovers.addContentId(contentId);
});
}
let propertyRef = newStateData;
for (let i = 0; i < accessorList.length - 1; i++) {
Expand Down Expand Up @@ -589,6 +583,10 @@ export class ExplorationStatesService {
return cloneDeep(this._states);
}

getAllContentIdsByStateName(stateName: string) {
return this._states.getState(stateName).getAllContentIds();
}

getStateNames(): string[] {
return this._states.getStateNames();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,13 @@ export class TranslationStatusService implements OnInit {
let stateNeedsUpdate = false;
let noTranslationCount = 0;
let noVoiceoverCount = 0;
let recordedVoiceovers =
this.explorationStatesService.getRecordedVoiceoversMemento(stateName);
// let recordedVoiceovers =
// this.explorationStatesService.getRecordedVoiceoversMemento(stateName);
// let allContentIds = recordedVoiceovers.getAllContentIds();

let allContentIds =
this.explorationStatesService.getAllContentIdsByStateName(stateName);

let allContentIds = recordedVoiceovers.getAllContentIds();
let interactionId =
this.explorationStatesService.getInteractionIdMemento(stateName);
// This is used to prevent users from adding unwanted hints audio, as
Expand Down Expand Up @@ -366,8 +369,11 @@ export class TranslationStatusService implements OnInit {
}

_getAvailableContentIds(): string[] {
let recordedVoiceovers = this.stateRecordedVoiceoversService.displayed;
return recordedVoiceovers.getAllContentIds();
let stateName = this.stateEditorService.getActiveStateName();

return this.explorationStatesService.getAllContentIdsByStateName(stateName);
// let recordedVoiceovers = this.stateRecordedVoiceoversService.displayed;
// return recordedVoiceovers.getAllContentIds();
}

_getActiveStateComponentNeedsUpdateStatus(componentName: string): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ import {EventEmitter} from '@angular/core';
import {Injectable} from '@angular/core';

import {StateRecordedVoiceoversService} from 'components/state-editor/state-editor-properties-services/state-recorded-voiceovers.service';
import {ExplorationStatesService} from 'pages/exploration-editor-page/services/exploration-states.service';
import {StateEditorService} from 'components/state-editor/state-editor-properties-services/state-editor.service';

@Injectable({
providedIn: 'root',
})
export class TranslationTabActiveContentIdService {
constructor(
private _stateRecordedVoiceoversService: StateRecordedVoiceoversService
private _stateRecordedVoiceoversService: StateRecordedVoiceoversService,
private _explorationStatesService: ExplorationStatesService,
private _stateEditorService: StateEditorService
) {}

// 'activeContentId' and 'activeDataFormat' will be 'null' if active content
Expand All @@ -45,15 +49,17 @@ export class TranslationTabActiveContentIdService {
}

setActiveContent(contentId: string, dataFormat: string): void {
const displayStateRecordedVoiceovers =
this._stateRecordedVoiceoversService.displayed;
let allContentIds = displayStateRecordedVoiceovers.getAllContentIds();
let stateName = this._stateEditorService.getActiveStateName();
let allContentIds =
this._explorationStatesService.getAllContentIdsByStateName(stateName);

if (allContentIds.indexOf(contentId) === -1) {
throw new Error('Invalid active content id: ' + contentId);
}
this.activeContentId = contentId;
this.activeDataFormat = dataFormat;
this._activeContentIdChangedEventEmitter.emit(dataFormat);
console.log('Done');
}

get onActiveContentIdChanged(): EventEmitter<string> {
Expand Down
Loading