Skip to content

Commit

Permalink
Merge pull request #19868 from AngelNBazan/main
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Mechler authored May 31, 2023
2 parents b9c6557 + 4c30363 commit 0d1995a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
3 changes: 1 addition & 2 deletions src/components/ReportActionItem/IOUPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import lodashGet from 'lodash/get';
import _ from 'underscore';
import Str from 'expensify-common/lib/str';
import compose from '../../libs/compose';
import styles from '../../styles/styles';
import ONYXKEYS from '../../ONYXKEYS';
Expand Down Expand Up @@ -141,7 +140,7 @@ const IOUPreview = (props) => {

const requestAmount = moneyRequestAction.amount;
const requestCurrency = moneyRequestAction.currency;
const requestComment = Str.htmlDecode(moneyRequestAction.comment).trim();
const requestComment = moneyRequestAction.comment.trim();

const getSettledMessage = () => {
switch (lodashGet(props.action, 'originalMessage.paymentType', '')) {
Expand Down
11 changes: 4 additions & 7 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ function getIOUReportActionMessage(type, total, comment, currency, paymentType =

return [
{
html: getParsedComment(iouMessage),
html: iouMessage,
text: iouMessage,
isEdited: false,
type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
Expand All @@ -1294,13 +1294,10 @@ function getIOUReportActionMessage(type, total, comment, currency, paymentType =
*/
function buildOptimisticIOUReportAction(type, amount, currency, comment, participants, transactionID, paymentType = '', iouReportID = '', isSettlingUp = false, isSendMoneyFlow = false) {
const IOUReportID = iouReportID || generateReportID();
const parser = new ExpensiMark();
const commentText = getParsedComment(comment);
const textForNewComment = parser.htmlToText(commentText);
const textForNewCommentDecoded = Str.htmlDecode(textForNewComment);

const originalMessage = {
amount,
comment: textForNewComment,
comment,
currency,
IOUTransactionID: transactionID,
IOUReportID,
Expand Down Expand Up @@ -1330,7 +1327,7 @@ function buildOptimisticIOUReportAction(type, amount, currency, comment, partici
avatar: lodashGet(currentUserPersonalDetails, 'avatar', UserUtils.getDefaultAvatar(currentUserEmail)),
isAttachment: false,
originalMessage,
message: getIOUReportActionMessage(type, amount, textForNewCommentDecoded, currency, paymentType, isSettlingUp),
message: getIOUReportActionMessage(type, amount, comment, currency, paymentType, isSettlingUp),
person: [
{
style: 'strong',
Expand Down
12 changes: 4 additions & 8 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,13 @@ function requestMoney(report, amount, currency, payeeEmail, participant, comment
);

// STEP 6: Make the request
const parsedComment = ReportUtils.getParsedComment(comment);
API.write(
'RequestMoney',
{
debtorEmail: payerEmail,
amount,
currency,
comment: parsedComment,
comment,
iouReportID: iouReport.reportID,
chatReportID: chatReport.reportID,
transactionID: optimisticTransaction.transactionID,
Expand Down Expand Up @@ -628,7 +627,6 @@ function createSplitsAndOnyxData(participants, currentUserLogin, amount, comment
*/
function splitBill(participants, currentUserLogin, amount, comment, currency, existingGroupChatReportID = '') {
const {groupData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, amount, comment, currency, existingGroupChatReportID);
const parsedComment = ReportUtils.getParsedComment(comment);

API.write(
'SplitBill',
Expand All @@ -637,7 +635,7 @@ function splitBill(participants, currentUserLogin, amount, comment, currency, ex
amount,
splits: JSON.stringify(splits),
currency,
comment: parsedComment,
comment,
transactionID: groupData.transactionID,
reportActionID: groupData.reportActionID,
createdReportActionID: groupData.createdReportActionID,
Expand All @@ -657,7 +655,6 @@ function splitBill(participants, currentUserLogin, amount, comment, currency, ex
*/
function splitBillAndOpenReport(participants, currentUserLogin, amount, comment, currency) {
const {groupData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, amount, comment, currency);
const parsedComment = ReportUtils.getParsedComment(comment);

API.write(
'SplitBillAndOpenReport',
Expand All @@ -666,7 +663,7 @@ function splitBillAndOpenReport(participants, currentUserLogin, amount, comment,
amount,
splits: JSON.stringify(splits),
currency,
comment: parsedComment,
comment,
transactionID: groupData.transactionID,
reportActionID: groupData.reportActionID,
createdReportActionID: groupData.createdReportActionID,
Expand Down Expand Up @@ -825,12 +822,11 @@ function buildPayPalPaymentUrl(amount, submitterPayPalMeAddress, currency) {
*/
function getSendMoneyParams(report, amount, currency, comment, paymentMethodType, managerEmail, recipient) {
const recipientEmail = OptionsListUtils.addSMSDomainIfPhoneNumber(recipient.login);
const parsedComment = ReportUtils.getParsedComment(comment);
const newIOUReportDetails = JSON.stringify({
amount,
currency,
requestorEmail: recipientEmail,
comment: parsedComment,
comment,
idempotencyKey: Str.guid(),
});

Expand Down

0 comments on commit 0d1995a

Please sign in to comment.