diff --git a/android/app/build.gradle b/android/app/build.gradle
index 712213d87aaa..1b145c90653d 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -106,8 +106,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
- versionCode 1001031406
- versionName "1.3.14-6"
+ versionCode 1001031407
+ versionName "1.3.14-7"
}
splits {
diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist
index d10d85866d13..70f154f8bec3 100644
--- a/ios/NewExpensify/Info.plist
+++ b/ios/NewExpensify/Info.plist
@@ -30,7 +30,7 @@
CFBundleVersion
- 1.3.14.6
+ 1.3.14.7
ITSAppUsesNonExemptEncryption
LSApplicationQueriesSchemes
diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist
index 1f6d22b2790b..6e5de935fad8 100644
--- a/ios/NewExpensifyTests/Info.plist
+++ b/ios/NewExpensifyTests/Info.plist
@@ -19,6 +19,6 @@
CFBundleSignature
????
CFBundleVersion
- 1.3.14.6
+ 1.3.14.7
diff --git a/package-lock.json b/package-lock.json
index 92d909efedf4..e79b8a9c47c9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "new.expensify",
- "version": "1.3.14-6",
+ "version": "1.3.14-7",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "new.expensify",
- "version": "1.3.14-6",
+ "version": "1.3.14-7",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
diff --git a/package.json b/package.json
index c8f8c7c0802b..0f2d1a3adba3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
- "version": "1.3.14-6",
+ "version": "1.3.14-7",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
diff --git a/src/languages/en.js b/src/languages/en.js
index f9d9eaf23826..c5060da2d03b 100755
--- a/src/languages/en.js
+++ b/src/languages/en.js
@@ -1,5 +1,6 @@
import {CONST as COMMON_CONST} from 'expensify-common/lib/CONST';
import CONST from '../CONST';
+import * as ReportActionsUtils from '../libs/ReportActionsUtils';
/* eslint-disable max-len */
export default {
@@ -253,8 +254,8 @@ export default {
copyEmailToClipboard: 'Copy email to clipboard',
markAsUnread: 'Mark as unread',
editComment: 'Edit comment',
- deleteComment: 'Delete comment',
- deleteConfirmation: 'Are you sure you want to delete this comment?',
+ deleteAction: ({action}) => `Delete ${ReportActionsUtils.isMoneyRequestAction(action) ? 'request' : 'comment'}`,
+ deleteConfirmation: ({action}) => `Are you sure you want to delete this ${ReportActionsUtils.isMoneyRequestAction(action) ? 'request' : 'comment'}?`,
onlyVisible: 'Only visible to',
replyInThread: 'Reply in thread',
},
diff --git a/src/languages/es.js b/src/languages/es.js
index 23114b5bc428..53c8043e4fa0 100644
--- a/src/languages/es.js
+++ b/src/languages/es.js
@@ -1,4 +1,5 @@
import CONST from '../CONST';
+import * as ReportActionsUtils from '../libs/ReportActionsUtils';
/* eslint-disable max-len */
export default {
@@ -252,8 +253,8 @@ export default {
copyEmailToClipboard: 'Copiar email al portapapeles',
markAsUnread: 'Marcar como no leído',
editComment: 'Editar comentario',
- deleteComment: 'Eliminar comentario',
- deleteConfirmation: '¿Estás seguro de que quieres eliminar este comentario?',
+ deleteAction: ({action}) => `Eliminar ${ReportActionsUtils.isMoneyRequestAction(action) ? 'pedido' : 'comentario'}`,
+ deleteConfirmation: ({action}) => `¿Estás seguro de que quieres eliminar este ${ReportActionsUtils.isMoneyRequestAction(action) ? 'pedido' : 'comentario'}`,
onlyVisible: 'Visible sólo para',
replyInThread: 'Responder en el hilo',
},
diff --git a/src/libs/IOUUtils.js b/src/libs/IOUUtils.js
index f5ebefbad50c..7224e63f31e0 100644
--- a/src/libs/IOUUtils.js
+++ b/src/libs/IOUUtils.js
@@ -1,5 +1,6 @@
import _ from 'underscore';
import CONST from '../CONST';
+import * as ReportActionsUtils from './ReportActionsUtils';
/**
* Calculates the amount per user given a list of participants
@@ -74,7 +75,7 @@ function updateIOUOwnerAndTotal(iouReport, actorEmail, amount, currency, type =
*/
function getIOUReportActions(reportActions, iouReport, type = '', pendingAction = '', filterRequestsInDifferentCurrency = false) {
return _.chain(reportActions)
- .filter((action) => action.originalMessage && action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && (!_.isEmpty(type) ? action.originalMessage.type === type : true))
+ .filter((action) => action.originalMessage && ReportActionsUtils.isMoneyRequestAction(action) && (!_.isEmpty(type) ? action.originalMessage.type === type : true))
.filter((action) => action.originalMessage.IOUReportID.toString() === iouReport.reportID.toString())
.filter((action) => (!_.isEmpty(pendingAction) ? action.pendingAction === pendingAction : true))
.filter((action) => (filterRequestsInDifferentCurrency ? action.originalMessage.currency !== iouReport.currency : true))
diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js
index 558afca9904e..098282639975 100644
--- a/src/libs/ReportActionsUtils.js
+++ b/src/libs/ReportActionsUtils.js
@@ -40,6 +40,14 @@ function isDeletedAction(reportAction) {
return message.length === 0 || lodashGet(message, [0, 'html']) === '';
}
+/**
+ * @param {Object} reportAction
+ * @returns {Boolean}
+ */
+function isMoneyRequestAction(reportAction) {
+ return lodashGet(reportAction, 'actionName', '') === CONST.REPORT.ACTIONS.TYPE.IOU;
+}
+
/**
* Returns the parentReportAction if the given report is a thread.
*
@@ -332,6 +340,7 @@ export {
getSortedReportActionsForDisplay,
getLastClosedReportAction,
getLatestReportActionFromOnyxData,
+ isMoneyRequestAction,
getLinkedTransactionID,
isCreatedTaskReportAction,
getParentReportAction,
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 8fa24c8fb75c..11979433607a 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -184,6 +184,8 @@ function canEditReportAction(reportAction) {
}
/**
+ * Whether the Money Request report is settled
+ *
* @param {String} reportID
* @returns {Boolean}
*/
@@ -192,7 +194,7 @@ function isSettled(reportID) {
}
/**
- * Can only delete if it's an ADDCOMMENT, the author is this user.
+ * Can only delete if the author is this user and the action is an ADDCOMMENT action or an IOU action in an unsettled report
*
* @param {Object} reportAction
* @returns {Boolean}
@@ -200,8 +202,8 @@ function isSettled(reportID) {
function canDeleteReportAction(reportAction) {
return (
reportAction.actorEmail === sessionEmail &&
- reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT &&
- !ReportActionsUtils.isCreatedTaskReportAction(reportAction) &&
+ ((reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT && !ReportActionsUtils.isCreatedTaskReportAction(reportAction)) ||
+ (ReportActionsUtils.isMoneyRequestAction(reportAction) && !isSettled(reportAction.originalMessage.IOUReportID))) &&
reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE
);
}
diff --git a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js
index 8467cc574370..d307d06b7984 100755
--- a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js
+++ b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js
@@ -90,7 +90,7 @@ class BaseReportActionContextMenu extends React.Component {
return (
{},
},
{
- textTranslateKey: 'reportActionContextMenu.deleteComment',
+ textTranslateKey: 'reportActionContextMenu.deleteAction',
icon: Expensicons.Trashcan,
shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget, isChronosReport) =>
// Until deleting parent threads is supported in FE, we will prevent the user from deleting a thread parent
diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js
index 708e534d71c8..dfdf559e79c7 100644
--- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js
+++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js
@@ -8,6 +8,8 @@ import PopoverWithMeasuredContent from '../../../../components/PopoverWithMeasur
import BaseReportActionContextMenu from './BaseReportActionContextMenu';
import ConfirmModal from '../../../../components/ConfirmModal';
import CONST from '../../../../CONST';
+import * as ReportActionsUtils from '../../../../libs/ReportActionsUtils';
+import * as IOU from '../../../../libs/actions/IOU';
const propTypes = {
...withLocalizePropTypes,
@@ -249,7 +251,12 @@ class PopoverReportActionContextMenu extends React.Component {
confirmDeleteAndHideModal() {
this.callbackWhenDeleteModalHide = () => (this.onComfirmDeleteModal = this.runAndResetCallback(this.onComfirmDeleteModal));
- Report.deleteReportComment(this.state.reportID, this.state.reportAction);
+
+ if (ReportActionsUtils.isMoneyRequestAction(this.state.reportAction)) {
+ IOU.deleteMoneyRequest(this.state.reportID, this.state.reportAction.originalMessage.IOUReportID, this.state.reportAction, true);
+ } else {
+ Report.deleteReportComment(this.state.reportID, this.state.reportAction);
+ }
this.setState({isDeleteCommentConfirmModalVisible: false});
}
@@ -257,7 +264,6 @@ class PopoverReportActionContextMenu extends React.Component {
this.callbackWhenDeleteModalHide = () => (this.onCancelDeleteModal = this.runAndResetCallback(this.onCancelDeleteModal));
this.setState({
reportID: '0',
- reportAction: {},
isDeleteCommentConfirmModalVisible: false,
shouldSetModalVisibilityForDeleteConfirmation: true,
isArchivedRoom: false,
@@ -313,13 +319,13 @@ class PopoverReportActionContextMenu extends React.Component {
/>
>>>>>> 3119b61e22 (Merge pull request #17348 from Expensify/cmartins-allowDeletion)
import Permissions from '../../../libs/Permissions';
const propTypes = {
@@ -203,7 +208,19 @@ class ReportActionItem extends Component {
checkIfContextMenuActive={this.checkIfContextMenuActive}
/>
);
+<<<<<<< HEAD
} else if (ReportActionUtils.isCreatedTaskReportAction(this.props.action)) {
+=======
+ } else if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED) {
+ children = (
+
+ );
+ } else if (ReportActionsUtils.isCreatedTaskReportAction(this.props.action)) {
+>>>>>>> 3119b61e22 (Merge pull request #17348 from Expensify/cmartins-allowDeletion)
children = (
{isWhisper && (