Show an error when the default workspace does not have travel enabled - #98484
Show an error when the default workspace does not have travel enabled#98484blimpich wants to merge 13 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
This comment has been minimized.
This comment has been minimized.
|
Hmm not sure why two C+ got assigned to review. Going to unassign @truph01 |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb SafariMacOS: Chrome / Safaricase1.movcase2.movcase3.movcase5.movcase6.mov |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c931a41077
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2fb4dee678
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
🤖 Reviewed the change. The core logic is sound and nicely refactored — the previously duplicated One thing to confirmThe three entry points diverge when the default workspace lacks travel. The block is applied consistently, but the user-facing outcome is not:
Since Minor
Things that check out
This is an automated review — treat it as a second set of eyes, not a gate. Reply with |
|
🤖 Regression scan — no unintended regression found in the happy path. The refactor is behavior-preserving and the new guard is provably scoped to the target scenario, but there are two behavior changes worth a conscious sign-off. Why the happy path is safeThe new block in BookTravelButton.tsx:163-179 can only fire when the booking policy's id differs from the default (
The Two intentional behavior changes to sign off on
Things explicitly checked and clear
Automated regression scan — a second set of eyes, not a gate. Reply with |
|
@situchan any update here? |
| if (blockIfDefaultWorkspaceLacksTravel()) { | ||
| return; | ||
| } | ||
| openTravelDotLink(travelEnabledPolicy?.id); |
There was a problem hiding this comment.
The guard asserts the default workspace has travel, but the ID handed to openTravelDotLink is travelEnabledPolicy?.id, computed as line 82 as Object.values(allPolicies).find(p => p.isTravelEnabled) (insertion order, not the default).
So, with two travel-enabled workspaces, the guard passes and the user is still handed off to a non-default workspace.
This is not something introduced by this PR so out of scope.
situchan
left a comment
There was a problem hiding this comment.
Please pull main and check #98484 (comment).
Otherwise looks good.
|
@stitesExpensify Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
🦜 Polyglot Parrot! 🦜Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues: View the translation diffdiff --git a/src/languages/el.ts b/src/languages/el.ts
index 8e696d76..df1d29b6 100644
--- a/src/languages/el.ts
+++ b/src/languages/el.ts
@@ -4585,9 +4585,9 @@ ${amount} για ${merchant} - ${date}`,
'Γνωρίζατε ότι μπορείτε να κλείνετε και να διαχειρίζεστε ταξίδια με τρένο απευθείας στο Expensify; Και ότι ανεβάζει αυτόματα τις αποδείξεις για εσάς; Την επόμενη φορά απλώς κάντε κράτηση μέσω του <a href="https://travel.expensify.com">Expensify Travel</a> 🚂',
},
defaultWorkspaceTravelDisabled: {
- title: 'Η ταξιδιωτική λειτουργία δεν είναι ενεργοποιημένη',
+ title: 'Τα ταξίδια δεν είναι ενεργοποιημένα',
message:
- 'Για να κάνετε κράτηση, ενεργοποιήστε τα ταξίδια στον προεπιλεγμένο χώρο εργασίας σας ή αλλάξτε τον προεπιλεγμένο χώρο εργασίας σε κάποιον όπου τα ταξίδια είναι ενεργοποιημένα.',
+ 'Για να κάνετε κράτηση, ενεργοποιήστε τα ταξίδια στον προεπιλεγμένο χώρο εργασίας σας ή αλλάξτε τον προεπιλεγμένο χώρο εργασίας σας σε κάποιον όπου τα ταξίδια είναι ενεργοποιημένα.',
},
},
proactiveAppReview: {
diff --git a/src/languages/es.ts b/src/languages/es.ts
index c43ed39c..6d94f4fc 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -4418,7 +4418,7 @@ ${amount} para ${merchant} - ${date}`,
'¿Sabías que puedes reservar y gestionar viajes en tren directamente en Expensify? ¿Y que además sube los recibos automáticamente por ti? La próxima vez, simplemente reserva a través de <a href="https://travel.expensify.com">Expensify Travel</a> 🚂',
},
defaultWorkspaceTravelDisabled: {
- title: 'Los viajes no están habilitados',
+ title: 'Viajes no está habilitado',
message: 'Para reservar, habilita los viajes en tu espacio de trabajo predeterminado o cambia tu espacio de trabajo predeterminado a uno que tenga los viajes habilitados.',
},
},
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index c3d29736..51ffe107 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -4524,7 +4524,8 @@ ${amount} pour ${merchant} - ${date}`,
},
defaultWorkspaceTravelDisabled: {
title: 'Voyage n’est pas activé',
- message: 'Pour réserver, veuillez activer les voyages sur votre espace de travail par défaut ou définir par défaut un espace de travail sur lequel les voyages sont activés.',
+ message:
+ 'Pour réserver, activez les voyages sur votre espace de travail par défaut ou remplacez votre espace de travail par défaut par un espace de travail avec voyages activés.',
},
},
workspace: {
diff --git a/src/languages/it.ts b/src/languages/it.ts
index f2b601dd..1d0eaf59 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -4490,8 +4490,8 @@ ${amount} per ${merchant} - ${date}`,
'Sapevi che puoi prenotare e gestire i viaggi in treno direttamente in Expensify? E che le ricevute vengono caricate automaticamente per te? La prossima volta prenota semplicemente tramite <a href="https://travel.expensify.com">Expensify Travel</a> 🚂',
},
defaultWorkspaceTravelDisabled: {
- title: 'Viaggi non abilitato',
- message: 'Per prenotare, abilita i viaggi sul tuo spazio di lavoro predefinito oppure imposta come predefinito uno spazio di lavoro con viaggi abilitati.',
+ title: 'Viaggi non è abilitato',
+ message: 'Per prenotare, attiva i viaggi nel tuo spazio di lavoro predefinito oppure imposta come predefinito uno spazio di lavoro con viaggi abilitati.',
},
},
workspace: {
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 86e76991..8f4a2268 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -4454,8 +4454,8 @@ ${integrationName === CONST.ONBOARDING_ACCOUNTING_MAPPING.other ? 'あなたの'
'Expensify で電車の予約や管理ができることをご存じでしたか?しかも領収書も自動でアップロードされます。次回からは、ぜひ <a href="https://travel.expensify.com">Expensify Travel</a> から予約してください 🚂',
},
defaultWorkspaceTravelDisabled: {
- title: '出張機能は有効になっていません',
- message: '予約するには、デフォルトのワークスペースで出張機能を有効にするか、出張機能が有効になっているワークスペースをデフォルトとして設定してください。',
+ title: '出張は有効になっていません',
+ message: '予約するには、デフォルトのワークスペースで出張機能を有効にするか、出張機能が有効になっているワークスペースをデフォルトに設定してください。',
},
},
workspace: {
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index dac1eb2a..fe051e73 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -4489,7 +4489,7 @@ ${amount} voor ${merchant} - ${date}`,
},
defaultWorkspaceTravelDisabled: {
title: 'Reizen is niet ingeschakeld',
- message: 'Om te boeken, schakel reizen in op je standaardwerkruimte of stel een standaardwerkruimte in die reizen ondersteunt.',
+ message: 'Om te boeken, schakel reizen in op je standaardwerkruimte of wijzig je standaardwerkruimte naar een werkruimte waarop reizen is ingeschakeld.',
},
},
workspace: {
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 896b7f4e..ad9c65d7 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -4473,8 +4473,8 @@ ${amount} dla ${merchant} - ${date}`,
'Wiesz, że możesz rezerwować i zarządzać przejazdami pociągiem bezpośrednio w Expensify? I że paragony są automatycznie przesyłane za Ciebie? Następnym razem po prostu zarezerwuj przez <a href="https://travel.expensify.com">Expensify Travel</a>',
},
defaultWorkspaceTravelDisabled: {
- title: 'Podróże są wyłączone',
- message: 'Aby dokonać rezerwacji, włącz podróże w swojej domyślnej przestrzeni roboczej lub ustaw jako domyślną inną przestrzeń roboczą, w której podróże są włączone.',
+ title: 'Podróże nie są włączone',
+ message: 'Aby zarezerwować, włącz podróże w swojej domyślnej przestrzeni roboczej albo ustaw jako domyślną inną przestrzeń roboczą, w której podróże są włączone.',
},
},
workspace: {
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 9b186542..3a8601b0 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -4482,8 +4482,8 @@ ${amount} para ${merchant} - ${date}`,
'Você sabia que dá para reservar e gerenciar viagens de trem direto no Expensify? E que os recibos são enviados automaticamente para você? Da próxima vez, é só reservar pelo <a href="https://travel.expensify.com">Expensify Travel</a> 🚂',
},
defaultWorkspaceTravelDisabled: {
- title: 'Viagem não está ativada',
- message: 'Para fazer uma reserva, ative viagens no seu espaço de trabalho padrão ou altere seu espaço de trabalho padrão para um que tenha viagens ativadas.',
+ title: 'Viagens não estão ativadas',
+ message: 'Para reservar, ative viagens no seu workspace padrão ou altere seu workspace padrão para um que tenha viagens ativadas.',
},
},
workspace: {
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index eda5d2d7..9e9c0133 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -4348,7 +4348,7 @@ ${amount},商户:${merchant} - 日期:${date}`,
railManual: '你知道吗?你可以直接在 Expensify 中预订和管理火车行程!下次无需再手动创建报销,只需通过 <a href="https://travel.expensify.com">Expensify Travel</a> 预订即可 🚂',
railCard: '你知道吗?你可以直接在 Expensify 中预订和管理火车行程,而且还会自动为你上传收据。下次只需通过 <a href="https://travel.expensify.com">Expensify Travel</a> 预订即可 🚂',
},
- defaultWorkspaceTravelDisabled: {title: '差旅功能未启用', message: '如需预订,请在您的默认工作区中启用差旅功能,或将默认工作区切换为已启用差旅功能的工作区。'},
+ defaultWorkspaceTravelDisabled: {title: '差旅功能未启用', message: '要预订,请在你的默认工作区启用差旅,或将默认工作区切换为已启用差旅的工作区。'},
},
workspace: {
common: {
Note You can apply these changes to your branch by copying the patch to your clipboard, then running |
Explanation of Change
Today a member whose default workspace does not have travel enabled can still book travel from a different, travel-enabled workspace. A traveler is provisioned against their default workspace, so they land in Expensify Travel without a travel profile. They never appear in that company's traveler list and their booking does not behave as expected. This change stops the booking at the point of the click. It shows a modal that tells the member to either enable travel on their default workspace, or switch their default workspace to one that is travel-enabled. Setting up travel on a workspace is unaffected, because only the hand-off into Expensify Travel is blocked.
Fixed Issues
$ #92551
PROPOSAL: #92551 (comment)
Tests
Offline tests
QA Steps
The modal is the same in every scenario below:
Precondition
Scenario 1: Travel quick action on Home
Scenario 2: Manage travel on the workspace travel page
Scenario 3: Book travel on the My trips page
https://staging.new.expensify.com/travel?policyID=<policyID of Travel WS>.Scenario 4: The modal is gone once the default workspace is travel-enabled
Scenario 5: Enabling travel on a workspace is never blocked
Scenario 6: Paths that always book with the default workspace are unaffected
Screenshots/Videos