Merge pull request #6734 from LLK/release/2022-04-13

[Develop] release/2022-04-13
This commit is contained in:
Sarah Otts 2022-04-14 10:41:23 -04:00 committed by GitHub
commit e9abb0db4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 51 deletions

View file

@ -8,8 +8,7 @@ import {
} from 'react-router-dom';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {FormattedMessage, injectIntl, intlShape} from 'react-intl';
import {isRtl} from 'scratch-l10n';
import Page from '../../components/page/www/page.jsx';
import render from '../../lib/render.jsx';
@ -35,21 +34,20 @@ import './studio.scss';
import {selectIsAdmin, selectMuteStatus} from '../../redux/session.js';
import {formatRelativeTime} from '../../lib/format-time.js';
import CommentingStatus from '../../components/commenting-status/commenting-status.jsx';
import {FormattedMessage} from 'react-intl';
import {selectShowCuratorMuteError} from '../../redux/studio-permissions.js';
export const StudioShell = ({intl, isAdmin, showCuratorMuteError, muteExpiresAtMs, studioLoadFailed, onLoadInfo}) => {
const StudioShell = ({isAdmin, showCuratorMuteError, muteExpiresAtMs, studioLoadFailed, onLoadInfo}) => {
const match = useRouteMatch();
useEffect(() => {
onLoadInfo();
}, [isAdmin]); // Reload any time isAdmin changes to allow admins to view deleted studios
return (
studioLoadFailed ?
<NotAvailable /> :
<div
className="studio-shell"
dir={isRtl(intl.locale) ? 'rtl' : null}
>
<div className="studio-shell">
<StudioDeleted />
<StudioMeta />
<div className="studio-info">
@ -100,7 +98,6 @@ export const StudioShell = ({intl, isAdmin, showCuratorMuteError, muteExpiresAtM
};
StudioShell.propTypes = {
intl: intlShape,
isAdmin: PropTypes.bool,
showCuratorMuteError: PropTypes.bool,
muteExpiresAtMs: PropTypes.number,
@ -120,8 +117,6 @@ const ConnectedStudioShell = connect(
}
)(StudioShell);
const IntlConnectedStudioShell = injectIntl(ConnectedStudioShell);
render(
<Page className="studio-page">
<StudioAdminPanel />
@ -129,7 +124,7 @@ render(
<Switch>
{/* Use variable studioPath to support /studio-playground/ or future route */}
<Route path="/:studioPath/:studioId">
<IntlConnectedStudioShell />
<ConnectedStudioShell />
</Route>
</Switch>
</Router>

View file

@ -1,39 +0,0 @@
const React = require('react');
const {shallow} = require('enzyme');
import {StudioShell} from '../../../src/views/studio/studio.jsx';
jest.mock('react-dom', () => ({
render: jest.fn()
}));
jest.mock('react-router-dom', () => ({
useRouteMatch: jest.fn(() => ({path: ''}))
}));
describe('Studio', () => {
test('dir is RTL when locale is rtl', () => {
const component = shallow(
<StudioShell
intl={{
locale: 'ar'
}}
/>
);
const studioShell = component.find('div.studio-shell');
expect(studioShell.prop('dir')).toEqual('rtl');
});
test('dir is LTR when locale is ltr', () => {
const component = shallow(
<StudioShell
intl={{
locale: 'ja'
}}
/>
);
const studioShell = component.find('div.studio-shell');
expect(studioShell.prop('dir')).toBeNull();
});
});