Skip to content

Commit 62c4588

Browse files
committed
Fix - Red dot is shown in recent chats for scanned expense moved to Workspace
1 parent 1d7e6ef commit 62c4588

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/components/Search/SearchAutocompleteList.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {combineOrderingOfReportsAndPersonalDetails, getSearchOptions} from '@lib
2222
import Performance from '@libs/Performance';
2323
import {getAllTaxRates, getCleanedTagName, shouldShowPolicy} from '@libs/PolicyUtils';
2424
import type {OptionData} from '@libs/ReportUtils';
25+
import {getReportOrDraftReport, isChatReport} from '@libs/ReportUtils';
2526
import {
2627
getAutocompleteCategories,
2728
getAutocompleteRecentCategories,
@@ -125,12 +126,16 @@ function getItemHeight(item: OptionData | SearchQueryItem) {
125126

126127
function SearchRouterItem(props: UserListItemProps<OptionData> | SearchQueryListItemProps) {
127128
const styles = useThemeStyles();
129+
const item = props.item;
130+
const report = getReportOrDraftReport(item.reportID);
131+
const shouldDisplayRBR = report && isChatReport(report) && !report.chatReportID;
128132

129133
if (isSearchQueryListItem(props)) {
130134
return (
131135
<SearchQueryListItem
132136
// eslint-disable-next-line react/jsx-props-no-spreading
133137
{...props}
138+
shouldDisplayRBR={shouldDisplayRBR}
134139
/>
135140
);
136141
}
@@ -139,6 +144,7 @@ function SearchRouterItem(props: UserListItemProps<OptionData> | SearchQueryList
139144
pressableStyle={[styles.br2, styles.ph3]}
140145
// eslint-disable-next-line react/jsx-props-no-spreading
141146
{...props}
147+
shouldDisplayRBR={shouldDisplayRBR}
142148
/>
143149
);
144150
}

src/components/SelectionList/Search/SearchQueryListItem.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ type SearchQueryListItemProps = {
2727
onSelectRow: (item: SearchQueryItem) => void;
2828
onFocus?: ListItemFocusEventHandler;
2929
shouldSyncFocus?: boolean;
30+
/** Whether to show RBR */
31+
shouldDisplayRBR?: boolean;
3032
};
3133

3234
function isSearchQueryItem(item: OptionData | SearchQueryItem): item is SearchQueryItem {
3335
return 'searchItemType' in item;
3436
}
3537

36-
function SearchQueryListItem({item, isFocused, showTooltip, onSelectRow, onFocus, shouldSyncFocus}: SearchQueryListItemProps) {
38+
function SearchQueryListItem({item, isFocused, showTooltip, onSelectRow, onFocus, shouldSyncFocus, shouldDisplayRBR}: SearchQueryListItemProps) {
3739
const styles = useThemeStyles();
3840
const theme = useTheme();
3941

@@ -49,6 +51,7 @@ function SearchQueryListItem({item, isFocused, showTooltip, onSelectRow, onFocus
4951
hoverStyle={item.isSelected && styles.activeComponentBG}
5052
shouldSyncFocus={shouldSyncFocus}
5153
showTooltip={showTooltip}
54+
shouldDisplayRBR={shouldDisplayRBR}
5255
>
5356
<>
5457
{!!item.singleIcon && (

src/components/SelectionList/UserListItem.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function UserListItem<TItem extends ListItem>({
3232
wrapperStyle,
3333
pressableStyle,
3434
shouldUseDefaultRightHandSideCheckmark,
35+
shouldDisplayRBR,
3536
}: UserListItemProps<TItem>) {
3637
const styles = useThemeStyles();
3738
const theme = useTheme();
@@ -75,6 +76,7 @@ function UserListItem<TItem extends ListItem>({
7576
keyForList={item.keyForList}
7677
onFocus={onFocus}
7778
shouldSyncFocus={shouldSyncFocus}
79+
shouldDisplayRBR={shouldDisplayRBR}
7880
>
7981
{(hovered?: boolean) => (
8082
<>

0 commit comments

Comments
 (0)