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.34k stars 2.77k forks source link

[HOLD - #374470] Thread header and LHN for task assignee system message is missing the assignee #37939

Open kavimuru opened 6 months ago

kavimuru commented 6 months 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: 1.4.49-0 Reproducible in staging?: y Reproducible in production?: NO - new feature (system message) If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: applause internal team Slack conversation:

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to any chat.
  3. Create a task.
  4. Go to task report.
  5. Click Assignee.
  6. Add an assignee (or change assignee).
  7. Right click on assignee system message > Reply in thread.

Expected Result:

The thread header and LHN title will show assignee name.

Actual Result:

The thread header and LHN title do not show assignee name.

Also, The email in system message is also not copied when copied to clipboard.

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/43996225/95d8bd56-c3da-4238-b00e-c21193ce2fc8

View all open jobs on GitHub

melvin-bot[bot] commented 6 months ago

Triggered auto assignment to @strepanier03 (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

github-actions[bot] commented 6 months ago

:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.
melvin-bot[bot] commented 6 months ago

Triggered auto assignment to @marcaaron (Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

kavimuru commented 6 months ago

@marcaaron FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.

kavimuru commented 6 months ago

We think this bug might be related to #vip-vsb. cc @quinthar

nexarvo commented 6 months ago

Proposal


### Please re-state the problem that we are trying to solve in this issue. Thread header and LHN for task assignee system message is missing the assignee

What is the root cause of that problem?

The message in parentReportAction says something like this: assigned to <mention-user accountID=16485686></mention-user> and the final message only remains 'assigned to' on both header and and LHN. https://github.com/Expensify/App/blob/9132e058fe27119906e027579ea9b36be5a57400/src/libs/ReportUtils.ts#L2616-L2620

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

We need to first check if message has accountId, and if it has then we get the display name for the participant.

const participantAccountId = doesMessageHasAccountId()
       if(parentReportAction.actionName === CONST.REPORT.ACTIONS.TYPE.TASKEDITED && participantAccountId) {
           parentReportActionMessage = parentReportActionMessage + ' ' + + getDisplayNameForParticipant(participantAccountId, undefined, undefined, true);
        }
       return parentReportActionMessage;

Here doesMessageHasAccountId() is simple utility function which will check if message has accountId and it has then it will return that accountId. Also in above condition CONST.REPORT.ACTIONS.TYPE.TASKEDITED represents that task is edited and we are opening that (edited) system message

What alternative solutions did you explore? (Optional)

Result

Screenshot 2024-03-08 at 6 50 51 AM
marcaaron commented 6 months ago

I am thinking if this is a new feature then we probably don't need to make this a blocker.

roryabraham commented 6 months ago

I am thinking if this is a new feature then we probably don't need to make this a blocker

I think we should treat this as a blocker, because it's available to any new user and looks pretty obviously broken

marcaaron commented 6 months ago

Cool. These are the PRs related to tasks...

https://github.com/Expensify/App/pull/37991 https://github.com/Expensify/App/pull/36768 <- this looks like something new https://github.com/Expensify/App/pull/35484

@thienlnam might know which one this could be related to?

I am still leaning towards non blocker because creating a thread off a system message seems like a weird action for a user to take. And I'm not sure how that should work at all. 🤔

strepanier03 commented 6 months ago

I am still leaning towards non blocker because creating a thread off a system message seems like a weird action for a user to take.

I agree with this. I don't think a customer would create a thread off a system message. If they questioned it, they'd like be making a new comment after the system message instead of threading off it. I don't think this is a blocker either.

roryabraham commented 6 months ago

Well I don't feel that strongly but it seems to me that a system message is a message so should work just like any other 🤷🏼

thienlnam commented 6 months ago

Oh, this looks related to this issue https://github.com/Expensify/App/issues/38000.

This PR added the system messages, so now you have the ability to thread from them.

I also agree this shouldn't block deploy - it kind of relies on you creating a task, changing the assignee and then deciding to thread off the system message which doesn't seem that common in the first place

roryabraham commented 6 months ago

sounds like there's more votes in favor of demoting this. I do think creating a thread off a system message should work, but agree it's an edge case so doesn't necessarily need to block deploy.

paultsimura commented 6 months ago

If this is not urgent – I would recommend putting this on hold for https://github.com/Expensify/Expensify/issues/374470 similar to how we did with https://github.com/Expensify/App/issues/37943 – that PR should introduce a more robust originalMessage to the TASKEDITED report actions, and it will allow building the thread name without workarounds (like parsing the message etc.)

mountiny commented 6 months ago

Demoting based on the discussion above.

strepanier03 commented 6 months ago

On Hold for #374470.

paultsimura commented 6 months ago

Proposal

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

When opening a thread under the "Reassigned task" action, the title in Header and LHN are incorrect.

What is the root cause of that problem?

We do not handle the TASKEDITED parent actions in a special way – only using the built parentReportAction.message:

https://github.com/Expensify/App/blob/632b1f8d46bac05d5bc4592215156fa8a5044040/src/libs/ReportUtils.ts#L2624-L2628

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

First, we should wait for #374470 – it should introduce a rich originalMessage structure for the TASKEDITED actions.

Second, I would say it's better to hold for https://github.com/Expensify/App/issues/37943#issuecomment-1985843265 – in that proposal, I've described in details the process of leveraging the new originalMessage structure for building the localized messages based on the data that was modified (if we don't want to hold, we can implement the same changes I suggested in that proposal).

After that, we should modify the ReportUtils.getReportName to handle the case when the parent report action is the Task action (including the "marked as complete/incomplete). The reason to include these actions as well is this: when we open a thread from one of these older-format task actions, the title seems to be correct, but it's not localizable:

image

So the final code will look like this:

function getReportName(report: OnyxEntry<Report>, policy: OnyxEntry<Policy> = null): string {
    let formattedName: string | undefined;
    const parentReportAction = ReportActionsUtils.getParentReportAction(report);
    if (isChatThread(report)) {
        if (!isEmptyObject(parentReportAction) && ReportActionsUtils.isTransactionThread(parentReportAction)) {
            formattedName = getTransactionReportName(parentReportAction);
            if (isArchivedRoom(report)) {
                formattedName += ` (${Localize.translateLocal('common.archived')})`;
            }
            return formattedName;
        }

        if (parentReportAction?.message?.[0]?.isDeletedParentAction) {
            return Localize.translateLocal('parentReportAction.deletedMessage');
        }

+        if (ReportActionUtils.isTaskAction(parentReportAction)) {
+            return TaskUtils.getTaskReportActionMessage(parentReportAction).text;
+        }
...

This will allow to have the LHN and Title text for task-related actions both properly built and localized.

What alternative solutions did you explore? (Optional)

strepanier03 commented 5 months ago

Hold PR is still open.

marcaaron commented 5 months ago

I see this issue is on HOLD and waiting for #374470, but also see that #374470 has not had much progress. Should we continue to leave this open? 🤔

marcaaron commented 5 months ago

@thienlnam any chance you can give us an ETA on when those changes might be live? We could adjust the priority here based on that. Thanks!

strepanier03 commented 4 months ago

@thienlnam - Any chance you have an eta on those changes?

thienlnam commented 4 months ago

Ah sorry, didn't see this. I'm not working on those at this time since they're not part of a release. I would throw a monthly on this until we decide to reprioritize

strepanier03 commented 4 months ago

Sounds good, thanks for the context and advice.

marcaaron commented 3 months ago

Going OOO so gonna unassign this one for now. This one has been open for a while and there's not really anything actionable for me to do here.

strepanier03 commented 2 months ago

Not prioritized right now.

strepanier03 commented 2 weeks ago

Not prioritized currently.