Skip to content
Draft
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
3 changes: 3 additions & 0 deletions apps/notifications/src/app/templates/body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ export const NoteBody = ( { note }: { note: Note } ) => {
const isApproved = useSelector( ( state ) => getIsNoteApproved( state, note ) );
const actions = getActions( note );
const hasAction = ( types: string | string[] ) => {
if ( ! actions ) {
return false;
}
const typeArray = Array.isArray( types ) ? types : [ types ];
return typeArray.some( ( type ) => actions.hasOwnProperty( type ) );
};
Expand Down
4 changes: 3 additions & 1 deletion apps/notifications/src/panel/templates/body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ export class NoteBody extends Component {
// Check if we should show the pending approval badge
const noteActions = getActions( this.props.note );
const hasAction = ( types ) =>
[].concat( types ).some( ( type ) => noteActions.hasOwnProperty( type ) );
noteActions
? [].concat( types ).some( ( type ) => noteActions.hasOwnProperty( type ) )
: false;
const showPendingApprovalBadge = hasAction( 'approve-comment' ) && ! this.props.isApproved;

for ( i = 0; i < blocks.length; i++ ) {
Expand Down