Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.57k stars 2.91k forks source link

[$250] mWeb - WS - In #admin room the message about the upgrader disappears #52582

Open IuliiaHerets opened 1 week ago

IuliiaHerets commented 1 week ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.62-2 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5223810 Issue reported by: Applause Internal Team

Action Performed:

  1. Log in the app
  2. Go to Settings and create a new WS
  3. In the new WS go to More Features and enable Accounting
  4. Tap on Netsuite/Sage
  5. Tap upgrade button
  6. Navigate to WS screen and Tap 3 dots
  7. Go to #admins room

Expected Result:

User is navigated to the #admins room, the upgrade system messages have posted, including a message from Expensify mentioning the upgrader.

Actual Result:

The upgrader is mentioned in a separate whisper message, that is only displayed briefly. In the system message the upgrader is not mentioned.

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/bd868c03-7ccb-47a5-aa30-01d70d99e7b6

https://github.com/user-attachments/assets/c8edf4a2-a6bb-49a8-b872-8126e14e73c3

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021857185698447287009
  • Upwork Job ID: 1857185698447287009
  • Last Price Increase: 2024-11-14
melvin-bot[bot] commented 1 week ago

Triggered auto assignment to @sakluger (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

daledah commented 1 week ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

The upgrader is mentioned in a separate whisper message, that is only displayed briefly. In the system message the upgrader is not mentioned.

What is the root cause of that problem?

When we call API UpgradeToCorporate, BE returns message in reportAction

Screenshot 2024-11-14 at 23 33 09

But when we call API OpenReport, BE returns message as [] in reportAction

What changes do you think we should make in order to solve the problem?

We should handle the action of this report Action is POLICYCHANGELOG_CORPORATE_UPGRADE in the front end

This solves 2 problems: handling cases where BE returns missing message like this issue and being able to translate them into Spanish

  1. We should create new translation key for this action corporateUpdate
  2. Create a util to get the corporate update message in ReportUtils
    
    function getCorporateUpdateMessage(reportAction: ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG_CORPORATE_UPGRADE>) {
    return Localize.translateLocal('corporateUpdate');
    }
3. Do the same way as we do for other actions to add a case for the corporate update in other places

In `ReportActionItem` [here](https://github.com/Expensify/App/blob/d5a7b499d3ba2074f5ad069ed27a043d029d7036/src/pages/home/report/ReportActionItem.tsx#L698)

else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG_CORPORATE_UPGRADE) { children = ; }


In `OptionsListUtils.ts`  [here](https://github.com/Expensify/App/blob/d5a7b499d3ba2074f5ad069ed27a043d029d7036/src/libs/OptionsListUtils.ts#L648)

if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG_CORPORATE_UPGRADE) { return getCorporateUpdateMessage(parentReportAction); }


In `ContextMenuActions.tsx` [here](https://github.com/Expensify/App/blob/d5a7b499d3ba2074f5ad069ed27a043d029d7036/src/pages/home/report/ContextMenu/ContextMenuActions.tsx#L484)

else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG_CORPORATE_UPGRADE) { const displayMessage = ReportUtils.getCorporateUpdateMessage(reportAction); Clipboard.setString(displayMessage);



### What alternative solutions did you explore? (Optional)

<!---
ATTN: Contributor+

You are the first line of defense in making sure every proposal has a clear and easily understood problem with a "root cause". Do not approve any proposals that lack a satisfying explanation to the first two prompts. It is CRITICALLY important that we understand the root cause at a minimum even if the solution doesn't directly address it. When we avoid this step we can end up solving the wrong problems entirely or just writing hacks and workarounds.

Instructions for how to review a proposal:

1. Address each contributor proposal one at a time and address each part of the question one at a time e.g. if a solution looks acceptable, but the stated problem is not clear then you should provide feedback and make suggestions to improve each prompt before moving on to the next. Avoid responding to all sections of a proposal at once. Move from one question to the next each time asking the contributor to "Please update your original proposal and tag me again when it's ready for review".

3. Limit excessive conversation and moderate issues to keep them on track. If someone is doing any of the following things please kindly and humbly course-correct them:

- Posting PRs.
- Posting large multi-line diffs (this is basically a PR).
- Skipping any of the required questions.
- Not using the proposal template at all.
- Suggesting that an existing issue is related to the current issue before a problem or root cause has been established.
- Excessively wordy explanations.

5. Choose the first proposal that has a reasonable answer to all the required questions.
-->
sakluger commented 1 week ago

Pulling out a few screenshots from the reproduction video so it's easier to see what's going on here. Here's the #admins room chat showing the upgrade system message:

image

And here's the same admins room seconds later, after the system message disappeared:

image
melvin-bot[bot] commented 1 week ago

Job added to Upwork: https://www.upwork.com/jobs/~021857185698447287009

melvin-bot[bot] commented 1 week ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws (External)

FitseTLT commented 6 days ago

Looks like BE is resetting the reportAction.message to intentionally hide it but if we want to avoid hiding then it should be handled in BE 👍

sakluger commented 6 days ago

@Ollyws can you please confirm if this needs to be handled in BE? If so, I can change to internal.

melvin-bot[bot] commented 4 days ago

@sakluger, @Ollyws Whoops! This issue is 2 days overdue. Let's get this updated quick!

Ollyws commented 4 days ago

@sakluger Yeah seems this is a BE issue as the message object is empty.

daledah commented 3 days ago

@Ollyws can you take a look at my proposal

sakluger commented 3 days ago

We have a ton of POLICYCHANGELOG system messages and as far as I know, they're all created and stored API-side and the workspace changes require access to backend code. I'm going to mark internal for now, but if it turns out that @daledah's front-end solution will work, we can switch it back.

sakluger commented 3 days ago

cc @yuwenmemon I'm not sure if you need to work on this, but you are super familiar with workspace change logs so I'm tagging you in case you know what might be the issue.

yuwenmemon commented 2 days ago

Ooh weird. Yeah I can take a look at this...

sakluger commented 20 hours ago

@yuwenmemon let me know if you think we need to change to weekly.