-
Notifications
You must be signed in to change notification settings - Fork 3.9k
CancelTask frontend #18747
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
CancelTask frontend #18747
Changes from all commits
5ba5bee
fde26f3
067e77e
b9c9f50
dd199e5
3ac8891
39e0a12
adad9a4
e5c08b5
1017659
eb825c7
a9f6882
e68d5ea
0d86edd
1dea583
1d1ec1e
e0bef3a
c8e284a
af6d95c
3ed87e9
e234c0d
c0377c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,8 +26,8 @@ import colors from '../../styles/colors'; | |
| import reportPropTypes from '../reportPropTypes'; | ||
| import ONYXKEYS from '../../ONYXKEYS'; | ||
| import ThreeDotsMenu from '../../components/ThreeDotsMenu'; | ||
| import * as Task from '../../libs/actions/Task'; | ||
| import reportActionPropTypes from './report/reportActionPropTypes'; | ||
| import * as TaskUtils from '../../libs/actions/Task'; | ||
|
|
||
| const propTypes = { | ||
| /** Toggles the navigationMenu open and closed */ | ||
|
|
@@ -86,15 +86,13 @@ const HeaderView = (props) => { | |
| // We hide the button when we are chatting with an automated Expensify account since it's not possible to contact | ||
| // these users via alternative means. It is possible to request a call with Concierge so we leave the option for them. | ||
| const shouldShowCallButton = (isConcierge && guideCalendarLink) || (!isAutomatedExpensifyAccount && !isTaskReport); | ||
| const shouldShowThreeDotsButton = isTaskReport; | ||
| const threeDotMenuItems = []; | ||
|
|
||
| if (shouldShowThreeDotsButton) { | ||
| if (isTaskReport) { | ||
| if (props.report.stateNum === CONST.REPORT.STATE_NUM.OPEN && props.report.statusNum === CONST.REPORT.STATUS.OPEN) { | ||
| threeDotMenuItems.push({ | ||
| icon: Expensicons.Checkmark, | ||
| text: props.translate('newTaskPage.markAsDone'), | ||
| onSelected: () => TaskUtils.completeTask(props.report.reportID, props.report.parentReportID, title), | ||
| onSelected: () => Task.completeTask(props.report.reportID, props.report.parentReportID, title), | ||
| }); | ||
| } | ||
|
|
||
|
|
@@ -103,7 +101,7 @@ const HeaderView = (props) => { | |
| threeDotMenuItems.push({ | ||
| icon: Expensicons.Checkmark, | ||
| text: props.translate('newTaskPage.markAsIncomplete'), | ||
| onSelected: () => TaskUtils.reopenTask(props.report.reportID, props.report.parentReportID, title), | ||
| onSelected: () => Task.reopenTask(props.report.reportID, props.report.parentReportID, title), | ||
| }); | ||
| } | ||
|
|
||
|
|
@@ -112,12 +110,11 @@ const HeaderView = (props) => { | |
| threeDotMenuItems.push({ | ||
| icon: Expensicons.Trashcan, | ||
| text: props.translate('common.cancel'), | ||
|
|
||
| // Implementing in https://github.com/Expensify/App/issues/16857 | ||
| onSelected: () => {}, | ||
| onSelected: () => Task.cancelTask(props.report.reportID, props.report.parentReportID, props.report.reportName, props.report.stateNum, props.report.statusNum), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We decided to just hide this menu when the task is canceled |
||
| }); | ||
| } | ||
| } | ||
| const shouldShowThreeDotsButton = !!threeDotMenuItems.length; | ||
|
|
||
| const avatarTooltip = isChatRoom ? undefined : _.pluck(displayNamesWithTooltips, 'tooltip'); | ||
| const shouldShowSubscript = isPolicyExpenseChat && !props.report.isOwnPolicyExpenseChat && !ReportUtils.isArchivedRoom(props.report) && !isTaskReport; | ||
|
|
@@ -231,7 +228,11 @@ export default compose( | |
| withOnyx({ | ||
| account: { | ||
| key: ONYXKEYS.ACCOUNT, | ||
| selector: (account) => account && {guideCalendarLink: account.guideCalendarLink}, | ||
| selector: (account) => | ||
| account && { | ||
| guideCalendarLink: account.guideCalendarLink, | ||
| primaryLogin: account.primaryLogin, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason why
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really sure might have just been added in a bad merge. If it isn't being used still I think it's fine to remove |
||
| }, | ||
| }, | ||
| parentReportActions: { | ||
| key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -204,7 +204,7 @@ class ReportActionItem extends Component { | |
| checkIfContextMenuActive={this.checkIfContextMenuActive} | ||
| /> | ||
| ); | ||
| } else if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED) { | ||
| } else if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED || this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.TASKCANCELED) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checkbox should now be disabled when the task is canceled |
||
| children = ( | ||
| <TaskAction | ||
| taskReportID={this.props.action.originalMessage.taskReportID.toString()} | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beep boop 🤖 🐧
This PR caused #21314 (comment)
Because we have a typo-ish here.
The backend uses
TASKCANCELLED(notice the double LL)