-
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
Reusable function instead of repetitive statements #22649
Changes from 1 commit
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 |
---|---|---|
|
@@ -1585,6 +1585,22 @@ function buildOptimisticReportPreview(chatReport, iouReport) { | |
}; | ||
} | ||
|
||
function updateReportPreview(iouReport, reportPreviewAction) { | ||
const message = getReportPreviewMessage(iouReport, reportPreviewAction); | ||
return { | ||
...reportPreviewAction, | ||
created: DateUtils.getDBTime(), | ||
message: [ | ||
{ | ||
html: message, | ||
text: message, | ||
isEdited: false, | ||
type: CONST.REPORT.MESSAGE.TYPE.COMMENT, | ||
}, | ||
], | ||
Comment on lines
+1800
to
+1807
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. This will re-write existing 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, this is fine. The original code was introduced in the previous PR where we decided to improve the code in this follow-up PR, so we are safe. |
||
}; | ||
} | ||
|
||
function buildOptimisticTaskReportAction(taskReportID, actionName, message = '') { | ||
const originalMessage = { | ||
taskReportID, | ||
|
@@ -2544,6 +2560,7 @@ export { | |
buildOptimisticExpenseReport, | ||
buildOptimisticIOUReportAction, | ||
buildOptimisticReportPreview, | ||
updateReportPreview, | ||
buildOptimisticTaskReportAction, | ||
buildOptimisticAddCommentReportAction, | ||
buildOptimisticTaskCommentReportAction, | ||
|
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.
Missing JSDocs
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.
Good catch! Added for both
buildOptimisticReportPreview
andupdateReportPreview