-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 cannot create task for new user via [] method #41171
Changes from 4 commits
42565a7
f883088
88efa95
cd791c0
cc96f02
44358c5
9d27230
16282bd
8620f63
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 | ||||
---|---|---|---|---|---|---|
|
@@ -3673,6 +3673,30 @@ function setGroupDraft(newGroupDraft: Partial<NewGroupChatDraft>) { | |||||
Onyx.merge(ONYXKEYS.NEW_GROUP_CHAT_DRAFT, newGroupDraft); | ||||||
} | ||||||
|
||||||
function setTaskDataForNewAssingee(assigneeLogin: string, accountID: number | undefined = undefined) { | ||||||
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.
Suggested change
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. Or 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. @s77rt What do you think about 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. Let's not use 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. Thanks, I think 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. @s77rt I updated. |
||||||
const assigneeAccountID = accountID ?? UserUtils.generateAccountID(assigneeLogin); | ||||||
const report: OnyxEntry<Report> | undefined = ReportUtils.buildOptimisticChatReport([assigneeAccountID]); | ||||||
nkdengineer marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
report.isOptimisticReport = true; | ||||||
nkdengineer marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
// When assigning a task to a new user, by default we share the task in their DM | ||||||
// However, the DM doesn't exist yet - and will be created optimistically once the task is created | ||||||
// We don't want to show the new DM yet, because if you select an assignee and then change the assignee, the previous DM will still be shown | ||||||
// So here, we create it optimistically to share it with the assignee, but we have to hide it until the task is created | ||||||
if (report) { | ||||||
report.isHidden = true; | ||||||
} | ||||||
nkdengineer marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report); | ||||||
|
||||||
const optimisticPersonalDetailsListAction = { | ||||||
nkdengineer marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
accountID: assigneeAccountID, | ||||||
avatar: allPersonalDetails?.[assigneeAccountID]?.avatar ?? UserUtils.getDefaultAvatarURL(assigneeAccountID), | ||||||
displayName: allPersonalDetails?.[assigneeAccountID]?.displayName ?? assigneeLogin, | ||||||
login: assigneeLogin, | ||||||
}; | ||||||
Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, {[assigneeAccountID]: optimisticPersonalDetailsListAction}); | ||||||
return {assignee: optimisticPersonalDetailsListAction, assigneeReport: report}; | ||||||
} | ||||||
|
||||||
export { | ||||||
searchInServer, | ||||||
addComment, | ||||||
|
@@ -3753,5 +3777,6 @@ export { | |||||
leaveGroupChat, | ||||||
removeFromGroupChat, | ||||||
updateGroupChatMemberRoles, | ||||||
setTaskDataForNewAssingee, | ||||||
clearAvatarErrors, | ||||||
}; |
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.
Move the function to
src/libs/actions/Task.ts