-
Notifications
You must be signed in to change notification settings - Fork 3k
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
CancelTask frontend #18747
Changes from 14 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,6 +26,7 @@ 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'; | ||
|
||
const propTypes = { | ||
|
@@ -115,9 +116,15 @@ 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.stateNum, | ||
props.report.statusNum, | ||
props.account.primaryLogin, | ||
props.translate('task.canceled'), | ||
), | ||
}); | ||
} | ||
} | ||
|
@@ -234,7 +241,11 @@ export default compose( | |
withOnyx({ | ||
account: { | ||
key: ONYXKEYS.ACCOUNT, | ||
selector: (account) => account && {guideCalendarLink: account.guideCalendarLink}, | ||
selector: (account) => | ||
account && { | ||
guideCalendarLink: account.guideCalendarLink, | ||
primaryLogin: account.primaryLogin, | ||
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 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import isReportMessageAttachment from '../../src/libs/isReportMessageAttachment'; | ||
|
||
describe('isReportMessageAttachment', () => { | ||
it('returns true if a report action is attachment', () => { | ||
const message = { | ||
text: '[Attachment]', | ||
html: '<img src="https://www.expensify.com/chat-attachments/1260926113061804740/w_66791ca35b3c34c2a0eda4d065d97c9907cadd61.jpg.1024.jpg" data-expensify-source="https://www.expensify.com/chat-attachments/1260926113061804740/w_66791ca35b3c34c2a0eda4d065d97c9907cadd61.jpg" data-name="rn_image_picker_lib_temp_636b71a8-18fd-41a1-9725-6587ffb207a7.jpg" data-expensify-width="4000" data-expensify-height="3000" />', | ||
}; | ||
expect(isReportMessageAttachment(message)).toBe(true); | ||
}); | ||
|
||
it('returns false if a report action is not attachment', () => { | ||
let message = {text: '[Attachment]', html: '<em>[Attachment]</em>'}; | ||
expect(isReportMessageAttachment(message)).toBe(false); | ||
|
||
message = {text: '[Attachment]', html: '<a href="https://www.google.com" target="_blank" rel="noreferrer noopener">[Attachment]</a>'}; | ||
expect(isReportMessageAttachment(message)).toBe(false); | ||
|
||
message = {text: '[Attachment]', html: '<a href="https://www.google.com/?data-expensify-source=" target="_blank" rel="noreferrer noopener">[Attachment]</a>'}; | ||
expect(isReportMessageAttachment(message)).toBe(false); | ||
}); | ||
}); |
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)