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.49k stars 2.84k forks source link

[HOLD for payment 2023-08-02] [$1000] Web - In new task page, share destination doesn't have subtitle text for 1 to 1 DM and group chat #22296

Closed kbecciv closed 1 year ago

kbecciv commented 1 year 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!


Action Performed:

  1. Go to assign task
  2. Enter title and click next
  3. Choose an assignee
  4. Choose either 1 to 1 DM

Expected Result:

Selected share destination should have subtitle (contact method) shown below the user's display name

Actual Result:

Selected share destination does not have subtitle (contact method) shown below the user's display name for 1:1 DMs.

Workaround:

Unknown

Platforms:

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

Version Number: 1.3.36.4 Reproducible in staging?: y Reproducible in production?: y 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 Notes/Photos/Videos: Any additional supporting documentation

https://github.com/Expensify/App/assets/93399543/8b4d0116-0355-4e29-957f-154e568b8819

image (15)

Expensify/Expensify Issue URL: Issue reported by: @chiragxarora Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1688485210604909

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014fbeac64e9814e82
  • Upwork Job ID: 1677046091547865088
  • Last Price Increase: 2023-07-13
melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

Bug0 Triage Checklist (Main S/O)

kbecciv commented 1 year ago

Proposal

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

In new task page, share destination doesn't have subtitle text for 1 to 1 DM and group chat

What is the root cause of that problem?

Root cause of the issue is that in our NewTaskPage, for the shareDestination object, subtitle field is empty

image

And in description we are displaying subtitle of the object here

https://github.com/Expensify/App/blob/b0add9454e4e1a3fcc94acdbf838040c4c15acbe/src/pages/tasks/NewTaskPage.js#L169-L172

Now the subtitle field is originating from TaskUtils.getShareDestination > ReportUtils.getChatRoomSubtitle

And in getChatRoomSubtitle method we don't have any condition to catch DMs or group chats

https://github.com/Expensify/App/blob/6e03e5407d3fcdf2da370f3aaf88aa391c075e14/src/libs/ReportUtils.js#L1107-L1125

And all such reports get caught in this if block

https://github.com/Expensify/App/blob/6e03e5407d3fcdf2da370f3aaf88aa391c075e14/src/libs/ReportUtils.js#L1111-L1113

Thus subtitle is empty and we don't see it on share destination menu item

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

We need an extra if block to catch DMs and we can determine them by checking the report type, report's chatType and participants length before the other if block mentioned above in RCA.

if (isChatReport(report) && getChatType(report) === '' && report.participants && report.participants.length === 1) {
    return report.participants[0];
}

This works because DMs don't have a chat type as per our code definitions here

https://github.com/Expensify/App/blob/b0add9454e4e1a3fcc94acdbf838040c4c15acbe/src/CONST.js#L574-L580

NOTE: In slack conversation, its decided to show no subtitle for group chats, if expected results change later, then we can alter the condition on participants array

Results https://github.com/chiragxarora/pdf-download/assets/54641656/eff5df96-1f01-4030-b0c8-a0bb1af1c153

What alternative solutions did you explore? (Optional)

None

bernhardoj commented 1 year ago

Proposal

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

Task Share somewhere field does not show subtitle text for a non-room chat.

What is the root cause of that problem?

Currently, the subtitle comes from ReportUtils.getChatRoomSubtitle. As the name suggests, the function will return a subtitle for chat room. https://github.com/Expensify/App/blob/7ceaf0eae17a671927e2a91d44492845442f4b0f/src/libs/actions/Task.js#L566

The function is useful to show a subtitle in the report header.

image

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

If we expect the Share somewhere field to have the same subtitle as it is on the selector page, then we should use the same logic. Maybe we can create a new function, OptionsListUtils.getOptionAlternateText. https://github.com/Expensify/App/blob/680dccf863e59fd67057dbfa4dcf5b8fe8052b84/src/libs/OptionsListUtils.js#L498-L510 (this is the selector page)

image
joekaufmanexpensify commented 1 year ago

Reproduced.

melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

Current assignee @joekaufmanexpensify is eligible for the External assigner, not assigning anyone new.

melvin-bot[bot] commented 1 year ago

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

joekaufmanexpensify commented 1 year ago

Pending review of proposal.

joekaufmanexpensify commented 1 year ago

@eVoloshchak Could you take a look at this proposal when you have a sec?

joekaufmanexpensify commented 1 year ago

Bumped review in Slack

eVoloshchak commented 1 year ago

@kbecciv's proposal looks good to me!

πŸŽ€πŸ‘€πŸŽ€ C+ reviewed! cc: @joekaufmanexpensify

melvin-bot[bot] commented 1 year ago

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

chiragxarora commented 1 year ago

It's actually mine, I'm the reporter and @kbecciv pasted my proposal from slack

@eVoloshchak

bernhardoj commented 1 year ago

Just want to point out that we shouldn't add the condition to getChatRoomSubtitle. As the name suggests, it's to get the subtitle of a room, otherwise, we will start to see email below the 1:1 chat display name

image
chiragxarora commented 1 year ago

Nice find @bernhardoj You're right it will create an inconsistency

Although I have one question, why are we not showing subtitle for 1:1 chat dm? Isn't it already inconsistent with other chat reports headers @shawnborton ? If this is expected then we should go with @bernhardoj 's proposal

EDIT: the other proposal will also add subtitle to the group chat which is not the desired case.

We could take the if condition out of getChatRoomSubtitle() so that it does not affect everywhere it's used and we can apply the condition only in shareDestination file!

Can't update my proposal so mentioned here!!

shawnborton commented 1 year ago

I dont think we should worry about the chat report headers here, let's just solve the inconsistency in the share destination row.

joekaufmanexpensify commented 1 year ago

Waiting for sign off on the proposal from @bondydaa

bondydaa commented 1 year ago

I'm a little confused now...

I dont think we should worry about the chat report headers here

@shawnborton it sounds like if we with https://github.com/Expensify/App/issues/22296#issuecomment-1622319103 it's going to add the contact method to the chat report header as shown in this comment https://github.com/Expensify/App/issues/22296#issuecomment-1631799399.

Are you saying that is fine or that we should leave chat report headers alone and not change them?

shawnborton commented 1 year ago

I'm saying we can add the subheader in the share destination but let's not change how we display the report header for a 1:1 DM

bondydaa commented 1 year ago

okay cool that's what I thought, thanks for clarifying.

Then I don't think we should go with https://github.com/Expensify/App/issues/22296#issuecomment-1622319103 since that would change the report headers for 1:1 DMs, right?

@eVoloshchak are you good with https://github.com/Expensify/App/issues/22296#issuecomment-1623916868 then as I believe it's suggesting it'd only show the contact method in the selector and new task page?

chiragxarora commented 1 year ago

Nice find @bernhardoj You're right it will create an inconsistency

Although I have one question, why are we not showing subtitle for 1:1 chat dm? Isn't it already inconsistent with other chat reports headers @shawnborton ? If this is expected then we should go with @bernhardoj 's proposal

EDIT: the other proposal will also add subtitle to the group chat which is not the desired case.

We could take the if condition out of getChatRoomSubtitle() so that it does not affect everywhere it's used and we can apply the condition only in shareDestination file!

Can't update my proposal so mentioned here!!

@bondydaa pls see the edit

bondydaa commented 1 year ago

https://github.com/Expensify/App/issues/22296#issuecomment-1631930344 is what confused me...

so "the other proposal" in that that comment is https://github.com/Expensify/App/issues/22296#issuecomment-1623916868?

Could you create a new proposal that states how we can only fix this for the share destination and not change the report headers?

chiragxarora commented 1 year ago

Proposal

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

In new task page, share destination doesn't have subtitle text for 1 to 1 DM and group chat

What is the root cause of that problem?

Root cause of the issue is that in our NewTaskPage, for the shareDestination object, subtitle field is empty

image

And in description we are displaying subtitle of the object here

https://github.com/Expensify/App/blob/b0add9454e4e1a3fcc94acdbf838040c4c15acbe/src/pages/tasks/NewTaskPage.js#L169-L172

Now the subtitle field is originating from TaskUtils.getShareDestination > ReportUtils.getChatRoomSubtitle

And in getChatRoomSubtitle method we don't have any condition to catch DMs or group chats

https://github.com/Expensify/App/blob/6e03e5407d3fcdf2da370f3aaf88aa391c075e14/src/libs/ReportUtils.js#L1107-L1125

And all such reports get caught in this if block

https://github.com/Expensify/App/blob/6e03e5407d3fcdf2da370f3aaf88aa391c075e14/src/libs/ReportUtils.js#L1111-L1113

Thus subtitle is empty and we don't see it on share destination menu item

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

We need to perform an additional check to catch DMs and we can determine them by checking the report type, report's chatType and participants length.

if (isChatReport(report) && isDM(report) && report.participants && report.participants.length === 1) {
    return report.participants[0];
}

But we shall not perform this check in the ReportUtils.getChatRoomSubtitle() since that method is being used in a lot of places and it will return the subtitle for other places too where we don't need it.

So we can perform this check in TaskUtils.getShareDestination() which is a util specific for our case. This essentially means the following changes

https://github.com/Expensify/App/blob/451096b4828cf9a9bc1b5b7be95a6d52e79c392d/src/libs/actions/Task.js#L568-L575

Replacing the above with

function getShareDestination(reportID, reports, personalDetails) {
    const report = lodashGet(reports, `report_${reportID}`, {});
    let subtitle = '';
    if(ReportUtils.isChatReport(report) && ReportUtils.isDM(report) && report.participants && report.participants.length === 1) {
        subtitle = report.participants[0];
    }
    else subtitle = ReportUtils.getChatRoomSubtitle(report);
    return {
        icons: ReportUtils.getIcons(report, personalDetails, Expensicons.FallbackAvatar, ReportUtils.isIOUReport(report)),
        displayName: ReportUtils.getReportName(report),
        subtitle,
    };
}

NOTE: In slack conversation, its decided to show no subtitle for group chats, if expected results change later, then we can alter the condition on participants array

Results https://github.com/chiragxarora/pdf-download/assets/54641656/eff5df96-1f01-4030-b0c8-a0bb1af1c153

What alternative solutions did you explore? (Optional)

None

chiragxarora commented 1 year ago

Here's it @bondydaa @eVoloshchak

melvin-bot[bot] commented 1 year ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

joekaufmanexpensify commented 1 year ago

Close to selecting a proposal here.

bondydaa commented 1 year ago

Awesome thanks for that, seems good to me @eVoloshchak your thoughts?

chiragxarora commented 1 year ago

@eVoloshchak here's my updated proposal https://github.com/Expensify/App/issues/22296#issuecomment-1633898931

joekaufmanexpensify commented 1 year ago

Pending review of updated proposal

joekaufmanexpensify commented 1 year ago

Same

bondydaa commented 1 year ago

bumped @eVoloshchak on slack.

eVoloshchak commented 1 year ago

The updated proposal looks good to me, let's proceed with the PR!

πŸŽ€πŸ‘€πŸŽ€ C+ reviewed!

melvin-bot[bot] commented 1 year ago

Current assignee @bondydaa is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

joekaufmanexpensify commented 1 year ago

@bondydaa We're all set to assign the contributor here, right?

melvin-bot[bot] commented 1 year ago

πŸ“£ @eVoloshchak Please request via NewDot manual requests for the Reviewer role ($1000)

melvin-bot[bot] commented 1 year ago

πŸ“£ @chiragxarora πŸŽ‰ An offer has been automatically sent to your Upwork account for the Contributor role πŸŽ‰ Thanks for contributing to the Expensify app!

Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Keep in mind: Code of Conduct | Contributing πŸ“–

melvin-bot[bot] commented 1 year ago

πŸ“£ @chiragxarora πŸŽ‰ An offer has been automatically sent to your Upwork account for the Reporter role πŸŽ‰ Thanks for contributing to the Expensify app!

Upwork job

chiragxarora commented 1 year ago

PR https://github.com/Expensify/App/pull/23159 is ready for review @eVoloshchak

joekaufmanexpensify commented 1 year ago

Pending pr review from @bondydaa

bondydaa commented 1 year ago

merged

thienlnam commented 1 year ago

This added the regression https://github.com/Expensify/App/issues/23583, could you guys take a look? Will assign you both to the issue

melvin-bot[bot] commented 1 year ago

Reviewing label has been removed, please complete the "BugZero Checklist".

melvin-bot[bot] commented 1 year ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 1.3.45-7 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-08-02. :confetti_ball:

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

For reference, here are some details about the assignees on this issue:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

melvin-bot[bot] commented 1 year ago

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

joekaufmanexpensify commented 1 year ago

@eVoloshchak Could you please complete your portion of the BZ checklist here so we can prep to issue payment in a few days?

joekaufmanexpensify commented 1 year ago

Bumped in Slack

eVoloshchak commented 1 year ago
eVoloshchak commented 1 year ago

Regression Test Proposal

  1. Press FAB -> Assign Task
  2. Enter a title and click Next
  3. Click on Share Somewhere
  4. Choose 1 to 1 DM
  5. Verify selected share destination has a subtitle (contact method) shown below the user's display name

Do we agree πŸ‘ or πŸ‘Ž

joekaufmanexpensify commented 1 year ago

Great, thanks! I'll create a regression test issue now.