-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
fix: task not working in self dm through shortcut #39107
Changes from 2 commits
44d2e1c
a748fbc
e4cd5d2
b68937c
aeeb77b
6e12a35
3cf9606
45d8dd9
cdc9371
282cd58
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 | ||||
---|---|---|---|---|---|---|
|
@@ -653,7 +653,8 @@ function setAssigneeValue(assigneeEmail: string, assigneeAccountID: number, shar | |||||
let chatReport: OnyxEntry<OnyxTypes.Report> = null; | ||||||
|
||||||
if (!isCurrentUser) { | ||||||
chatReport = ReportUtils.getChatByParticipants([assigneeAccountID]); | ||||||
const reportID = shareDestination; | ||||||
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. The param name 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. Yes, it's reportID. Changing that to |
||||||
chatReport = ReportUtils.getChatByReportID(reportID); | ||||||
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. orrr we already load allReports in actions/Task we can just use it here
Suggested change
|
||||||
if (!chatReport) { | ||||||
chatReport = ReportUtils.buildOptimisticChatReport([assigneeAccountID]); | ||||||
chatReport.isOptimisticReport = true; | ||||||
|
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.
I am very confused by this... I think it's doing nothing? ie: if it is null then default to null
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.
why not
allReports[
${ONYXKEYS.COLLECTION.REPORT}${reportID}]
?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.
If it sends null then the existing behaviour create new optimistic report which is expected because there is no report found with that
reportID
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.
@ishpaul777 changing it to your suggestion as it returns in O(1) and works as expected also
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.
I am just curious, why do we need a
reports
param 🤔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.
I copied the above function and forgot to remove the reports param 😅
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.
Actually we already have this utility
https://github.com/Expensify/App/blob/e542ba7c2d9e216c2cd401de0de8ed225fff4a7b/src/libs/ReportUtils.ts#L532C10-L532C19
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.
@ishpaul777 I tested every case where we create task. And in one case the
shareToReportID
is empty:App/src/libs/actions/Task.ts
Line 652 in b68937c
In that case we can use the old existing behaviour. And if
shareToReportID
is available we will get report directly by ID using utility function which is the cases we are solving i.e. selfDMThe code:
App/src/libs/actions/Task.ts
Line 659 in e542ba7
will become:
