Fix empty assignee in TaskHeader and update permission to mark Task complete/incomplete/cancel in Task report#20689
Conversation
|
|
||
| // Task is not closed | ||
| if (props.report.stateNum !== CONST.REPORT.STATE_NUM.SUBMITTED && props.report.statusNum !== CONST.REPORT.STATUS.CLOSED) { | ||
| if (props.report.stateNum !== CONST.REPORT.STATE_NUM.SUBMITTED && props.report.statusNum !== CONST.REPORT.STATUS.CLOSED && isTaskAssigneeOrTaskOwner) { |
There was a problem hiding this comment.
I'm not sure this one. Should we allow assignee to cancel the task?
There was a problem hiding this comment.
I think so. If this is a flow we do not want in the future we can create another issue for it. But I believe an assignee should be able to cancel a task.
|
@joelbettner @mollfpr One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
joelbettner
left a comment
There was a problem hiding this comment.
Just a question posted for you so I can make sure I am clear on what is happening...
|
|
||
| useEffect(() => { | ||
| TaskUtils.setTaskReport(props.report); | ||
| Task.setTaskReport(props.report); |
There was a problem hiding this comment.
Not that it is wrong, but can you please explain to me why we are switching from using the TaskUtils method and using the Task method instead?
There was a problem hiding this comment.
I observe from what we did for other features, basically we will have 2 libs:
- an action lib (for example libs/actions/Report.js, libs/actions/ReportActions.js) => we usually put all the function that need to update to Onyx or make API call
- a utils lib (for example libs/ReportUtils.js, libs/ReportActionsUtils.js) => a shared utils like get/set/check
In this PR, I'm going to introduce new module called TaskUtils (and put some new get/set function into there). So I replaced old TaskUtils name (It's actually actions/Task) to Task to avoid confusing in this TaskHeader component.
There was a problem hiding this comment.
btw, I just wanna correct the imported name here
It's importing Task action but named it as TaskUtils. By introducing TaskUtils, I would like to correct it.
If we think it's not correct. I can revert the change (combine new utils TaskUtils into exiting Task action lib)
There was a problem hiding this comment.
@hoangzinh I think we can use actions/Task.js for the new method you introduce; not necessary to create a new utils file for the task. We already have a couple of utils methods in actions/Task.js and we don't want to confuse anyone what the different methods in actions/Task.js and libs/TaskUtils.js.
I believe a method unrelated to API action should be in the utils file, but the damage is already done.
There was a problem hiding this comment.
@mollfpr okay. Let me move into the actions/Task
There was a problem hiding this comment.
I moved all my new methods to actions/Task. Please help me to review this PR again. Thanks ❤️
|
|
||
| // Task is not closed | ||
| if (props.report.stateNum !== CONST.REPORT.STATE_NUM.SUBMITTED && props.report.statusNum !== CONST.REPORT.STATUS.CLOSED) { | ||
| if (props.report.stateNum !== CONST.REPORT.STATE_NUM.SUBMITTED && props.report.statusNum !== CONST.REPORT.STATUS.CLOSED && isTaskAssigneeOrTaskOwner) { |
There was a problem hiding this comment.
I think so. If this is a flow we do not want in the future we can create another issue for it. But I believe an assignee should be able to cancel a task.
Reviewer Checklist
Screenshots/VideosWeb20689.Web.movMobile Web - Chrome20689.mWeb.Chrome.movMobile Web - Safari20689.mWeb.Safari.movDesktop20689.Desktop.moviOS20689.iOS.movAndroid20689.Android.mov |
|
@hoangzinh there are some conflicts. |
| } | ||
|
|
||
| const reportAction = ReportActionsUtils.getParentReportAction(taskReport); | ||
| return lodashGet(reportAction, 'childManagerEmail', null); |
There was a problem hiding this comment.
@mollfpr @joelbettner I just merged latest main to this PR and I realize that we're going to change from "email" -> "accountID" a lot of place.
For "childManagerEmail", do you know when will the BE return "childManagerAccountID"? for reportAction of taskReport? (as we optimistic build from FE side)?
Lines 1239 to 1240 in 7b00c47
Currently, I have a blocker that most of utils (get avatar/display name) is changed to accountID
Line 861 in 7b00c47
So if we only have email, we can not get the display name/avatar.
There was a problem hiding this comment.
nvm, I found a way to get accountID for given login.
|
@mollfpr @joelbettner I merged latest |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/joelbettner in version: 1.3.30-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.30-5 🚀
|
There was a problem hiding this comment.
While merging main, this could have been avoided. String && View is anti-pattern and already in checklist.
verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g.
myBool && <MyComponent />.
| <View style={[styles.flexRow, styles.alignItemsCenter, styles.justifyContentBetween, styles.pv3]}> | ||
| <View style={[styles.flexRow, styles.alignItemsCenter, styles.justifyContentBetween]}> | ||
| {props.report.managerID && props.report.managerID > 0 && ( | ||
| {assigneeAccountID && assigneeAccountID > 0 && ( |
There was a problem hiding this comment.
Coming from #22398:
I understand this logic already existed but we should avoid this pattern and it's already in checklist.
This could have been fixed earlier while merging main.
I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g.
myBool && <MyComponent />.
Details
Fixed Issues
$ #19631
PROPOSAL: #19631 (comment)
Tests
Offline tests
Could not test when offline because B&C won't receive new task
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
Screen.Recording.2023-06-13.at.23.13.27.-.web.mp4
Mobile Web - Chrome
Screen.Recording.2023-06-13.at.23.38.26.-.android.chrome.mp4
Mobile Web - Safari
Screen.Recording.2023-06-14.at.00.08.26.-.ios.safari.mov
Desktop
Screen.Recording.2023-06-13.at.23.25.41.-.desktop.mp4
iOS
Screen.Recording.2023-06-14.at.00.06.17.-.ios.mp4
Android
Screen.Recording.2023-06-13.at.23.49.50.-.android.mp4