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

Implement Task Detailed View Redesign #20841

Merged
merged 105 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
affa78c
component skeleton, render component in ReportActionList, show GBR on…
jasperhuangg Jun 15, 2023
20db293
remove gbr logic
jasperhuangg Jun 16, 2023
c86cccf
rename TaskUtils => Task, allow ReportActionItem to respond to report…
jasperhuangg Jun 16, 2023
2a512f1
add and use TaskHeaderActionButton
jasperhuangg Jun 16, 2023
7a6c051
fix translations
jasperhuangg Jun 16, 2023
9f29276
remove unused
jasperhuangg Jun 16, 2023
11e24e3
remove unused
jasperhuangg Jun 16, 2023
de48e8a
merge main
jasperhuangg Jun 16, 2023
0542182
merge main
jasperhuangg Jun 16, 2023
5df849e
style
jasperhuangg Jun 16, 2023
ba7027f
remove unused
jasperhuangg Jun 16, 2023
a86e4b8
remove unused
jasperhuangg Jun 16, 2023
e47e33e
add created by and assignee to task view
jasperhuangg Jun 16, 2023
69b505f
fix task preview assignee selection
jasperhuangg Jun 16, 2023
16df838
get correct avatar for each user
jasperhuangg Jun 16, 2023
e291f00
description vertically centers if empty
jasperhuangg Jun 16, 2023
7adfb7d
Merge branch 'main' of github.com:Expensify/App into jasper-taskRedesign
jasperhuangg Jun 16, 2023
8e82218
lint
jasperhuangg Jun 16, 2023
f6dcbc7
fix ellipses
jasperhuangg Jun 16, 2023
83f3fc7
move title input to its own component
jasperhuangg Jun 16, 2023
3fb0cb2
remove unused props
jasperhuangg Jun 16, 2023
e296acc
whitespace
jasperhuangg Jun 16, 2023
4c53e3d
style
jasperhuangg Jun 16, 2023
9e7a13c
move styles into styles.js
jasperhuangg Jun 16, 2023
5c44d67
fix header button spacing on small screens
jasperhuangg Jun 16, 2023
7b53db0
remove unused import
jasperhuangg Jun 16, 2023
f5be337
remove unused
jasperhuangg Jun 16, 2023
b062f20
fix title menu item spacing
jasperhuangg Jun 17, 2023
476c4a5
fix title menu item spacing
jasperhuangg Jun 17, 2023
207d153
fix title menu item spacing
jasperhuangg Jun 17, 2023
895582e
fix title menu item spacing
jasperhuangg Jun 17, 2023
86106e4
merge main
jasperhuangg Jun 19, 2023
43d0c6d
merge main
jasperhuangg Jun 21, 2023
9299adb
style
jasperhuangg Jun 21, 2023
a94c829
Fix styling of task view (spacing)
jasperhuangg Jun 22, 2023
0ca36c0
fix task action styling on small screens
jasperhuangg Jun 23, 2023
f542875
fix title page display on android
jasperhuangg Jun 23, 2023
f110eab
fix checkbox height
jasperhuangg Jun 23, 2023
84115cd
fix display for multiline titles
jasperhuangg Jun 23, 2023
b88f11c
address design review
jasperhuangg Jun 23, 2023
53d07a2
remove unused
jasperhuangg Jun 23, 2023
e142642
remove unused
jasperhuangg Jun 23, 2023
c0efa17
merge main
jasperhuangg Jun 23, 2023
2f1d3a0
use shouldShowHorizontalRule
jasperhuangg Jun 23, 2023
adff1a1
push missing changes
jasperhuangg Jun 27, 2023
9863595
style
jasperhuangg Jun 27, 2023
2776407
remove unused param
jasperhuangg Jun 27, 2023
de7106e
add/use styles.backgroundBG
jasperhuangg Jun 27, 2023
de58d5e
move maskAsDone and markAsIncomplete translations to task
jasperhuangg Jun 27, 2023
0eb8f72
move newassigneeerror to task
jasperhuangg Jun 27, 2023
17bb9fa
resolve merge conflicts
jasperhuangg Jun 27, 2023
c7de5ec
fix workspace menu item avatar display
jasperhuangg Jun 27, 2023
983ecc2
fix warning
jasperhuangg Jun 27, 2023
fd8af36
resolve conflicts with main
jasperhuangg Jun 29, 2023
3844b8a
resolve conflicts
jasperhuangg Jun 30, 2023
15a8fc6
ensure horizontal rule refreshes correctly
jasperhuangg Jun 30, 2023
05ec710
fix case with empty assignee
jasperhuangg Jun 30, 2023
b2c030f
style
jasperhuangg Jun 30, 2023
df00196
fix translations
jasperhuangg Jun 30, 2023
377ccde
remove unused style
jasperhuangg Jun 30, 2023
cab230f
use utility function
jasperhuangg Jun 30, 2023
63e5c6f
add accessibility label
jasperhuangg Jun 30, 2023
db2b90a
merge main
jasperhuangg Jul 5, 2023
ef26b0e
fix merge conflicts
jasperhuangg Jul 5, 2023
1f78014
fix task header background color
jasperhuangg Jul 5, 2023
03dcd2b
allow description to occupy multiple lines
jasperhuangg Jul 5, 2023
6a91367
fix inverted elements on ios
jasperhuangg Jul 5, 2023
f85dda2
Update src/styles/styles.js
jasperhuangg Jul 5, 2023
b7be525
Merge branch 'main' of github.com:Expensify/App into jasper-taskRedesign
jasperhuangg Jul 5, 2023
3e9dd3b
Merge branch 'jasper-taskRedesign' of github.com:Expensify/App into j…
jasperhuangg Jul 5, 2023
9c045b2
fix warnings
jasperhuangg Jul 5, 2023
79cdc72
fix background color for task headers
jasperhuangg Jul 5, 2023
4e7356f
fix review comments
jasperhuangg Jul 5, 2023
e1b21e5
typo
jasperhuangg Jul 5, 2023
a032cb6
Update src/components/TaskHeaderActionButton.js
jasperhuangg Jul 5, 2023
bb83d22
fix merge conflicts
jasperhuangg Jul 5, 2023
fd12785
import const
jasperhuangg Jul 5, 2023
a21beac
add missing border bottom styles to task headergis
jasperhuangg Jul 5, 2023
3896e42
remove unused
jasperhuangg Jul 5, 2023
e3e838f
fix duplicated border bottom styles, fix display bug with incorrect b…
jasperhuangg Jul 5, 2023
4db3cf0
remove unused
jasperhuangg Jul 5, 2023
cbecf45
remove unused
jasperhuangg Jul 5, 2023
9713f9c
disable picking assignee via header for closed tasks
jasperhuangg Jul 5, 2023
aca68bd
disable checkbox for canceled tasks
jasperhuangg Jul 6, 2023
629f6a2
style
jasperhuangg Jul 6, 2023
c2a3ca3
fix merge conflicts
jasperhuangg Jul 6, 2023
87744a1
fix merge conflicts
jasperhuangg Jul 6, 2023
3be5ff2
remove unused
jasperhuangg Jul 6, 2023
fb21771
fix crash from merge
jasperhuangg Jul 6, 2023
8c51b2b
fix merge conflicts with main
jasperhuangg Jul 6, 2023
c91e789
disable title menu for canceled tasks
jasperhuangg Jul 6, 2023
4c6e442
disable title menu for canceled tasks
jasperhuangg Jul 6, 2023
3626cab
disable title menu for canceled tasks
jasperhuangg Jul 6, 2023
5d5296e
linter
jasperhuangg Jul 6, 2023
decf60a
fix conflicts
jasperhuangg Jul 6, 2023
58f3eeb
fix conflicts
jasperhuangg Jul 6, 2023
e7a85ae
disable hovered/pressed styles for task title menu item for completed…
jasperhuangg Jul 7, 2023
02da6af
apply disabled styles to title text for completed task
jasperhuangg Jul 7, 2023
ee378e5
pass cancelledTaskReportActionID
jasperhuangg Jul 7, 2023
c5e01bc
Update Task.js
jasperhuangg Jul 7, 2023
7e86ef2
merge main
jasperhuangg Jul 7, 2023
c0aca39
don't grey out menu items when canceled/closed
jasperhuangg Jul 7, 2023
3f6945b
fix merge conflicts
jasperhuangg Jul 7, 2023
e2d7eca
prettier
jasperhuangg Jul 7, 2023
3645840
resolve conflicts with main
jasperhuangg Jul 7, 2023
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
19 changes: 16 additions & 3 deletions src/components/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import themeColors from '../styles/themes/default';
import stylePropTypes from '../styles/stylePropTypes';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import * as StyleUtils from '../styles/StyleUtils';
import CONST from '../CONST';
import PressableWithFeedback from './Pressable/PressableWithFeedback';

Expand Down Expand Up @@ -34,6 +35,15 @@ const propTypes = {
/** Callback that is called when mousedown is triggered. */
onMouseDown: PropTypes.func,

/** The size of the checkbox container */
containerSize: PropTypes.number,

/** The border radius of the checkbox container */
containerBorderRadius: PropTypes.number,

/** The size of the caret (checkmark) */
caretSize: PropTypes.number,

/** A ref to forward to the Pressable */
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),

Expand All @@ -50,6 +60,9 @@ const defaultProps = {
forwardedRef: undefined,
children: null,
onMouseDown: undefined,
containerSize: 20,
containerBorderRadius: 4,
caretSize: 14,
};

function Checkbox(props) {
Expand Down Expand Up @@ -89,7 +102,7 @@ function Checkbox(props) {
) : (
<View
style={[
styles.checkboxContainer,
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
StyleUtils.getCheckboxContainerStyle(props.containerSize, props.containerBorderRadius),
props.containerStyle,
props.isChecked && styles.checkedContainer,
props.hasError && styles.borderColorDanger,
Expand All @@ -101,8 +114,8 @@ function Checkbox(props) {
<Icon
src={Expensicons.Checkmark}
fill={themeColors.textLight}
height={14}
width={14}
height={props.caretSize}
width={props.caretSize}
/>
)}
</View>
Expand Down
2 changes: 1 addition & 1 deletion src/components/LHNOptionsList/OptionRowLHN.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function OptionRowLHN(props) {
!hasBrickError &&
(optionItem.isUnreadWithMention ||
(optionItem.hasOutstandingIOU && !optionItem.isIOUReportOwner) ||
(optionItem.isTaskReport && optionItem.isTaskAssignee && !optionItem.isTaskCompleted && !optionItem.isArchivedRoom));
(optionItem.isTaskReport && optionItem.isTaskAssignee && !optionItem.isCompletedTaskReport && !optionItem.isArchivedRoom));

/**
* Show the ReportActionContextMenu modal popover.
Expand Down
17 changes: 11 additions & 6 deletions src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ const defaultProps = {
floatRightAvatars: [],
shouldStackHorizontally: false,
avatarSize: undefined,
floatRightAvatarSize: undefined,
shouldBlockSelection: false,
hoverAndPressStyle: [],
furtherDetails: '',
furtherDetailsIcon: undefined,
isSmallAvatarSubscriptMenu: false,
title: '',
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
numberOfLinesTitle: 1,
shouldGreyOutWhenDisabled: true,
};

function MenuItem(props) {
Expand All @@ -77,7 +81,7 @@ function MenuItem(props) {
[
styles.flexShrink1,
styles.popoverMenuText,
props.icon && !_.isArray(props.icon) ? styles.ml3 : undefined,
props.icon && !_.isArray(props.icon) && (props.avatarSize === CONST.AVATAR_SIZE.SMALL ? styles.ml2 : styles.ml3),
props.shouldShowBasicTitle ? undefined : styles.textStrong,
props.shouldShowHeaderTitle ? styles.textHeadlineH1 : undefined,
props.numberOfLinesTitle > 1 ? styles.preWrap : styles.pre,
Expand Down Expand Up @@ -120,7 +124,7 @@ function MenuItem(props) {
StyleUtils.getButtonBackgroundColorStyle(getButtonState(props.focused || hovered, pressed, props.success, props.disabled, props.interactive), true),
(hovered || pressed) && props.hoverAndPressStyle,
...(_.isArray(props.wrapperStyle) ? props.wrapperStyle : [props.wrapperStyle]),
props.disabled && styles.buttonOpacityDisabled,
props.shouldGreyOutWhenDisabled && props.disabled && styles.buttonOpacityDisabled,
]}
disabled={props.disabled}
ref={props.forwardedRef}
Expand Down Expand Up @@ -150,7 +154,7 @@ function MenuItem(props) {
/>
)}
{Boolean(props.icon) && !_.isArray(props.icon) && (
<View style={[styles.popoverMenuIcon, ...props.iconStyles]}>
<View style={[styles.popoverMenuIcon, ...props.iconStyles, StyleUtils.getAvatarWidthStyle(props.avatarSize || CONST.AVATAR_SIZE.DEFAULT)]}>
{props.iconType === CONST.ICON_TYPE_ICON && (
<Icon
src={props.icon}
Expand All @@ -174,14 +178,15 @@ function MenuItem(props) {
)}
{props.iconType === CONST.ICON_TYPE_AVATAR && (
<Avatar
imageStyles={[styles.avatarNormal, styles.alignSelfCenter]}
imageStyles={[styles.alignSelfCenter]}
source={props.icon}
fallbackIcon={props.fallbackIcon}
size={props.avatarSize || CONST.AVATAR_SIZE.DEFAULT}
/>
)}
</View>
)}
<View style={[styles.justifyContentCenter, styles.menuItemTextContainer, styles.flex1]}>
<View style={[styles.justifyContentCenter, styles.flex1, StyleUtils.getMenuItemTextContainerStyle(props.isSmallAvatarSubscriptMenu)]}>
{Boolean(props.description) && props.shouldShowDescriptionOnTop && (
<Text
style={descriptionTextStyle}
Expand Down Expand Up @@ -254,7 +259,7 @@ function MenuItem(props) {
isHovered={hovered}
isPressed={pressed}
icons={props.floatRightAvatars}
size={props.avatarSize || fallbackAvatarSize}
size={props.floatRightAvatarSize || fallbackAvatarSize}
fallbackIcon={defaultWorkspaceAvatars.WorkspaceBuilding}
shouldStackHorizontally={props.shouldStackHorizontally}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/MoneyRequestHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function MoneyRequestHeader(props) {
report.ownerEmail = lodashGet(props, ['parentReport', 'ownerEmail'], '');
}
return (
<View style={[{backgroundColor: themeColors.highlightBG}, styles.pl0]}>
<View style={[styles.highlightBG, styles.pl0]}>
<HeaderWithBackButton
shouldShowAvatarWithDisplay
shouldShowPinButton={props.isSingleTransactionView}
Expand Down
8 changes: 5 additions & 3 deletions src/components/ReportActionItem/TaskAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@ function TaskAction(props) {
messageLinkText = props.translate('task.messages.reopened');
break;
default:
messageLinkText = props.translate('newTaskPage.task');
messageLinkText = props.translate('task.task');
}

return (
<>
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
<Text style={styles.chatItemMessageLink}>{messageLinkText}</Text>
<Text style={[styles.chatItemMessage]}>{` ${taskReportName}`}</Text>
<Text>
<Text style={styles.chatItemMessageLink}>{messageLinkText}</Text>
<Text style={[styles.chatItemMessage]}>{` ${taskReportName}`}</Text>
</Text>
</View>
</>
);
Expand Down
15 changes: 8 additions & 7 deletions src/components/ReportActionItem/TaskPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import getButtonState from '../../libs/getButtonState';
import Navigation from '../../libs/Navigation/Navigation';
import ROUTES from '../../ROUTES';
import reportActionPropTypes from '../../pages/home/report/reportActionPropTypes';
import * as TaskUtils from '../../libs/actions/Task';
import * as Task from '../../libs/actions/Task';
import * as ReportUtils from '../../libs/ReportUtils';
import RenderHTML from '../RenderHTML';
import PressableWithoutFeedback from '../Pressable/PressableWithoutFeedback';
import personalDetailsPropType from '../../pages/personalDetailsPropType';
Expand Down Expand Up @@ -65,7 +66,7 @@ function TaskPreview(props) {
? props.taskReport.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && props.taskReport.statusNum === CONST.REPORT.STATUS.APPROVED
: props.action.childStateNum === CONST.REPORT.STATE_NUM.SUBMITTED && props.action.childStatusNum === CONST.REPORT.STATUS.APPROVED;
const taskTitle = props.taskReport.reportName || props.action.childReportName;
const taskAssigneeAccountID = TaskUtils.getTaskAssigneeAccountID(props.taskReport);
const taskAssigneeAccountID = Task.getTaskAssigneeAccountID(props.taskReport);
const taskAssignee = lodashGet(props.personalDetailsList, [taskAssigneeAccountID, 'login'], lodashGet(props.personalDetailsList, [taskAssigneeAccountID, 'displayName'], ''));
const htmlForTaskPreview = taskAssignee ? `<comment><mention-user>@${taskAssignee}</mention-user> ${taskTitle}</comment>` : `<comment>${taskTitle}</comment>`;

Expand All @@ -75,22 +76,22 @@ function TaskPreview(props) {
onPress={() => Navigation.navigate(ROUTES.getReportRoute(props.taskReportID))}
style={[styles.flexRow, styles.justifyContentBetween]}
accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON}
accessibilityLabel={props.translate('newTaskPage.task')}
accessibilityLabel={props.translate('task.task')}
>
<View style={[styles.flex1, styles.flexRow, styles.alignItemsStart]}>
<Checkbox
style={[styles.mr2]}
containerStyle={[styles.taskCheckbox]}
isChecked={isTaskCompleted}
disabled={TaskUtils.isTaskCanceled(props.taskReport)}
disabled={ReportUtils.isCanceledTaskReport(props.taskReport)}
onPress={() => {
if (isTaskCompleted) {
TaskUtils.reopenTask(props.taskReportID, taskTitle);
Task.reopenTask(props.taskReportID, taskTitle);
} else {
TaskUtils.completeTask(props.taskReportID, taskTitle);
Task.completeTask(props.taskReportID, taskTitle);
}
}}
accessibilityLabel={props.translate('newTaskPage.task')}
accessibilityLabel={props.translate('task.task')}
/>
<RenderHTML html={htmlForTaskPreview} />
</View>
Expand Down
148 changes: 148 additions & 0 deletions src/components/ReportActionItem/TaskView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import React, {useEffect} from 'react';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import reportPropTypes from '../../pages/reportPropTypes';
import withLocalize, {withLocalizePropTypes} from '../withLocalize';
import withWindowDimensions from '../withWindowDimensions';
import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes} from '../withCurrentUserPersonalDetails';
import compose from '../../libs/compose';
import Navigation from '../../libs/Navigation/Navigation';
import ROUTES from '../../ROUTES';
import MenuItemWithTopDescription from '../MenuItemWithTopDescription';
import MenuItem from '../MenuItem';
import styles from '../../styles/styles';
import * as ReportUtils from '../../libs/ReportUtils';
import * as PersonalDetailsUtils from '../../libs/PersonalDetailsUtils';
import * as UserUtils from '../../libs/UserUtils';
import * as StyleUtils from '../../styles/StyleUtils';
import * as Task from '../../libs/actions/Task';
import CONST from '../../CONST';
import Checkbox from '../Checkbox';
import convertToLTR from '../../libs/convertToLTR';
import Text from '../Text';
import Icon from '../Icon';
import getButtonState from '../../libs/getButtonState';
import PressableWithSecondaryInteraction from '../PressableWithSecondaryInteraction';
import * as Session from '../../libs/actions/Session';
import * as Expensicons from '../Icon/Expensicons';

const propTypes = {
/** The report currently being looked at */
report: reportPropTypes.isRequired,

/** Whether we should display the horizontal rule below the component */
shouldShowHorizontalRule: PropTypes.bool.isRequired,

...withLocalizePropTypes,

...withCurrentUserPersonalDetailsPropTypes,
};

function TaskView(props) {
useEffect(() => {
Task.setTaskReport({...props.report, isExistingTaskReport: true});
}, [props.report]);

const taskTitle = convertToLTR(props.report.reportName || '');
const isCompleted = ReportUtils.isCompletedTaskReport(props.report);
const isOpen = ReportUtils.isOpenTaskReport(props.report);
const isCanceled = ReportUtils.isCanceledTaskReport(props.report);

return (
<View>
<PressableWithSecondaryInteraction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was reason for using PressableWithSecondaryInteraction in TaskView instead of just PressableWithFeedback?
I don't see any secondary interaction.

onPress={Session.checkIfActionIsAllowed((e) => {
if (e && e.type === 'click') {
e.currentTarget.blur();
}

Navigation.navigate(ROUTES.getTaskReportTitleRoute(props.report.reportID));
})}
style={({hovered, pressed}) => [styles.ph5, styles.pv2, StyleUtils.getButtonBackgroundColorStyle(getButtonState(hovered, pressed, false, !isOpen), true)]}
ref={props.forwardedRef}
disabled={!isOpen}
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
accessibilityLabel={taskTitle || props.translate('task.task')}
>
{({hovered, pressed}) => (
<>
<Text style={styles.taskTitleDescription}>Title</Text>
<View style={[styles.flexRow, styles.alignItemsTop, styles.flex1]}>
<Checkbox
onPress={() => (isCompleted ? Task.reopenTask(props.report.reportID, taskTitle) : Task.completeTask(props.report.reportID, taskTitle))}
isChecked={isCompleted}
style={styles.taskMenuItemCheckbox}
containerSize={24}
containerBorderRadius={8}
caretSize={16}
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
accessibilityLabel={taskTitle || props.translate('task.task')}
disabled={isCanceled}
/>
<View style={[styles.flexRow, styles.flex1]}>
<Text
numberOfLines={3}
style={styles.taskTitleMenuItem}
>
{taskTitle}
</Text>
</View>
{isOpen && (
<View style={styles.taskRightIconContainer}>
<Icon
additionalStyles={[styles.alignItemsCenter]}
src={Expensicons.ArrowRight}
fill={StyleUtils.getIconFillColor(getButtonState(hovered, pressed, false, !isOpen))}
/>
</View>
)}
</View>
</>
)}
</PressableWithSecondaryInteraction>
<MenuItemWithTopDescription
description={props.translate('task.description')}
title={props.report.description || ''}
onPress={() => Navigation.navigate(ROUTES.getTaskReportDescriptionRoute(props.report.reportID))}
shouldShowRightIcon={isOpen}
disabled={!isOpen}
wrapperStyle={[styles.pv2]}
numberOfLinesTitle={3}
shouldGreyOutWhenDisabled={false}
/>
{props.report.managerID ? (
<MenuItem
label={props.translate('task.assignee')}
title={ReportUtils.getDisplayNameForParticipant(props.report.managerID)}
icon={UserUtils.getAvatar(
PersonalDetailsUtils.getPersonalDetailsByIDs([props.report.managerID], props.currentUserPersonalDetails.accountID)[0].avatar,
props.report.managerID,
)}
Comment on lines +115 to +118
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused a regression #22657. PersonalDetailsUtils.getPersonalDetailsByIDs could return an empty array e.g. for users that you have not interacted with before (no personaldetails). Then we will be trying to access property avatar of undefined.

iconType={CONST.ICON_TYPE_AVATAR}
avatarSize={CONST.AVATAR_SIZE.SMALLER}
titleStyle={styles.assigneeTextStyle}
onPress={() => Navigation.navigate(ROUTES.getTaskReportAssigneeRoute(props.report.reportID))}
shouldShowRightIcon={isOpen}
disabled={!isOpen}
wrapperStyle={[styles.pv2]}
isSmallAvatarSubscriptMenu
shouldGreyOutWhenDisabled={false}
/>
) : (
<MenuItemWithTopDescription
description={props.translate('task.assignee')}
onPress={() => Navigation.navigate(ROUTES.getTaskReportAssigneeRoute(props.report.reportID))}
shouldShowRightIcon={isOpen}
disabled={!isOpen}
wrapperStyle={[styles.pv2]}
shouldGreyOutWhenDisabled={false}
/>
)}

{props.shouldShowHorizontalRule && <View style={styles.taskHorizontalRule} />}
</View>
);
}

TaskView.propTypes = propTypes;
TaskView.displayName = 'TaskView';

export default compose(withWindowDimensions, withLocalize, withCurrentUserPersonalDetails)(TaskView);
Loading