Fix activity panel not showing unread when closed (#38173)
* Create new attribute to calculate more accurately if activity tab has something "new" * Fix wrong attribute name * Revert previous change, rename functions and remove isPanelOpen clause from hasAbbreviatedNotifications logic * Rename functions
This commit is contained in:
parent
7b7ca116f6
commit
345cca1e09
|
@ -28,7 +28,7 @@ import {
|
|||
*/
|
||||
import './style.scss';
|
||||
import { IconFlag } from './icon-flag';
|
||||
import { isNotesPanelVisible } from './unread-indicators';
|
||||
import { hasUnreadNotes as checkIfHasUnreadNotes } from './unread-indicators';
|
||||
import { Tabs } from './tabs';
|
||||
import { SetupProgress } from './setup-progress';
|
||||
import { DisplayOptions } from './display-options';
|
||||
|
@ -121,25 +121,22 @@ export const ActivityPanel = ( { isEmbedded, query } ) => {
|
|||
).length;
|
||||
}
|
||||
|
||||
function isAbbreviatedPanelVisible(
|
||||
function checkIfHasAbbreviatedNotifications(
|
||||
select,
|
||||
setupTaskListHidden,
|
||||
thingsToDoNextCount
|
||||
) {
|
||||
const orderStatuses = getOrderStatuses( select );
|
||||
|
||||
const isOrdersCardVisible =
|
||||
setupTaskListHidden && isPanelOpen
|
||||
? getUnreadOrders( select, orderStatuses ) > 0
|
||||
: false;
|
||||
const isReviewsCardVisible =
|
||||
setupTaskListHidden && isPanelOpen
|
||||
? getUnapprovedReviews( select )
|
||||
: false;
|
||||
const isLowStockCardVisible =
|
||||
setupTaskListHidden && isPanelOpen
|
||||
? getLowStockProducts( select )
|
||||
: false;
|
||||
const isOrdersCardVisible = setupTaskListHidden
|
||||
? getUnreadOrders( select, orderStatuses ) > 0
|
||||
: false;
|
||||
const isReviewsCardVisible = setupTaskListHidden
|
||||
? getUnapprovedReviews( select )
|
||||
: false;
|
||||
const isLowStockCardVisible = setupTaskListHidden
|
||||
? getLowStockProducts( select )
|
||||
: false;
|
||||
|
||||
return (
|
||||
thingsToDoNextCount > 0 ||
|
||||
|
@ -176,8 +173,8 @@ export const ActivityPanel = ( { isEmbedded, query } ) => {
|
|||
const thingsToDoCount = getThingsToDoNextCount( extendedTaskList );
|
||||
|
||||
return {
|
||||
hasUnreadNotes: isNotesPanelVisible( select ),
|
||||
hasAbbreviatedNotifications: isAbbreviatedPanelVisible(
|
||||
hasUnreadNotes: checkIfHasUnreadNotes( select ),
|
||||
hasAbbreviatedNotifications: checkIfHasAbbreviatedNotifications(
|
||||
select,
|
||||
isSetupTaskListHidden,
|
||||
thingsToDoCount
|
||||
|
|
|
@ -22,7 +22,7 @@ const UNREAD_NOTES_QUERY = {
|
|||
order: 'desc',
|
||||
};
|
||||
|
||||
export function isNotesPanelVisible( select ) {
|
||||
export function hasUnreadNotes( select ) {
|
||||
const { getNotes, getNotesError, isResolving } = select( NOTES_STORE_NAME );
|
||||
|
||||
const { getCurrentUser } = select( USER_STORE_NAME );
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fix activity panel not showing unread when closed
|
Loading…
Reference in New Issue