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

Admin Page: do not display Composing header for editors. #13542

Merged
merged 2 commits into from
Sep 30, 2019
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
5 changes: 2 additions & 3 deletions _inc/client/components/settings-card/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ export const SettingsCard = props => {
backupsEnabled = get( vpData, [ 'data', 'features', 'backups' ], false ),
scanEnabled = get( vpData, [ 'data', 'features', 'security' ], false );

// Non admin users only get Publicize, After the Deadline, and Post by Email settings.
// composing is not a module slug but it's used so the Composing card is rendered to show AtD.
// Non admin users only get Publicize and Post by Email settings.
if (
! props.userCanManageModules &&
! includes( [ 'composing', 'post-by-email', 'publicize' ], props.module )
! includes( [ 'post-by-email', 'publicize' ], props.module )
) {
return <span />;
}
Expand Down
5 changes: 2 additions & 3 deletions _inc/client/components/settings-card/test/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ describe( 'SettingsCard', () => {
'photon'
],
allCardsForNonAdmin = [
'composing',
'post-by-email'
];

Expand Down Expand Up @@ -172,13 +171,13 @@ describe( 'SettingsCard', () => {
userCanManageModules: false
} );

it( 'does not render cards that are not Composing or Post by Email', () => {
it( 'does not render cards that are not Post by Email', () => {
allCardsNonAdminCantAccess.forEach( item => {
expect( shallow( <SettingsCard { ...testProps } module={ item } ><p>Child</p></SettingsCard> ).find( 'form' ) ).to.have.length( 0 );
} );
} );

it( 'renders Composing and Post by Email cards', () => {
it( 'renders Post by Email cards', () => {
allCardsForNonAdmin.forEach( item => {
expect( shallow( <SettingsCard { ...testProps } module={ item } ><p>Child</p></SettingsCard> ).find( 'form' ) ).to.have.length( 1 );
} );
Expand Down