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

[REPRODUCTION NEEDED] [HOLD for task cleanup] [LOW] [$500] Task - Closed account shows "undefined" and task created by closed account is not accessible #33701

Closed
6 tasks done
izarutskaya opened this issue Dec 28, 2023 · 56 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Help Wanted Apply this label when an issue is open to proposals by contributors Internal Requires API changes or must be handled by Expensify staff Needs Reproduction Reproducible steps needed Weekly KSv2

Comments

@izarutskaya
Copy link

izarutskaya commented Dec 28, 2023

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: v1.4.18-3
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
Expensify/Expensify Issue URL:
Issue reported by: Applause-Internal Team
Slack conversation: @

Action Performed:

Precondition: applause.expensifail.com accounts are used.

  1. [User A] Create a group with User B and C.
  2. [User B] Go to the group chat and create an unassigned task.
  3. [User B] Delete account.
  4. [User A] Send a message to another chat. (Important).
  5. [User A] Log out and log back in.
  6. [User A] Click Search icon and look for the group chat.
  7. [User A] Go to the group chat and open the task report.

Expected Result:

In Step 6, the preview for the group chat will display the email of the closed account.
In Step 7, the task should be still accessible.

Actual Result:

In Step 6, the preview for the group chat displays "undefined".
In Step 7, the task is not accessible. Error page shows up.

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6327255_1703734595277.20231227_223604__1___1_.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013e5627e7dbd851e2
  • Upwork Job ID: 1740334595657314304
  • Last Price Increase: 2023-12-28
@izarutskaya izarutskaya 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 Dec 28, 2023
Copy link

melvin-bot bot commented Dec 28, 2023

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

@melvin-bot melvin-bot bot changed the title Task - Closed account shows "undefined" and task created by closed account is not accessible [$500] Task - Closed account shows "undefined" and task created by closed account is not accessible Dec 28, 2023
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 28, 2023
Copy link

melvin-bot bot commented Dec 28, 2023

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

Copy link

melvin-bot bot commented Dec 28, 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

Copy link

melvin-bot bot commented Dec 28, 2023

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

@DylanDylann
Copy link
Contributor

@s77rt Currently, we get task title based on the task report. But when the task creator account is closed, the BE will not return this task report to everyone in the group, the task title in the parent report is empty and we also can't access to the task report

@ankit-ashutec
Copy link

@s77rt While investigating this issue, I believe this problem has already been addressed by another pull request but has not been released yet. However, I have identified another issue where the task title is not displayed anywhere, as shown in the picture below.

Screenshot 2023-12-29 at 3 17 16 PM
Screenshot 2023-12-29 at 3 20 41 PM

@ankit-ashutec
Copy link

ankit-ashutec commented Dec 29, 2023

[Updated]

Proposal

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

  1. group chat will display the email and task title of the closed account.
  2. the task should be still accessible.

What is the root cause of that problem?

We obtain the task title from the BE , and when the user who created the task is deleted, the BE is not sending the task report as required for displaying the name and task.

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

The BE should also send the deleted user task report.

What alternative solutions did you explore? (Optional)

As @s77rt 's suggestion here, we will display deleted task if the task creator account is close

 return taskTitle ? Localize.translateLocal('task.messages.created', {title: taskTitle}) : Localize.translateLocal('parentReportAction.deletedTask');

And in TaskPreview.js, we need to prevent users from clicking on a task when the owner of that task's account has been deleted.

  const taskOwnerAccountID = Task.getTaskOwnerAccountID(props.taskReport);

    if (isDeletedParentAction || !taskOwnerAccountID) {
        return <RenderHTML html={`<comment>${props.translate('parentReportAction.deletedTask')}</comment>`} />;
    }

Task.js we just need to export getTaskOwnerAccountID.

Screenshot 2024-01-01 at 11 22 56 AM

@s77rt
Copy link
Contributor

s77rt commented Dec 29, 2023

@ankit-ashutec Thanks for the proposal. Your RCA is correct. I think we should go with the alternative solution as the BE cannot send deleted data. But instead of changing every instance where getTaskTitle is called, we change getTaskTitle directly:

fallbackTitle || Localize.translateLocal('parentReportAction.deletedTask');

Also we'd need to prevent clicking on that deleted task. Can you please update your proposal to cover that as well?

@DylanDylann
Copy link
Contributor

DylanDylann commented Dec 29, 2023

Proposal

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

Task - Closed account shows "undefined" and task created by closed account is not accessible

What is the root cause of that problem?

Currently, we get task title based on the task report. But when the task creator account is closed, the BE will not return this task report to everyone in the group, the task title in the parent report is empty and we also can't access to the task report

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

As @s77rt's suggestion here, we will display deleted task if the task creator account is close

if (isDeletedParentAction) {
return <RenderHTML html={`<comment>${props.translate('parentReportAction.deletedTask')}</comment>`} />;
}

So that we need to update like that

if (isDeletedParentAction || !taskTitle) {
        return <RenderHTML html={`<comment>${props.translate('parentReportAction.deletedTask')}</comment>`} />;
    }

With this approach, we also prevent users from clicking on the task report

We also update the same thing in the LHN

return Localize.translateLocal('task.messages.created', {title: taskTitle});

we should update like that

   return taskTitle ? Localize.translateLocal('task.messages.created', {title: taskTitle}) :  Localize.translateLocal('parentReportAction.deletedTask');

Result

Screenshot 2023-12-29 at 23 52 48

What alternative solutions did you explore? (Optional)

We also consider displaying another message like "Task is deleted because the creator account is closed" to avoid confusion

@s77rt
Copy link
Contributor

s77rt commented Dec 30, 2023

@DylanDylann Thanks for the proposal. Your RCA is correct. However the solution won't work as expected as an empty report object does not necessary mean that the task is deleted. This caused many existing tasks showing up as deleted.

@DylanDylann
Copy link
Contributor

DylanDylann commented Dec 30, 2023

@s77rt Updated proposal

Because we want to display [Deleted task] in this case we need to update the condition here

if (isDeletedParentAction) {
return <RenderHTML html={`<comment>${props.translate('parentReportAction.deletedTask')}</comment>`} />;
}

So that we also hide the checkbox before task title

If we change getTaskTitle directly:

fallbackTitle || Localize.translateLocal('parentReportAction.deletedTask');

[Deleted task] will display with the checkbox and the user still can access to task report by clicking on it

@s77rt
Copy link
Contributor

s77rt commented Dec 30, 2023

@DylanDylann Thanks for the update. That would work but I think I overlooked the isDeletedParentAction prop. The BE cannot send the deleted task report but it can still send its report action parent.

@DylanDylann
Copy link
Contributor

DylanDylann commented Dec 30, 2023

@s77rt This is task report action in this case
Screenshot 2023-12-30 at 22 27 24

There are no signs to recognize that the task creation account is now closed. So that isDeletedParentAction still be false

@s77rt
Copy link
Contributor

s77rt commented Dec 30, 2023

This should be internal. When a user closes his account we are deleting the linked tasks. Each task has a parent report action (or more - if share destination and assignee are different). We should update those report actions as follow:

previousMessage: reportAction.message
message: [
    type: 'COMMENT',
    html: '',
    text: '',
    isEdited: true,
    isDeletedParentAction: true,
]

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Dec 30, 2023

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

@s77rt
Copy link
Contributor

s77rt commented Dec 30, 2023

@DylanDylann That's the task parent report action. It's up to the BE to update it correctly when the task (child) is deleted.

@ankit-ashutec
Copy link

@s77rt I have updated my proposal here. It will resolve the issue mentioned here without requiring a backend update.

@s77rt
Copy link
Contributor

s77rt commented Jan 1, 2024

@ankit-ashutec Thanks for the update. I think this should be fixed internally as the parent report action is outdated. It can only be fixed in the BE.

@melvin-bot melvin-bot bot added the Overdue label Jan 3, 2024
@s77rt
Copy link
Contributor

s77rt commented Jan 3, 2024

@srikarparsi #33701 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Jan 3, 2024
@strepanier03 strepanier03 removed the External Added to denote the issue can be worked on by a contributor label Jan 3, 2024
@srikarparsi srikarparsi removed their assignment Jul 29, 2024
@melvin-bot melvin-bot bot added the Overdue label Aug 30, 2024
@strepanier03 strepanier03 added the Needs Reproduction Reproducible steps needed label Sep 3, 2024
@strepanier03 strepanier03 changed the title [HOLD for task cleanup] [LOW] [$500] Task - Closed account shows "undefined" and task created by closed account is not accessible [REPRODUCTION NEEDED] [HOLD for task cleanup] [LOW] [$500] Task - Closed account shows "undefined" and task created by closed account is not accessible Sep 3, 2024
@strepanier03
Copy link
Contributor

I tagged this for testing and if it can't be repro'd I'm going to close it.

@melvin-bot melvin-bot bot removed the Overdue label Sep 3, 2024
@strepanier03 strepanier03 added Weekly KSv2 Overdue and removed Monthly KSv2 labels Sep 3, 2024
@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

@melvin-bot melvin-bot bot removed the Overdue label Sep 3, 2024
@melvin-bot melvin-bot bot added the Overdue label Sep 11, 2024
@s77rt
Copy link
Contributor

s77rt commented Sep 12, 2024

Still waiting for repro ^

@melvin-bot melvin-bot bot removed the Overdue label Sep 12, 2024
@melvin-bot melvin-bot bot added the Overdue label Sep 20, 2024
@s77rt
Copy link
Contributor

s77rt commented Sep 23, 2024

Same ^

@melvin-bot melvin-bot bot removed the Overdue label Sep 23, 2024
@DylanDylann
Copy link
Contributor

Currently, after we close an account that creates the task, the task preview display is empty and when clicking the task, Not Found Page appears. Because we still save taskReportID in the action but the task report is deleted

Screen.Recording.2024-10-01.at.14.40.12.mov

@s77rt I think we need to confirm the expectation again

cc @srikarparsi

@s77rt
Copy link
Contributor

s77rt commented Oct 1, 2024

@DylanDylann Is the task preview text coming from the report action or the report?

Regarding task accessibility after account deletion, I have asked in Slack

@DylanDylann
Copy link
Contributor

DylanDylann commented Oct 2, 2024

Let's see the logic to return taskTitle in TaskPreview

return Object.hasOwn(taskReport, 'reportID') && 'reportName' in taskReport && typeof taskReport.reportName === 'string' ? taskReport.reportName : fallbackTitle;

In this case, Object.hasOwn(taskReport, 'reportID') is false. Because reportID doesn't exist in taskReport

Screenshot 2024-10-02 at 09 35 15

So this function will return fallbackTitle (fallbackTitle is action?.childReportName). But in this case, action?.childReportName is undefined

Screenshot 2024-10-02 at 09 37 50

@s77rt
Copy link
Contributor

s77rt commented Oct 2, 2024

@DylanDylann Ah okay got it! Thanks. Given the info we have the FE can we determine if a task is deleted?

@DylanDylann
Copy link
Contributor

DylanDylann commented Oct 2, 2024

@s77rt Yes, To determine if a task is deleted, we need two checks:

  • Check if this is the task: Using isCreatedTaskReportAction function
  • Check if this task is deleted: Checking taskReport.taskReportID

@DylanDylann
Copy link
Contributor

Anyways, we should confirm the expected first 😄

@melvin-bot melvin-bot bot added the Overdue label Oct 10, 2024
@s77rt
Copy link
Contributor

s77rt commented Oct 11, 2024

Just bumped the slack thread.

@melvin-bot melvin-bot bot removed the Overdue label Oct 11, 2024
@s77rt
Copy link
Contributor

s77rt commented Oct 11, 2024

@DylanDylann

Check if this task is deleted: Checking taskReport.taskReportID

I'm not sure if that would work. What if the task exists but we just don't have it in Onyx? I think we may need a BE change in the report action e.g. check against childStateNum

@strepanier03
Copy link
Contributor

Discussing here.

@strepanier03
Copy link
Contributor

Due to changing the prioritization and utilization of Tasks, we are going to close this and most if not all other bugs dealing with tasks.

Thank you all, closing this now.

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. Engineering Help Wanted Apply this label when an issue is open to proposals by contributors Internal Requires API changes or must be handled by Expensify staff Needs Reproduction Reproducible steps needed Weekly KSv2
Projects
No open projects
Development

No branches or pull requests

7 participants