Skip to content
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

Remove remaining uses of report.ownerEmail #30914

Merged
merged 5 commits into from
Nov 10, 2023
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
1 change: 0 additions & 1 deletion src/components/MoneyRequestHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ function MoneyRequestHeader({session, parentReport, report, parentReportAction,
report={{
...report,
ownerAccountID: lodashGet(parentReport, 'ownerAccountID', null),
ownerEmail: lodashGet(parentReport, 'ownerEmail', null),
}}
policy={policy}
personalDetails={personalDetails}
Expand Down
2 changes: 0 additions & 2 deletions src/libs/E2E/apiMocks/openReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export default () => ({
reportName: 'Chat Report',
type: 'chat',
chatType: '',
ownerEmail: '__fake__',
ownerAccountID: 0,
managerEmail: '__fake__',
managerID: 0,
policyID: '_FAKE_',
participantAccountIDs: [14567013],
Expand Down
2 changes: 1 addition & 1 deletion src/libs/PersonalDetailsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Onyx.connect({
* @param {String} [defaultValue] optional default display name value
* @returns {String}
*/
function getDisplayNameOrDefault(passedPersonalDetails, pathToDisplayName, defaultValue) {
function getDisplayNameOrDefault(passedPersonalDetails, pathToDisplayName, defaultValue = '') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change was just to fix a lint issue

const displayName = lodashGet(passedPersonalDetails, pathToDisplayName);

return displayName || defaultValue || Localize.translateLocal('common.hidden');
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ function isCurrentUserSubmitter(reportID) {
return false;
}
const report = allReports[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`] || {};
return report && report.ownerEmail === currentUserEmail;
return report && report.ownerAccountID === currentUserAccountID;
}

/**
Expand Down
5 changes: 1 addition & 4 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -2711,10 +2711,7 @@ function submitReport(expenseReport) {
* @param {String} reimbursementBankAccountState
*/
function payMoneyRequest(paymentType, chatReport, iouReport) {
const recipient = {
login: iouReport.ownerEmail,
accountID: iouReport.ownerAccountID,
};
const recipient = {accountID: iouReport.ownerAccountID};
const {params, optimisticData, successData, failureData} = getPayMoneyRequestParams(chatReport, iouReport, recipient, paymentType);

// For now we need to call the PayMoneyRequestWithWallet API since PayMoneyRequest was not updated to work with
Expand Down
6 changes: 3 additions & 3 deletions src/libs/actions/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ function deleteWorkspace(policyID, reports, policyName) {
// Add closed actions to all chat reports linked to this policy
..._.map(reports, ({reportID, ownerAccountID}) => {
// Announce & admin chats have FAKE owners, but workspace chats w/ users do have owners.
let reportOwnerEmail = CONST.POLICY.OWNER_EMAIL_FAKE;
let emailClosingReport = CONST.POLICY.OWNER_EMAIL_FAKE;
if (ownerAccountID !== CONST.POLICY.OWNER_ACCOUNT_ID_FAKE) {
reportOwnerEmail = lodashGet(allPersonalDetails, [ownerAccountID, 'login'], '');
emailClosingReport = lodashGet(allPersonalDetails, [ownerAccountID, 'login'], '');
}
const optimisticClosedReportAction = ReportUtils.buildOptimisticClosedReportAction(reportOwnerEmail, policyName, CONST.REPORT.ARCHIVE_REASON.POLICY_DELETED);
const optimisticClosedReportAction = ReportUtils.buildOptimisticClosedReportAction(emailClosingReport, policyName, CONST.REPORT.ARCHIVE_REASON.POLICY_DELETED);
const optimisticReportActions = {};
optimisticReportActions[optimisticClosedReportAction.reportActionID] = optimisticClosedReportAction;
return {
Expand Down
6 changes: 3 additions & 3 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,11 @@ function openReport(reportID, participantLoginList = [], newReportObject = {}, p
isOptimisticReport: true,
};

let reportOwnerEmail = CONST.REPORT.OWNER_EMAIL_FAKE;
let emailCreatingAction = CONST.REPORT.OWNER_EMAIL_FAKE;
if (newReportObject.ownerAccountID && newReportObject.ownerAccountID !== CONST.REPORT.OWNER_ACCOUNT_ID_FAKE) {
reportOwnerEmail = lodashGet(allPersonalDetails, [newReportObject.ownerAccountID, 'login'], '');
emailCreatingAction = lodashGet(allPersonalDetails, [newReportObject.ownerAccountID, 'login'], '');
}
const optimisticCreatedAction = ReportUtils.buildOptimisticCreatedReportAction(reportOwnerEmail);
const optimisticCreatedAction = ReportUtils.buildOptimisticCreatedReportAction(emailCreatingAction);
onyxData.optimisticData.push({
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ function ReportActionItem(props) {
</ShowContextMenuContext.Provider>
);
} else if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENTQUEUED) {
const submitterDisplayName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails, [props.report.ownerAccountID, 'displayName'], props.report.ownerEmail);
const submitterDisplayName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails, [props.report.ownerAccountID, 'displayName']);
const paymentType = lodashGet(props.action, 'originalMessage.paymentType', '');

const isSubmitterOfUnsettledReport = ReportUtils.isCurrentUserSubmitter(props.report.reportID) && !ReportUtils.isSettled(props.report.reportID);
Expand Down
3 changes: 0 additions & 3 deletions src/types/onyx/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ type Report = {
/** The policy name to use for an archived report */
oldPolicyName?: string;

/** The email address of the report owner */
ownerEmail?: string;

/** Linked policy's ID */
policyID?: string;

Expand Down