App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Workspace - System message changes in the #admins room after changing WS description

Open IuliiaHerets opened this issue 1 year ago • 15 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.71-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5296387&group_by=cases:section_id&group_id=229065&group_order=asc Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team

Action Performed:

  1. Navigate to https://staging.new.expensify.com/
  2. Log in with a Gmail account
  3. Create a new workspace
  4. Navigate to Workspace settings - Description
  5. Replace the default description with a few letters
  6. Navigate to the #admins room of the workspace

Expected Result:

System message should be "updated the description of this workspace to".

Actual Result:

System message changes in the #admins room after changing WS description. "updated the description of this workspace from "" to" message is briefly visible before it changes to "updated the description of this workspace to".

Workaround:

Unknown

Platforms:

  • [ ] Android: Standalone
  • [ ] Android: HybridApp
  • [x] Android: mWeb Chrome
  • [ ] iOS: Standalone
  • [ ] iOS: HybridApp
  • [ ] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/0debf403-1158-4e0e-89f9-aeb2de515a30

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021864276008252275164
  • Upwork Job ID: 1864276008252275164
  • Last Price Increase: 2024-12-04
Issue OwnerCurrent Issue Owner: @mountiny

IuliiaHerets avatar Dec 04 '24 09:12 IuliiaHerets

Triggered auto assignment to @trjExpensify (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.

melvin-bot[bot] avatar Dec 04 '24 09:12 melvin-bot[bot]

Proposal

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

System message changes in the #admins room after changing WS description. "updated the description of this workspace from "" to" message is briefly visible before it changes to "updated the description of this workspace to".

What is the root cause of that problem?

We don't have a translation for POLICYCHANGELOG_UPDATE_DESCRIPTION action and it displays the message[0]?.html by default. After we change the workspace's description, the backend returns the message updated the description of this workspace from "" to. But it's changed to updated the description of this workspace to ... after OpenReport API is called

Screenshot 2024-12-04 at 17 23 58

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

  1. We need to define a new translation for POLICYCHANGELOG_UPDATE_DESCRIPTION action. It is updated the description of this workspace from "${oldDescription}" to "${newDescription}" if oldDescription is not empty. If not, it is updated the description of this workspace to "${newDescription}" if oldDescription is empty
updateDescription: ({oldDescription, newDescription}: {oldDescription: string; newDescription: string}) =>
                `updated the description of this workspace ${oldDescription ? `"from ${oldDescription} "` : ''}to "${newDescription}"`,
  1. Add CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_DESCRIPTION as an old dot action

https://github.com/Expensify/App/blob/00f0deef12e963295eacede1ba905254e310cf1e/src/libs/ReportActionsUtils.ts#L1245

  1. Add a case for this action in getMessageOfOldDotReportAction function so it can work in all places like LHN, ReportActionItem, thread name header, copy to clipboard
case CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_DESCRIPTION: {
    const {oldDescription, newDescription}
    return Localize.translateLocal('workspace.common.updateDescription', {oldDescription, newDescription})
}

https://github.com/Expensify/App/blob/00f0deef12e963295eacede1ba905254e310cf1e/src/libs/ReportActionsUtils.ts#L1289

OPTIONAL: When we update workspace description we can generate this action in optimistic data and send the reportActionID to backend to generate this action

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

None

What alternative solutions did you explore? (Optional)

nkdengineer avatar Dec 04 '24 10:12 nkdengineer

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

melvin-bot[bot] avatar Dec 04 '24 11:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 04 '24 11:12 melvin-bot[bot]

@nkdengineer's proposal LGTM. I think a unit test might be appropriate here though?

jjcoffee avatar Dec 04 '24 12:12 jjcoffee

:ribbon::eyes::ribbon: C+ reviewed

jjcoffee avatar Dec 04 '24 12:12 jjcoffee

Triggered auto assignment to @mountiny, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Dec 04 '24 12:12 melvin-bot[bot]

I think a unit test might be appropriate here though?

If we want I think we can add a unit test for getMessageOfOldDotReportAction with CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_DESCRIPTION and verify that the translation is returned correctly for each case of oldDescription and newDescription.

nkdengineer avatar Dec 04 '24 12:12 nkdengineer

this needs to be fixed on the BE i guess, if the admin/owner is editing description for the first time, this bug occurs because BE doesn't check if we are editing for the first time. The OpenReport call sends the correct data which means we only need to fix the changelog when the user updates the description, what do you think @jjcoffee ?

twilight2294 avatar Dec 04 '24 12:12 twilight2294

This is a BE bug

FitseTLT avatar Dec 04 '24 14:12 FitseTLT

Ah my bad I thought it was being set optimistically! @mountiny I guess it doesn't make sense to add a new translation for POLICYCHANGELOG_UPDATE_DESCRIPTION? If that's the case this can be internal.

jjcoffee avatar Dec 04 '24 15:12 jjcoffee

I guess it doesn't make sense to add a new translation for POLICYCHANGELOG_UPDATE_DESCRIPTION

We already do this for update room description so I think we can do the same for update policy description.

https://github.com/Expensify/App/blob/ccc5efdbccbc2b19f22431ab98df16f01b7d744e/src/languages/en.ts#L5302

cc @trjExpensify What do you think?

nkdengineer avatar Dec 04 '24 16:12 nkdengineer

Still need to make this change in the be

mountiny avatar Dec 05 '24 12:12 mountiny

Gotcha, okay.

trjExpensify avatar Dec 05 '24 12:12 trjExpensify

Started a draft

mountiny avatar Dec 08 '24 23:12 mountiny

@trjExpensify, @jjcoffee, @mountiny Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Dec 12 '24 09:12 melvin-bot[bot]

How's the draft going?

trjExpensify avatar Dec 12 '24 11:12 trjExpensify

Was focusing on the fireroom, took it out of draft

mountiny avatar Dec 12 '24 12:12 mountiny

@trjExpensify, @jjcoffee, @mountiny Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Dec 20 '24 09:12 melvin-bot[bot]

Alrighty, that Auth PR has been deployed. Are we good here?

trjExpensify avatar Dec 20 '24 12:12 trjExpensify

@trjExpensify What do you think about my comment here https://github.com/Expensify/App/issues/53534#issuecomment-2517975987?

nkdengineer avatar Dec 20 '24 14:12 nkdengineer

Do other actualy workspace change logs to settings on the workspace get translated now, or only this room description example?

trjExpensify avatar Dec 20 '24 14:12 trjExpensify

Do other actualy workspace change logs to settings on the workspace get translated now, 

@trjExpensify Yes some other change logs like remove/invite member, update workspace name,... have already translated.

nkdengineer avatar Dec 20 '24 14:12 nkdengineer

"some other" ... but not all workspace change logs? 🤔

trjExpensify avatar Dec 20 '24 17:12 trjExpensify

Yes, not all workspace change logs.

nkdengineer avatar Dec 20 '24 17:12 nkdengineer

That's a sorta' weird inconsistency. Any idea why, @JmillsExpensify?

trjExpensify avatar Dec 20 '24 20:12 trjExpensify

@trjExpensify I think this because we have many workspace change logs action, we're only focusing on the translation for the popular system logs mentioned above.

nkdengineer avatar Dec 20 '24 20:12 nkdengineer

Hm, I don't think "workspace description" is that popular. But equally, whatever they change it to will be in the language they write. So I think it's probably fine.

I do think we should consider being consistent with translating workspace change logs and not partial ones though at some point.

trjExpensify avatar Dec 20 '24 20:12 trjExpensify

@trjExpensify, @jjcoffee, @mountiny 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

melvin-bot[bot] avatar Dec 24 '24 09:12 melvin-bot[bot]

@trjExpensify, @jjcoffee, @mountiny Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

melvin-bot[bot] avatar Dec 26 '24 09:12 melvin-bot[bot]