Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[$500] Web - The last message in LHN has a colon character (:) different from the last message in the task report #27671

Closed
1 of 6 tasks
kbecciv opened this issue Sep 18, 2023 · 30 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@kbecciv
Copy link

kbecciv commented Sep 18, 2023

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


Action Performed:

  1. Go to any report
  2. Create a task
  3. In the task detail click mark as done
  4. Observe that the last message shown in LHN and task report are different

Expected Result:

Last message in LHN does not have a colon character (:)

Actual Result:

The last message shown in LHN and task report are different

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.70.5
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

Screen.Recording.2023-09-16.at.22.14.43.mov
Recording.4544.mp4

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

View all open jobs on GitHub

@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 18, 2023
@melvin-bot melvin-bot bot changed the title Web - The last message in LHN has a colon character (:) different from the last message in the task report [$500] Web - The last message in LHN has a colon character (:) different from the last message in the task report Sep 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

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

@kbecciv
Copy link
Author

kbecciv commented Sep 18, 2023

Proposal by: @namhihi237
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694877258526769

Proposal

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

The last message shown in LHN and the task report same, For now, the last message LHN includes a colon (:) but the message on the report is not a colon

What is the root cause of that problem?

We use TaskAction to show the message action on the task report, and can see no colon.

<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
<Text style={[styles.chatItemMessage, styles.colorMuted]}>{`${taskStatusText} ${taskReportName}`}</Text>
</View>

And here is the logic showing the last message on the LHN
} else if (lodashGet(lastAction, 'actionName', '') === CONST.REPORT.ACTIONS.TYPE.TASKREOPENED) {
result.alternateText = `${Localize.translate(preferredLocale, 'task.messages.reopened')}: ${report.reportName}`;
} else if (lodashGet(lastAction, 'actionName', '') === CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED) {
result.alternateText = `${Localize.translate(preferredLocale, 'task.messages.completed')}: ${report.reportName}`;

Can see it includes a colon (:).

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

We should create a function to return the message action and use both place

What alternative solutions did you explore? (Optional)

And simple we can remove (:) in here

@HardikChoudhary24
Copy link
Contributor

HardikChoudhary24 commented Sep 18, 2023

Proposal

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

  • The last message in LHN has a colon character (:) different from the last message in the task report.

What is the root cause of that problem?

  • The root cause of this issue lies within the TaskAction Component, which is primarily responsible for rendering the message action. The problem stems from the absence of a colon between ${taskStatusText} and ${taskReportName}

<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
<Text style={[styles.chatItemMessage, styles.colorMuted]}>{`${taskStatusText} ${taskReportName}`}</Text>
</View>

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

  • To address this problem, we can resolve it by simply inserting a colon between ${taskStatusText} and ${taskReportName}.

What alternative solutions did you explore? (Optional)
N/A

@strepanier03
Copy link
Contributor

Double assignment, taking myself off. This is happening quite often lately.

@strepanier03 strepanier03 removed their assignment Sep 18, 2023
@dukenv0307
Copy link
Contributor

Proposal

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

The last message in LHN has a colon character (:) different from the last message in the task report

What is the root cause of that problem?

function getTaskReportActionMessage(actionName, reportID, isCreateTaskAction) {
const report = ReportUtils.getReport(reportID);
if (isCreateTaskAction) {
return `Created a task: ${report.reportName}`;
}
let taskStatusText = '';
switch (actionName) {
case CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED:
taskStatusText = Localize.translateLocal('task.messages.completed');
break;
case CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED:
taskStatusText = Localize.translateLocal('task.messages.canceled');
break;
case CONST.REPORT.ACTIONS.TYPE.TASKREOPENED:
taskStatusText = Localize.translateLocal('task.messages.reopened');
break;
default:
taskStatusText = Localize.translateLocal('task.task');
}
return `${taskStatusText} ${report.reportName}`;

This is logic to get the message in the report and the content when clicking Copy to clipboard. We don't add : between taskStatusText and reportName

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

return `${taskStatusText} ${report.reportName}`;

We should add : between taskStatusText and reportName

What alternative solutions did you explore? (Optional)

@DylanDylann
Copy link
Contributor

DylanDylann commented Sep 19, 2023

@narefyev91 It seems @namhihi237's proposal is outdated. we can't do that now

@narefyev91
Copy link
Contributor

Proposal from @namhihi237 looks good to me - #27671 (comment)
Both renders should be the same
LGTM!
🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Sep 19, 2023

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

@narefyev91
Copy link
Contributor

@narefyev91 It seems @namhihi237's proposal is outdated now

Code changes were done after @namhihi237 posted proposal - in any case area and root case were identified correctly from his side - and any code changes should be discussed during PR review

@dukenv0307
Copy link
Contributor

dukenv0307 commented Sep 19, 2023

@narefyev91

We should create a function to return the message action and use both places

It seems that the utils function in this case isn't suitable even before the new change. My proposal is simpler and easier to implement.

@narefyev91
Copy link
Contributor

@narefyev91

We should create a function to return the message action and use both places

It seems that the utils function in this case isn't suitable even before the new change. My proposal is simpler and easier to implement.

Some one already did this logic inside Task.getTaskReportActionMessage - which is now can be used in any place to correctly build ${taskStatusText} ${report.reportName} - and those util should be used as well in SideBar.js - to make code in one place and avoid such issues which we currently have - i think @namhihi237 was planning to write something similar

@namhihi237
Copy link
Contributor

@narefyev91 yeah, that's my ideal, if we want simple we can use my alternative solutions

@dukenv0307
Copy link
Contributor

dukenv0307 commented Sep 19, 2023

@bondydaa @narefyev91

and those util should be used as well in SideBar.js - to make code in one place

  1. In this case, we shouldn't re-use getTaskReportActionMessage in SidebarUtils.js because the logic in SidebarUtils.js and getTaskReportActionMessage is different
  2. We shouldn't create a new util function for logic in SidebarUtils.js because we only use it in SidebarUtils.js

@dukenv0307
Copy link
Contributor

@namhihi237

if we want simple we can use my alternative solutions

I think : make for better UX and currently the BE also return : in that message. So if we come up with your alternative solution we need to change many places (both in BE)

@narefyev91
Copy link
Contributor

@dukenv0307 We should use getTaskReportActionMessage in SidebarUtils for this lines
Screenshot 2023-09-20 at 10 06 06

@dukenv0307
Copy link
Contributor

@narefyev91 If we use getTaskReportActionMessage in SidebarUtils, we will make a logic change in case actionName is TASKCANCELLED

@narefyev91
Copy link
Contributor

@narefyev91 If we use getTaskReportActionMessage in SidebarUtils, we will make a logic change in case actionName is TASKCANCELLED

Hmm sorry not sure if i get you right - it will changed like this
Screenshot 2023-09-20 at 12 27 44

@dukenv0307
Copy link
Contributor

@narefyev91 Let' see getTaskReportActionMessage function

function getTaskReportActionMessage(actionName, reportID, isCreateTaskAction) {
const report = ReportUtils.getReport(reportID);
if (isCreateTaskAction) {
return `Created a task: ${report.reportName}`;
}
let taskStatusText = '';
switch (actionName) {
case CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED:
taskStatusText = Localize.translateLocal('task.messages.completed');
break;
case CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED:
taskStatusText = Localize.translateLocal('task.messages.canceled');
break;
case CONST.REPORT.ACTIONS.TYPE.TASKREOPENED:
taskStatusText = Localize.translateLocal('task.messages.reopened');
break;
default:
taskStatusText = Localize.translateLocal('task.task');
}
return `${taskStatusText} ${report.reportName}`;

With your approach, we make 2 same conditions (check actionName 2 times)

We check actionName in both reportUtils and SidebarUtils

@narefyev91
Copy link
Contributor

@dukenv0307 not see any issue in sidebar to get correct action - and base on this action get correct translation based on getTaskReportActionMessage function. In any case i think we can leave final decision for @bondydaa

@dukenv0307
Copy link
Contributor

@bondydaa Summary for you:
We have 2 options here:
Option 1: We only need to add : between taskStatusText and reportName in here

return `${taskStatusText} ${report.reportName}`;

and don't need to do any thing as my proposal
Option 2: We still update as option 1 and use getTaskReportActionMessage function in SidebarUtils like here

Screenshot 2023-09-20 at 17 03 25

As I said in here If we do that we will check a condition 2 times (check actionName 2 times).

If we come up with option 2, I suggest that we should do like that

if (isTaskAction(lastAction)) {
       getTaskReportActionMessage(lastAction, report.reportID, false)
}

Anyway I don't think @namhihi237's proposal is clear enough to come with

We should create a function to return the message action and use both place

@narefyev91
Copy link
Contributor

@dukenv0307 let's summarise a bit correctly:

  1. proposal from @namhihi237 - who rise a proposal to have one function to return correct task statuses - (after some hours someone already implement those function getTaskReportActionMessage - but made a mistake not including ":" between ${taskStatusText} ${report.reportName};
  2. If for some reason we will not use proposal from @namhihi237 - second proposal should be picked from @HardikChoudhary24 - just to insert ":" between ${taskStatusText} ${report.reportName};

@melvin-bot melvin-bot bot added the Overdue label Sep 25, 2023
@zanyrenney
Copy link
Contributor

Thanks for the summary @narefyev91

Just going to ping @bondydaa to confirm we're on the right track please?

@melvin-bot melvin-bot bot removed the Overdue label Sep 25, 2023
@bondydaa
Copy link
Contributor

proposal from @namhihi237 - who rise a proposal to have one function to return correct task statuses - (after some hours someone already implement those function getTaskReportActionMessage - but made a mistake not including ":" between ${taskStatusText} ${report.reportName};

Okay so am I understanding correctly that we just need to add a : somewhere?

I'm going to assign @namhihi237 and lets add it in whatever method that was updated but didn't have it.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 25, 2023
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 25, 2023
@bondydaa
Copy link
Contributor

bondydaa commented Oct 2, 2023

looks like this Issue & PR changed the messages completely and removed the colons all together in favor of more streamlined messaging #24601

Asked this on the PR but do we need to still do anything here then? Otherwise we can probably close this out?

@zanyrenney
Copy link
Contributor

I think this is all closed out @bondydaa and we can close this. Closing!

@namhihi237
Copy link
Contributor

@zanyrenney If this issue closes will I be able to receive any payment for the raised PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

9 participants