Skip to content

Commit

Permalink
Remove a few places where reportID is cast to a string
Browse files Browse the repository at this point in the history
  • Loading branch information
tgolen committed Sep 28, 2022
1 parent 5cabcea commit f60dbb8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ function getOptions(reports, personalDetails, activeReportID, {
const shouldFilterReportIfRead = hideReadReports && !ReportUtils.isUnread(report);
const shouldFilterReport = shouldFilterReportIfEmpty || shouldFilterReportIfRead;

if (report.reportID.toString() !== activeReportID
if (report.reportID !== activeReportID
&& (!report.isPinned || isDefaultRoom)
&& !hasDraftComment
&& shouldFilterReport
Expand Down
9 changes: 3 additions & 6 deletions src/libs/SidebarUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function getOrderedReportIDs() {

const shouldFilterReportIfRead = hideReadReports && !ReportUtils.isUnread(report);
const shouldFilterReport = shouldFilterReportIfEmpty || shouldFilterReportIfRead;
if (report.reportID.toString() !== currentlyViewedReportID
if (report.reportID !== currentlyViewedReportID
&& !report.isPinned
&& !hasDraftComment
&& shouldFilterReport
Expand Down Expand Up @@ -186,7 +186,7 @@ function getOrderedReportIDs() {

// If the active report has a draft, we do not put it in the group of draft reports because we want it to maintain it's current position. Otherwise the report's position
// jumps around in the LHN and it's kind of confusing to the user to see the LHN reorder when they start typing a comment on a report.
} else if (report.hasDraft && report.reportID.toString() !== currentlyViewedReportID) {
} else if (report.hasDraft && report.reportID !== currentlyViewedReportID) {
draftReportOptions.push(report);
} else {
recentReportOptions.push(report);
Expand All @@ -213,10 +213,7 @@ function getOrderedReportIDs() {
});
recentReportOptions = sortedPinnedReports.concat(recentReportOptions);

return _.chain(recentReportOptions)
.pluck('reportID')
.map(reportID => reportID.toString())
.value();
return _.pluck(recentReportOptions, 'reportID');
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ function getSimplifiedReportObject(report) {
]);

return {
// This needs to be cast to a string until the IOU API has been fully migrated to OfflineFirst API
reportID: report.reportID.toString(),
reportName: report.reportName,
chatType,
Expand Down
11 changes: 4 additions & 7 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import toggleReportActionComposeView from '../../../libs/toggleReportActionCompo
import OfflineIndicator from '../../../components/OfflineIndicator';
import ExceededCommentLength from '../../../components/ExceededCommentLength';
import withNavigationFocus from '../../../components/withNavigationFocus';
import reportPropTypes from '../../reportPropTypes';

const propTypes = {
/** Beta features list */
Expand All @@ -69,11 +70,7 @@ const propTypes = {
personalDetails: PropTypes.objectOf(participantPropTypes),

/** The report currently being looked at */
report: PropTypes.shape({

/** participants associated with current report */
participants: PropTypes.arrayOf(PropTypes.string),
}),
report: reportPropTypes,

/** Array of report actions for this report */
reportActions: PropTypes.objectOf(PropTypes.shape(reportActionPropTypes)),
Expand Down Expand Up @@ -387,12 +384,12 @@ class ReportActionCompose extends React.Component {

// Indicate that draft has been created.
if (this.comment.length === 0 && newComment.length !== 0) {
Report.setReportWithDraft(this.props.reportID.toString(), true);
Report.setReportWithDraft(this.props.reportID, true);
}

// The draft has been deleted.
if (newComment.length === 0) {
Report.setReportWithDraft(this.props.reportID.toString(), false);
Report.setReportWithDraft(this.props.reportID, false);
}

this.comment = newComment;
Expand Down

0 comments on commit f60dbb8

Please sign in to comment.