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

[Awaiting payment] [$1000] After deleting an attachment, the LHN shows '[Attachment]' instead of 'No activity yet' until you delete one more message #24246

Closed
1 of 6 tasks
mvtglobally opened this issue Aug 8, 2023 · 60 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review Weekly KSv2

Comments

@mvtglobally
Copy link

mvtglobally commented Aug 8, 2023

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. Log in to userA's account.
  2. Go to Settings > Workspace > New Workspace.
  3. Go to Member > Invite > Select user B.
  4. Go to the 'announce' chat of the created workspace.
  5. Pin the 'announce' chat to view the LHN properly.
  6. Open another browser and login with userB’s account.
  7. Go to the 'announce' page of userA's workspace.
  8. Send an image to the announce chat.
  9. Go back to userA’s account.
  10. Send a message and delete it.
  11. Now go to the userB’s account and delete the attachment.
  12. Notice userA’s LHN displays '[Attachment]' instead of 'No activity yet'.

Expected Result:

After deleting an attachment, 'No activity yet' should be displayed in the LHN for userA

Actual Result:

After deleting a file, '[Attachment]' is shown in the LHN instead of 'No activity yet' until you delete one more message

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.48-0
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-08-01-at-15626-am_xKx12L9W.1.mp4
Recording.5769.mp4

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0188933d8c36eb686a
  • Upwork Job ID: 1688791645877243904
  • Last Price Increase: 2023-08-22
  • Automatic offers:
    • pradeepmdk | Contributor | 26490195
@mvtglobally mvtglobally added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 8, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 8, 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

@kadiealexander
Copy link
Contributor

kadiealexander commented Aug 8, 2023

Repro:

image

@kadiealexander kadiealexander added the External Added to denote the issue can be worked on by a contributor label Aug 8, 2023
@melvin-bot melvin-bot bot changed the title After deleting an attachment, the LHN shows '[Attachment]' instead of 'No activity yet' until you delete one more message [$1000] After deleting an attachment, the LHN shows '[Attachment]' instead of 'No activity yet' until you delete one more message Aug 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 8, 2023

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

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

melvin-bot bot commented Aug 8, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 8, 2023

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

@dukenv0307
Copy link
Contributor

It seems this issue relate to lastMessageTranslationKey that we haven't done from BE side

@melvin-bot
Copy link

melvin-bot bot commented Aug 8, 2023

📣 @msapple0338! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@kaushiktd
Copy link
Contributor

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

After deleting an attachment, the LHN shows '[Attachment]' instead of 'No activity yet' until you delete one more message

What is the root cause of that problem?

There is an issue with isReportMessageAttachment condition on the below file:
https://github.com/Expensify/App/blob/main/src/libs/OptionsListUtils.js#L385

if (ReportUtils.isReportMessageAttachment({ text: report.lastMessageText, html: report.lastMessageHtml, translationKey: report.lastMessageTranslationKey })) {
   lastMessageTextFromReport = `[${Localize.translateLocal(report.lastMessageTranslationKey || 'common.attachment')}]`;
}

If we reset the value of lastMessageTranslationKey, still it will return the last value as [Attachment] because of the fixed return value in above mention condition

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

You need to adjust isReportMessageAttachment condition, you need to pass only the last message to this function and return the last message like below:

if (ReportUtils.isReportMessageAttachment(report.lastMessageText)) {
    lastMessageTextFromReport = report.lastMessageText;
}

Video:

https://drive.google.com/file/d/1ebi89ipx5JJg10Ju-8XyTt8bU4G7gL47/view?usp=sharing

@kaushiktd
Copy link
Contributor

@msapple0338 you talking to me?

@pradeepmdk
Copy link
Contributor

pradeepmdk commented Aug 8, 2023

Proposal

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

After deleting an attachment, the LHN shows '[Attachment]' instead of 'No activity yet' until you delete one more message

What is the root cause of that problem?

if (ReportUtils.isReportMessageAttachment({text: report.lastMessageText, html: report.lastMessageHtml, translationKey: report.lastMessageTranslationKey})) {

Screenshot 2023-08-08 at 7 04 36 PM
in the backend whenever the previous message has the attachment lastMessageTranslationKey this key will come with value.
if (translationKey) {
return translationKey === CONST.TRANSLATION_KEYS.ATTACHMENT;

so return true here

Scenario is
two scenarios we have the same issue with this lastMessageTranslationKey

Screenshot 2023-08-08 at 7 13 11 PM
In this image take Scanrio 1

  1. user 1 send an attachment (both User LHN updated correctly)
  2. after that user 2 send a text (user2 LHN updated correctly but user 1 still have the attachment only )

this current issue was Scanrio 2 (let's do it in the reverse)

  1. delete user2 message (both User LHN updated correctly)
  2. now go to user 1 and delete the image (user1 LHN updated correctly but user 1 still has the attachment only)

so the issue was whenever the previous messages have an attachment action done user LHN updated correctly but another user still have the lastMessageTranslationKey value.

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

  1. client side
    https://github.com/Expensify/App/blob/d7966ec272c9c07880f4234a82347bec0a0dac77/src/libs/isReportMessageAttachment.js
     if (translationKey && text ==  CONST.ATTACHMENT_MESSAGE_TEXT) {
        return translationKey === CONST.TRANSLATION_KEYS.ATTACHMENT;
    }

this commit introduce this translationKey
d7966ec#diff-c602eb4edf1629daa2e6ddacdd5ec695a1ba0aec8932696e93e3fc5b41432073

  1. need to fix the backend side
    lastMessageTranslationKey should be empty only when text : '[Attachment]' has value its should return the value

@dummy-1111
Copy link
Contributor

Proposal

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

After deleting an attachment, LHN still shows [Attachment] instead of No activity yet until you delete one more message

What is the root cause of that problem?

When deleting the attachment, the report receives the following event
image

But before deleting the attachment, userA sends a message and delete it. When deleting a report, we create an optimistic report with the following value

            optimisticReport = {
                lastMessageTranslationKey,
                lastMessageText,
                lastVisibleActionCreated,
                lastActorAccountID,
            };

The last message is an attachment and so lastMessageTranslationKey is set to CONST.TRANSLATION_KEYS.ATTACHMENT

if (isReportMessageAttachment(message)) {
return {
lastMessageTranslationKey: CONST.TRANSLATION_KEYS.ATTACHMENT,
};
}

The updates userA received when userB deleted the attachment has no lastMessageTranslationKey value and so this property of the report wasn't updated. When we get lastMessageText from the report for LHN, we first check if the last message is an attachment as you can see below
https://github.com/Expensify/App/blob/fdcae9ff99696a1ac6068efbfe8927e1bcf108b7/src/libs/OptionsListUtils.js#L385C9-L385C46

In this function, we check the lastMessageTranslationKey. This property of the report has an old value and so isReportMessageAttachment returns true thoughthe attachment was deleted and we get the last message [Attachment]

This is the root cause

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

I'd solve this issue based on the assumption that attachment must have text or html. In isReportMessageAttachment function, make the following change

-    if (translationKey) {
-        return translationKey === CONST.TRANSLATION_KEYS.ATTACHMENT;
-    }
-
     if (!text || !html) {
         return false;
     }
 
+    if (translationKey) {
+        return translationKey === CONST.TRANSLATION_KEYS.ATTACHMENT;
+    }

And add the following change here

-                lastMessageText,
+                lastMessageText: lastMessageTranslationKey ? Localize.translate(lastMessageTranslationKey) : lastMessageText,
Result

What alternative solutions did you explore? (Optional)

@thesahindia
Copy link
Member

@kadiealexander, please reassign it to a new C+.

@thesahindia thesahindia removed their assignment Aug 9, 2023
@pradeepmdk
Copy link
Contributor

@kadiealexander there is no c+ member can you assign for review

@melvin-bot melvin-bot bot added the Overdue label Aug 11, 2023
@kadiealexander kadiealexander added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Aug 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 13, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 13, 2023

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

@kadiealexander
Copy link
Contributor

@eVoloshchak thank you for picking this one up off @thesahindia!

@melvin-bot melvin-bot bot removed the Overdue label Aug 13, 2023
@Li357
Copy link
Contributor

Li357 commented Sep 4, 2023

Hmm, I tried to add @pradeepmdk as an external contributor on this and Melvin seems to think you're the contributor @eVoloshchak

@pradeepmdk
Copy link
Contributor

@Li357 looks like mapping worked correctly. I got the offer

@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2023

@eVoloshchak @Li357 @pradeepmdk @kadiealexander this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:

  • Decide whether any proposals currently meet our guidelines and can be approved as-is today
  • If no proposals meet that standard, please take this issue internal and treat it as one of your highest priorities
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

@melvin-bot melvin-bot bot added Internal Requires API changes or must be handled by Expensify staff and removed External Added to denote the issue can be worked on by a contributor labels Sep 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2023

Current assignee @eVoloshchak is eligible for the Internal assigner, not assigning anyone new.

@pradeepmdk
Copy link
Contributor

@eVoloshchak Pr is ready

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@eVoloshchak
Copy link
Contributor

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:

  • The PR that introduced the bug has been identified. Link to the PR: the logic was added in Fix: Translation for system message #21780, but I wouldn't say the bug was introduced by this PR, this was mainly a BE issue we resolved on FE. Still leaving a comment on the PR to myself and others to test more complex test cases

  • The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: https://github.com/Expensify/App/pull/21780/files#r1337040240

  • A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: Don't think an additional discussion is needed, this isn't a new type of bug, just something we should test more thoroughly for

@eVoloshchak
Copy link
Contributor

Regression Test Proposal

  1. Log in to userA's account.
  2. Go to Settings > Workspace > New Workspace.
  3. Go to Member > Invite > Select user B.
  4. Go to the 'announce' chat of the created workspace.
  5. Open another browser and login with userB’s account.
  6. Go to the 'announce' page of userA's workspace.
  7. Send an image to the announce chat.
  8. Go back to userA’s account.
  9. Send a message and delete it.
  10. Now go to the userB’s account and delete the attachment.
  11. Verify userA’s LHN displays 'No activity yet'.

Do we agree 👍 or 👎

@eVoloshchak
Copy link
Contributor

The automation for this failed for some reason, instead creating a payment issue: #27374, so posting a BugZero Checklist manually here

cc: @kadiealexander

@pradeepmdk
Copy link
Contributor

i think bot is not triggered for payment.
cc: @kadiealexander

@kadiealexander
Copy link
Contributor

kadiealexander commented Oct 5, 2023

Payouts due:

Eligible for 50% #urgency bonus? No

Upwork job is here.

@JmillsExpensify
Copy link

$1,000 payment approved for @eVoloshchak based on BZ summary.

@eVoloshchak
Copy link
Contributor

@kadiealexander, this one can be closed I think

@ayazhussain79
Copy link
Contributor

@kadiealexander could you please approve the payment on upwork

@kadiealexander
Copy link
Contributor

kadiealexander commented Nov 5, 2023

@ayazhussain79 please apply in Upwork

@kadiealexander kadiealexander reopened this Nov 5, 2023
@kadiealexander kadiealexander changed the title [$1000] After deleting an attachment, the LHN shows '[Attachment]' instead of 'No activity yet' until you delete one more message [Awaiting payment] [$1000] After deleting an attachment, the LHN shows '[Attachment]' instead of 'No activity yet' until you delete one more message Nov 6, 2023
@ayazhussain79
Copy link
Contributor

@kadiealexander offer already accepted, sent you message on upwork

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 Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

12 participants