Skip to content

Commit

Permalink
Merge pull request #24624 from code-dot-org/record-audio-weblab-fix
Browse files Browse the repository at this point in the history
Record Audio - WebLab fix
  • Loading branch information
Erin Peach committed Sep 5, 2018
2 parents 3d46a9e + eefdb5b commit 1c401fd
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 4 deletions.
4 changes: 3 additions & 1 deletion apps/src/code-studio/assets/show.js
Expand Up @@ -17,6 +17,7 @@ var Dialog = require('../LegacyDialog');
* @param options {Object} Additional options.
* @param [options.showUnderageWarning] {boolean} Warn if underage.
* @param [options.useFilesApi] {boolean} Use files API instead of assets API.
* @param [options.disableAudioRecording] {boolean} Do not display option to record and upload audio files
*/
module.exports = function showAssetManager(assetChosen, typeFilter, onClose, options) {
options = options || {};
Expand Down Expand Up @@ -46,7 +47,8 @@ module.exports = function showAssetManager(assetChosen, typeFilter, onClose, opt
} : null,
showUnderageWarning: !!options.showUnderageWarning,
projectId: dashboard.project.getCurrentId(),
soundPlayer: sounds
soundPlayer: sounds,
disableAudioRecording: options.disableAudioRecording
}), codeDiv);

dialog.show();
Expand Down
5 changes: 4 additions & 1 deletion apps/src/code-studio/components/AddAssetButtonRow.jsx
Expand Up @@ -54,6 +54,7 @@ export default class AddAssetButtonRow extends React.Component {
onSelectRecord: PropTypes.func.isRequired,
statusMessage: PropTypes.string,
recordDisabled: PropTypes.bool,
hideAudioRecording: PropTypes.bool
};

render() {
Expand All @@ -67,7 +68,9 @@ export default class AddAssetButtonRow extends React.Component {
onUploadDone={this.props.onUploadDone}
onUploadError={this.props.onUploadError}
/>
<RecordButton onSelectRecord={this.props.onSelectRecord} disabled={this.props.recordDisabled}/>
{!this.props.hideAudioRecording &&
<RecordButton onSelectRecord={this.props.onSelectRecord} disabled={this.props.recordDisabled}/>
}
<span id="manage-asset-status">
{this.props.statusMessage}
</span>
Expand Down
3 changes: 2 additions & 1 deletion apps/src/code-studio/components/AssetManager.jsx
Expand Up @@ -51,7 +51,7 @@ export default class AssetManager extends React.Component {
//For logging upload failures
projectId: PropTypes.string,
soundPlayer: PropTypes.object,

disableAudioRecording: PropTypes.bool,
//Temp prop for logging - identifies if displayed by 'Manage Assets' flow
imagePicker: PropTypes.bool
};
Expand Down Expand Up @@ -176,6 +176,7 @@ export default class AssetManager extends React.Component {
onSelectRecord={this.onSelectRecord}
statusMessage={this.state.statusMessage}
recordDisabled={this.state.recordingAudio}
hideAudioRecording={this.props.disableAudioRecording}
/>
</div>
);
Expand Down
2 changes: 2 additions & 0 deletions apps/src/code-studio/components/ImagePicker.jsx
Expand Up @@ -22,6 +22,7 @@ export default class ImagePicker extends React.Component {
showUnderageWarning: PropTypes.bool.isRequired,
useFilesApi: PropTypes.bool,
soundPlayer: PropTypes.object,
disableAudioRecording: PropTypes.bool,
//For logging upload failures
projectId: PropTypes.string
};
Expand Down Expand Up @@ -90,6 +91,7 @@ export default class ImagePicker extends React.Component {
useFilesApi={this.props.useFilesApi}
projectId={this.props.projectId}
soundPlayer={this.props.soundPlayer}
disableAudioRecording={this.props.disableAudioRecording}
imagePicker={true}
/> :
<IconLibrary assetChosen={this.getAssetNameWithPrefix}/>;
Expand Down
3 changes: 2 additions & 1 deletion apps/src/weblab/WebLab.js
Expand Up @@ -201,7 +201,8 @@ WebLab.prototype.init = function (config) {
project.autosave(() => {
dashboard.assets.showAssetManager(null, 'image', this.loadFileEntries.bind(this), {
showUnderageWarning: !getStore().getState().pageConstants.is13Plus,
useFilesApi: config.useFilesApi
useFilesApi: config.useFilesApi,
disableAudioRecording: true
});
});
}
Expand Down
1 change: 1 addition & 0 deletions apps/src/weblab/WebLabView.jsx
Expand Up @@ -69,6 +69,7 @@ class WebLabView extends React.Component {
label={weblabMsg.addCSSButton()}
/>
<PaneButton
id="ui-test-add-image"
iconClass="fa fa-plus-circle"
leftJustified={true}
headerHasFocus={true}
Expand Down
6 changes: 6 additions & 0 deletions dashboard/test/ui/features/manage_assets.feature
Expand Up @@ -37,3 +37,9 @@ Feature: Manage Assets
And I click selector "#ui-image-thumbnail"
And I go to the newly opened tab
And check that the URL matches "/v3/assets/.*/artist_image_1.png"

Scenario: From WebLab, the manage assets dialog does not contain the option to record audio.
Given I am a student
And I am on "http://studio.code.org/projects/weblab/new"
Then I click selector "#ui-test-add-image" once I see it
Then I wait until element "#record-asset" is not visible

0 comments on commit 1c401fd

Please sign in to comment.