Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/ArchivedReportFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const defaultProps = {

function ArchivedReportFooter(props) {
const archiveReason = lodashGet(props.reportClosedAction, 'originalMessage.reason', CONST.REPORT.ARCHIVE_REASON.DEFAULT);
let displayName = PersonalDetailsUtils.getDisplayNameOrDefault(props.personalDetails, [props.report.ownerAccountID, 'displayName'], props.report.ownerEmail);
let displayName = PersonalDetailsUtils.getDisplayNameOrDefault(props.personalDetails, [props.report.ownerAccountID, 'displayName']);

let oldDisplayName;
if (archiveReason === CONST.REPORT.ARCHIVE_REASON.ACCOUNT_MERGED) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/OptionRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class OptionRow extends Component {
this.props.option.descriptiveText !== nextProps.option.descriptiveText ||
this.props.option.brickRoadIndicator !== nextProps.option.brickRoadIndicator ||
this.props.option.shouldShowSubscript !== nextProps.option.shouldShowSubscript ||
this.props.option.ownerEmail !== nextProps.option.ownerEmail ||
this.props.option.ownerAccountID !== nextProps.option.ownerAccountID ||
this.props.option.subtitle !== nextProps.option.subtitle ||
this.props.option.pendingAction !== nextProps.option.pendingAction ||
this.props.option.customIcon !== nextProps.option.customIcon
Expand Down
3 changes: 0 additions & 3 deletions src/components/ReportActionItem/IOUPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ const propTypes = {
/** Account ID of the manager in this iou report */
managerID: PropTypes.number,

/** Email address of the creator of this iou report */
ownerEmail: PropTypes.string,

/** Account ID of the creator of this iou report */
ownerAccountID: PropTypes.number,

Expand Down
4 changes: 2 additions & 2 deletions src/components/ReportActionItem/ReportPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ const propTypes = {
/** Email address of the manager in this iou report */
managerEmail: PropTypes.string,

/** Email address of the creator of this iou report */
ownerEmail: PropTypes.string,
/** AccountID of the creator of this iou report */
ownerAccountID: PropTypes.number,

/** Outstanding amount in cents of this transaction */
total: PropTypes.number,
Expand Down
4 changes: 2 additions & 2 deletions src/components/ReportActionItem/TaskAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const propTypes = {
/** Email address of the manager in this iou report */
managerEmail: PropTypes.string,

/** Email address of the creator of this iou report */
ownerEmail: PropTypes.string,
/** AccountID of the creator of this iou report */
ownerAccountID: PropTypes.number,
}),

...withLocalizePropTypes,
Expand Down
4 changes: 2 additions & 2 deletions src/components/ReportActionItem/TaskPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ const propTypes = {
/** Email address of the manager in this iou report */
managerEmail: PropTypes.string,

/** Email address of the creator of this iou report */
ownerEmail: PropTypes.string,
/** AccountID of the creator of this iou report */
ownerAccountID: PropTypes.number,
}),

...withLocalizePropTypes,
Expand Down
5 changes: 3 additions & 2 deletions src/components/ReportWelcomeText.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ function ReportWelcomeText(props) {
<>
<Text>{props.translate('reportActionsView.beginningOfChatHistoryPolicyExpenseChatPartOne')}</Text>
<Text style={[styles.textStrong]}>
{/* Use the policyExpenseChat owner's first name or their email if it's undefined or an empty string */}
{lodashGet(props.personalDetails, [props.report.ownerAccountID, 'firstName']) || props.report.ownerEmail}
{/* Use the policyExpenseChat owner's first name or their display name if it's undefined or an empty string */}
{lodashGet(props.personalDetails, [props.report.ownerAccountID, 'firstName']) ||
lodashGet(props.personalDetails, [props.report.ownerAccountID, 'displayName'], '')}
</Text>
<Text>{props.translate('reportActionsView.beginningOfChatHistoryPolicyExpenseChatPartTwo')}</Text>
<Text style={[styles.textStrong]}>{ReportUtils.getPolicyName(props.report)}</Text>
Expand Down
54 changes: 27 additions & 27 deletions src/libs/E2E/apiMocks/openApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,7 @@ export default () => ({
reportID: '98258097',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: ['concierge@expensify.com'],
isPinned: true,
Expand All @@ -1599,7 +1599,7 @@ export default () => ({
reportID: '98258458',
reportName: '',
chatType: 'policyExpenseChat',
ownerEmail: 'applausetester+perf2@applause.expensifail.com',
ownerAccountID: 17,
policyID: 'C28C2634DD7226B8',
participants: ['applausetester@applause.expensifail.com', 'applausetester+perf2@applause.expensifail.com'],
isPinned: false,
Expand All @@ -1621,7 +1621,7 @@ export default () => ({
reportID: '98344717',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: ['applausetester+ihchat4@applause.expensifail.com'],
isPinned: false,
Expand All @@ -1643,7 +1643,7 @@ export default () => ({
reportID: '98345050',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: ['fake3@gmail.com'],
isPinned: false,
Expand All @@ -1665,7 +1665,7 @@ export default () => ({
reportID: '98345315',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: ['fake3@gmail.com', 'fake6@gmail.com', 'fake7@gmail.com', 'fake8@gmail.com'],
isPinned: false,
Expand All @@ -1687,7 +1687,7 @@ export default () => ({
reportID: '98345625',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: ['fake1@gmail.com', 'fake2@gmail.com', 'fake3@gmail.com', 'fake4@gmail.com', 'fake5@gmail.com', 'fake6@gmail.com', 'fake7@gmail.com', 'fake8@gmail.com'],
isPinned: false,
Expand All @@ -1709,7 +1709,7 @@ export default () => ({
reportID: '98345679',
reportName: '',
chatType: 'policyExpenseChat',
ownerEmail: 'applausetester+perf2@applause.expensifail.com',
ownerAccountID: 17,
policyID: '1CE001C4B9F3CA54',
participants: ['fake3@gmail.com', 'applausetester+perf2@applause.expensifail.com'],
isPinned: false,
Expand All @@ -1731,7 +1731,7 @@ export default () => ({
reportID: '98414813',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: ['applausetester+ihchat4@applause.expensifail.com', 'fake6@gmail.com'],
isPinned: false,
Expand All @@ -1753,7 +1753,7 @@ export default () => ({
reportID: '98817646',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: ['fake6@gmail.com'],
isPinned: false,
Expand All @@ -1776,7 +1776,7 @@ export default () => ({
reportID: '358751490033727',
reportName: '#digimobileroom',
chatType: 'policyRoom',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: 'C28C2634DD7226B8',
participants: ['applausetester+pd1005@applause.expensifail.com'],
isPinned: false,
Expand All @@ -1798,7 +1798,7 @@ export default () => ({
reportID: '663424408122117',
reportName: '#announce',
chatType: 'policyAnnounce',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: 'A6511FF8D2EE7661',
participants: ['applausetester+perf2@applause.expensifail.com'],
isPinned: false,
Expand All @@ -1820,7 +1820,7 @@ export default () => ({
reportID: '944123936554214',
reportName: '',
chatType: 'policyExpenseChat',
ownerEmail: 'applausetester+perf2@applause.expensifail.com',
ownerAccountID: 17,
policyID: 'A6511FF8D2EE7661',
participants: ['applausetester+perf2@applause.expensifail.com'],
isPinned: false,
Expand All @@ -1842,7 +1842,7 @@ export default () => ({
reportID: '2242399088152511',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: [
'concierge@expensify.com',
Expand Down Expand Up @@ -1870,7 +1870,7 @@ export default () => ({
reportID: '2576922422943214',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: ['applausetester+42222abb@applause.expensifail.com'],
isPinned: false,
Expand All @@ -1892,7 +1892,7 @@ export default () => ({
reportID: '2752461403207161',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: ['fake1@gmail.com'],
isPinned: false,
Expand All @@ -1914,7 +1914,7 @@ export default () => ({
reportID: '3785654888638968',
reportName: '#jack',
chatType: 'policyRoom',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: 'C28C2634DD7226B8',
participants: ['applausetester+pd1005@applause.expensifail.com'],
isPinned: false,
Expand All @@ -1936,7 +1936,7 @@ export default () => ({
reportID: '4867098979334014',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: ['christoph+hightraffic@margelo.io'],
isPinned: false,
Expand All @@ -1959,7 +1959,7 @@ export default () => ({
reportID: '5277760851229035',
reportName: '#kasper_tha_cat',
chatType: 'policyRoom',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: 'C28C2634DD7226B8',
participants: ['applausetester+pd1005@applause.expensifail.com'],
isPinned: false,
Expand All @@ -1983,7 +1983,7 @@ export default () => ({
reportID: '5324367938904284',
reportName: '#applause.expensifail.com',
chatType: 'domainAll',
ownerEmail: '+@applause.expensifail.com',
ownerAccountID: 99,
policyID: '_FAKE_',
participants: ['applausetester+bernardo@applause.expensifail.com'],
isPinned: false,
Expand All @@ -2005,7 +2005,7 @@ export default () => ({
reportID: '5654270288238256',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: [
'andreylazutkinutest@gmail.com',
Expand Down Expand Up @@ -2036,7 +2036,7 @@ export default () => ({
reportID: '6194900075541844',
reportName: '#admins',
chatType: 'policyAdmins',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: 'A6511FF8D2EE7661',
participants: ['applausetester+perf2@applause.expensifail.com'],
isPinned: false,
Expand All @@ -2058,7 +2058,7 @@ export default () => ({
reportID: '6801643744224146',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: [
'concierge@expensify.com',
Expand Down Expand Up @@ -2090,7 +2090,7 @@ export default () => ({
reportID: '7658708888047100',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: [
'concierge@expensify.com',
Expand Down Expand Up @@ -2119,7 +2119,7 @@ export default () => ({
reportID: '7756405299640824',
reportName: '#jackd23',
chatType: 'policyRoom',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: 'C28C2634DD7226B8',
participants: ['applausetester+pd1005@applause.expensifail.com'],
isPinned: false,
Expand All @@ -2141,7 +2141,7 @@ export default () => ({
reportID: '7819732651025410',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: ['fake5@gmail.com'],
isPinned: false,
Expand All @@ -2161,7 +2161,7 @@ export default () => ({
},
report_2543745284790730: {
reportID: '2543745284790730',
ownerEmail: 'applausetester+perf2@applause.expensifail.com',
ownerAccountID: 17,
managerEmail: 'fake6@gmail.com',
currency: 'USD',
chatReportID: '98817646',
Expand All @@ -2174,7 +2174,7 @@ export default () => ({
},
report_4249286573496381: {
reportID: '4249286573496381',
ownerEmail: 'applausetester+perf2@applause.expensifail.com',
ownerAccountID: 17,
managerEmail: 'christoph+hightraffic@margelo.io',
currency: 'USD',
chatReportID: '4867098979334014',
Expand Down
2 changes: 1 addition & 1 deletion src/libs/E2E/apiMocks/openReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default () => ({
reportID: '98345625',
reportName: 'Chat Report',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
policyID: '_FAKE_',
participants: ['fake1@gmail.com', 'fake2@gmail.com', 'fake3@gmail.com', 'fake4@gmail.com', 'fake5@gmail.com', 'fake6@gmail.com', 'fake7@gmail.com', 'fake8@gmail.com'],
isPinned: false,
Expand Down
6 changes: 2 additions & 4 deletions src/libs/IOUUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function calculateAmount(numberOfParticipants, total, isDefaultUser = false) {
/**
* The owner of the IOU report is the account who is owed money and the manager is the one who owes money!
* In case the owner/manager swap, we need to update the owner of the IOU report and the report total, since it is always positive.
* For example: if user1 owes user2 $10, then we have: {ownerEmail: user2, managerEmail: user1, total: $10 (a positive amount, owed to user2)}
* If user1 requests $17 from user2, then we have: {ownerEmail: user1, managerEmail: user2, total: $7 (still a positive amount, but now owed to user1)}
* For example: if user1 owes user2 $10, then we have: {ownerAccountID: user2, managerEmail: user1, total: $10 (a positive amount, owed to user2)}
* If user1 requests $17 from user2, then we have: {ownerAccountID: user1, managerEmail: user2, total: $7 (still a positive amount, but now owed to user1)}
*
* @param {Object} iouReport
* @param {Number} actorAccountID
Expand All @@ -53,8 +53,6 @@ function updateIOUOwnerAndTotal(iouReport, actorAccountID, amount, currency, typ
// The total sign has changed and hence we need to flip the manager and owner of the report.
iouReportUpdate.ownerAccountID = iouReport.managerID;
iouReportUpdate.managerID = iouReport.ownerAccountID;
iouReportUpdate.ownerEmail = iouReport.managerEmail;
iouReportUpdate.managerEmail = iouReport.ownerEmail;
iouReportUpdate.total = -iouReportUpdate.total;
}

Expand Down
8 changes: 4 additions & 4 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const iouReports = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
callback: (report, key) => {
if (!report || !key || !report.ownerEmail) {
if (!report || !key || !_.isNumber(report.ownerAccountID)) {
return;
}

Expand Down Expand Up @@ -423,7 +423,7 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, {
brickRoadIndicator: null,
icons: null,
tooltipText: null,
ownerEmail: null,
ownerAccountID: null,
subtitle: null,
participantsList: null,
accountID: 0,
Expand Down Expand Up @@ -469,7 +469,7 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, {
result.allReportErrors = getAllReportErrors(report, reportActions);
result.brickRoadIndicator = !_.isEmpty(result.allReportErrors) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : '';
result.pendingAction = report.pendingFields ? report.pendingFields.addWorkspaceRoom || report.pendingFields.createChat : null;
result.ownerEmail = report.ownerEmail;
result.ownerAccountID = report.ownerAccountID;
result.reportID = report.reportID;
result.isUnread = ReportUtils.isUnread(report);
result.hasDraftComment = report.hasDraft;
Expand Down Expand Up @@ -718,7 +718,7 @@ function getOptions(
}

const isCurrentUserOwnedPolicyExpenseChatThatCouldShow =
reportOption.isPolicyExpenseChat && reportOption.ownerEmail === currentUserLogin && includeOwnedWorkspaceChats && !reportOption.isArchivedRoom;
reportOption.isPolicyExpenseChat && reportOption.ownerAccountID === currentUserAccountID && includeOwnedWorkspaceChats && !reportOption.isArchivedRoom;

// Skip if we aren't including multiple participant reports and this report has multiple participants
if (!isCurrentUserOwnedPolicyExpenseChatThatCouldShow && !includeMultipleParticipantReports && !reportOption.login) {
Expand Down
Loading