Skip to content

Commit

Permalink
Basic handling for new ACTIONABLETRACKEXPENSEWHISPER
Browse files Browse the repository at this point in the history
  • Loading branch information
thienlnam authored and ishpaul777 committed Mar 20, 2024
1 parent c5ac594 commit ce8e379
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,10 @@ const CONST = {
LIMIT: 50,
// OldDot Actions render getMessage from Web-Expensify/lib/Report/Action PHP files via getMessageOfOldDotReportAction in ReportActionsUtils.ts
TYPE: {
ACTIONABLEJOINREQUEST: 'ACTIONABLEJOINREQUEST',
ACTIONABLEMENTIONWHISPER: 'ACTIONABLEMENTIONWHISPER',
ACTIONABLETRACKEXPENSEWHISPER: 'ACTIONABLETRACKEXPENSEWHISPER',
ADDCOMMENT: 'ADDCOMMENT',
ACTIONABLEJOINREQUEST: 'ACTIONABLEJOINREQUEST',
APPROVED: 'APPROVED',
CHANGEFIELD: 'CHANGEFIELD', // OldDot Action
CHANGEPOLICY: 'CHANGEPOLICY', // OldDot Action
Expand Down
6 changes: 6 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2371,6 +2371,12 @@ export default {
accept: 'Accept',
decline: 'Decline',
},
actionableMentionTrackExpense: {
request: 'Request someone to pay it',
categorize: 'Categorize it',
share: 'Share it with my accountant',
nothing: 'Nothing for now'
},
teachersUnitePage: {
teachersUnite: 'Teachers Unite',
joinExpensifyOrg: 'Join Expensify.org in eliminating injustice around the world and help teachers split their expenses for classrooms in need!',
Expand Down
6 changes: 6 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2840,6 +2840,12 @@ export default {
accept: 'Aceptar',
decline: 'Rechazar',
},
actionableMentionTrackExpense: {
request: 'Request someone to pay it',
categorize: 'Categorize it',
share: 'Share it with my accountant',
nothing: 'Nothing for now'
},
moderation: {
flagDescription: 'Todos los mensajes marcados se enviarán a un moderador para su revisión.',
chooseAReason: 'Elige abajo un motivo para reportarlo:',
Expand Down
5 changes: 5 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,10 @@ function isActionableJoinRequest(reportAction: OnyxEntry<ReportAction>): boolean
return reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ACTIONABLEJOINREQUEST;
}

function isActionableTrackExpense(reportAction: OnyxEntry<ReportAction>): boolean {
return reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ACTIONABLETRACKEXPENSEWHISPER;
}

/**
* Checks if any report actions correspond to a join request action that is still pending.
* @param reportID
Expand Down Expand Up @@ -1025,6 +1029,7 @@ export {
isCurrentActionUnread,
isActionableJoinRequest,
isActionableJoinRequestPending,
isActionableTrackExpense,
};

export type {LastVisibleMessage};
29 changes: 29 additions & 0 deletions src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,35 @@ function ReportActionItem({
return [];
}

if (ReportActionUtils.isActionableTrackExpense()) {
return [
{
text: 'actionableMentionTrackExpense.request',
key: `${action.reportActionID}-actionableMentionTrackExpense-request`,
onPress: () => console.log('Track'),
isPrimary: true,
},
{
text: 'actionableMentionTrackExpense.categorize',
key: `${action.reportActionID}-actionableMentionTrackExpense-categorize`,
onPress: () => console.log('Categorize'),
isPrimary: true,
},
{
text: 'actionableMentionTrackExpense.share',
key: `${action.reportActionID}-actionableMentionTrackExpense-share`,
onPress: () => console.log('Share'),
isPrimary: true,
},
{
text: 'actionableMentionTrackExpense.nothing',
key: `${action.reportActionID}-actionableMentionTrackExpense-nothing`,
onPress: () => console.log('Nothing'),
isPrimary: true,
},
];
}

if (ReportActionsUtils.isActionableJoinRequest(action)) {
return [
{
Expand Down
1 change: 1 addition & 0 deletions src/types/onyx/OriginalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type OriginalMessageActionName =
| 'TASKREOPENED'
| 'ACTIONABLEJOINREQUEST'
| 'ACTIONABLEMENTIONWHISPER'
| 'ACTIONABLETRACKEXPENSEWHISPER'
| ValueOf<typeof CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG>;
type OriginalMessageApproved = {
actionName: typeof CONST.REPORT.ACTIONS.TYPE.APPROVED;
Expand Down

0 comments on commit ce8e379

Please sign in to comment.