Skip to content

Commit

Permalink
Merge pull request #11362 from Expensify/tgolen-reportidstrings-0
Browse files Browse the repository at this point in the history
[No QA] Change reportID type from number to string
  • Loading branch information
danieldoglas authored Sep 29, 2022
2 parents f8a4fa6 + edcf2e2 commit 1ff9206
Show file tree
Hide file tree
Showing 38 changed files with 201 additions and 231 deletions.
6 changes: 2 additions & 4 deletions src/components/ArchivedReportFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import compose from '../libs/compose';
import personalDetailsPropType from '../pages/personalDetailsPropType';
import ONYXKEYS from '../ONYXKEYS';
import * as ReportUtils from '../libs/ReportUtils';
import reportPropTypes from '../pages/reportPropTypes';

const propTypes = {
/** The reason this report was archived */
Expand All @@ -27,10 +28,7 @@ const propTypes = {
}),

/** The archived report */
report: PropTypes.shape({
/** The policy this report is attached to */
policyID: PropTypes.string,
}).isRequired,
report: reportPropTypes.isRequired,

/** Personal details of all users */
personalDetails: PropTypes.objectOf(personalDetailsPropType).isRequired,
Expand Down
18 changes: 2 additions & 16 deletions src/components/IOUBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,11 @@ import compose from '../libs/compose';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import CONST from '../CONST';
import Badge from './Badge';
import iouReportPropTypes from '../pages/iouReportPropTypes';

const propTypes = {
/** IOU Report data object */
iouReport: PropTypes.shape({
/** The report ID of the IOU */
reportID: PropTypes.number,

/** The report ID of the chat associated with the IOU */
chatReportID: PropTypes.number,

/** The total amount in cents */
total: PropTypes.number,

/** The owner of the IOUReport */
ownerEmail: PropTypes.string,

/** The currency of the IOUReport */
currency: PropTypes.string,
}),
iouReport: iouReportPropTypes,

/** Session of currently logged in user */
session: PropTypes.shape({
Expand Down
2 changes: 1 addition & 1 deletion src/components/IOUConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const propTypes = {
keyForList: PropTypes.string,
isPinned: PropTypes.bool,
isUnread: PropTypes.bool,
reportID: PropTypes.number,
reportID: PropTypes.string,
// eslint-disable-next-line react/forbid-prop-types
participantsList: PropTypes.arrayOf(PropTypes.object),
payPalMeAddress: PropTypes.string,
Expand Down
10 changes: 3 additions & 7 deletions src/components/ReportWelcomeText.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import ONYXKEYS from '../ONYXKEYS';
import Navigation from '../libs/Navigation/Navigation';
import ROUTES from '../ROUTES';
import Tooltip from './Tooltip';
import reportPropTypes from '../pages/reportPropTypes';

const personalDetailsPropTypes = PropTypes.shape({
/** The login of the person (either email or phone number) */
Expand All @@ -28,13 +29,7 @@ const personalDetailsPropTypes = PropTypes.shape({

const propTypes = {
/** The report currently being looked at */
report: PropTypes.shape({
/** The id of the report */
reportID: PropTypes.number,

/** The report owner's email */
ownerEmail: PropTypes.string,
}).isRequired,
report: reportPropTypes,

/* Onyx Props */

Expand All @@ -51,6 +46,7 @@ const propTypes = {
};

const defaultProps = {
report: {},
policies: {},
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/optionPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default PropTypes.shape({
login: PropTypes.string,

// reportID (only present when there is a matching report)
reportID: PropTypes.number,
reportID: PropTypes.string,

// Whether the report has read or not
isUnread: PropTypes.bool,
Expand Down
5 changes: 2 additions & 3 deletions src/libs/Navigation/AppNavigator/MainDrawerNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ import ReportScreen from '../../../pages/home/ReportScreen';
import SidebarScreen from '../../../pages/home/sidebar/SidebarScreen';
import BaseDrawerNavigator from './BaseDrawerNavigator';
import * as ReportUtils from '../../ReportUtils';
import reportPropTypes from '../../../pages/reportPropTypes';

const propTypes = {
/** Available reports that would be displayed in this navigator */
reports: PropTypes.objectOf(PropTypes.shape({
reportID: PropTypes.number,
})),
reports: PropTypes.objectOf(reportPropTypes),

/** Beta features list */
betas: PropTypes.arrayOf(PropTypes.string),
Expand Down
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
4 changes: 2 additions & 2 deletions src/libs/ReportActionsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function isConsecutiveActionMadeByPreviousActor(reportActions, actionIndex) {

/**
* Get the message text for the last action that was not deleted
* @param {Number} reportID
* @param {String} reportID
* @param {Object} [actionsToMerge]
* @return {String}
*/
Expand All @@ -120,7 +120,7 @@ function getLastVisibleMessageText(reportID, actionsToMerge = {}) {
}

/**
* @param {Number} reportID
* @param {String} reportID
* @param {Object} [actionsToMerge]
* @param {Number} deletedSequenceNumber
* @param {Number} lastReadSequenceNumber
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
2 changes: 1 addition & 1 deletion src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function buildPayPalPaymentUrl(amount, submitterPayPalMeAddress, currency) {
*
* @param {Object} params
* @param {Number} params.chatReportID
* @param {Number} params.reportID
* @param {String} params.reportID
* @param {String} params.paymentMethodType - one of CONST.IOU.PAYMENT_TYPE
* @param {Number} params.amount
* @param {String} params.currency
Expand Down
Loading

0 comments on commit 1ff9206

Please sign in to comment.