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] Profile - Notification preference displayed when no comment in report #34176

Closed
3 of 6 tasks
kbecciv opened this issue Jan 9, 2024 · 20 comments
Closed
3 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@kbecciv
Copy link

kbecciv commented Jan 9, 2024

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: 1.3.24
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:

Issue found when executing PR #33387

Action Performed:

  1. Launch app
  2. Tap fab
  3. Tap start chat
  4. Select a new user with whom no previous chat history
  5. Tap on header

Expected Result:

In profile page, notification preference must not be displayed when there is no comment in report.

Actual Result:

In profile page, notification preference section is displayed when there is no comment/chat in report.

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

Add any screenshot/video evidence

Bug6336979_1704824035182.az_recorder_20240109_190136.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01cb16322001847cf2
  • Upwork Job ID: 1744792621694226432
  • Last Price Increase: 2024-01-16
@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 Jan 9, 2024
@melvin-bot melvin-bot bot changed the title Profile - Notification preference displayed when no comment in report [$500] Profile - Notification preference displayed when no comment in report Jan 9, 2024
Copy link

melvin-bot bot commented Jan 9, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01cb16322001847cf2

Copy link

melvin-bot bot commented Jan 9, 2024

Triggered auto assignment to @sonialiap (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 Jan 9, 2024
Copy link

melvin-bot bot commented Jan 9, 2024

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

@paultsimura
Copy link
Contributor

paultsimura commented Jan 9, 2024

Proposal

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

The notification preference is visible on the profile with no previous conversations.

What is the root cause of that problem?

When deciding whether to show the notification preference, we only check it to be not hidden, and the report object to be not empty:

const shouldShowNotificationPreference = !_.isEmpty(props.report) && props.report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;

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

We should explicitly check if the chat is not empty, similar to how we do it on the HeaderView:

const lastVisibleMessage = ReportActionsUtils.getLastVisibleMessage(props.report.reportID);
const isEmptyChat = !props.report.lastMessageText && !props.report.lastMessageTranslationKey && !lastVisibleMessage.lastMessageText && !lastVisibleMessage.lastMessageTranslationKey;
const shouldShowNotificationPreference = !_.isEmpty(props.report) && !isEmptyChat && props.report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;

const shouldShowNotificationPreference = !_.isEmpty(props.report) && props.report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;

We also make similar calculations here, we can move this calculation into a separate util function:

App/src/libs/ReportUtils.ts

Lines 3479 to 3480 in c0c4d64

const lastVisibleMessage = ReportActionsUtils.getLastVisibleMessage(report.reportID);
const isEmptyChat = !report.lastMessageText && !report.lastMessageTranslationKey && !lastVisibleMessage.lastMessageText && !lastVisibleMessage.lastMessageTranslationKey;

What alternative solutions did you explore? (Optional)

@dragnoir
Copy link
Contributor

dragnoir commented Jan 10, 2024

Proposal

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

Notification preference displayed when no comment in report

What is the root cause of that problem?

The profile page is not checking:

  • if the chat is empty
  • if there's no old deleted conversation

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

1- We need to check if the chat is empty same as in HeaderView

const isEmptyChat = !props.report.lastMessageText && !props.report.lastMessageTranslationKey && !lastVisibleMessage.lastMessageText && !lastVisibleMessage.lastMessageTranslationKey;

2- We need to check if there was a discussion before

function  areDatesEqual(lastReadTime, lastVisibleActionCreated) {
  // Removing the milliseconds part from the date-time strings
  const  lastReadTimeWithoutMillis  =  lastReadTime.substring(0, 19);
  const  lastVisibleActionCreatedWithoutMillis  =  lastVisibleActionCreated.substring(0, 19);
  
  // Creating Date objects
  const  lastReadDate  =  new  Date(lastReadTimeWithoutMillis);
  const  lastVisibleActionCreatedDate  =  new  Date(lastVisibleActionCreatedWithoutMillis);
  
  // Returning true if dates are equal, false otherwise
  return  lastReadDate.getTime() ===  lastVisibleActionCreatedDate.getTime();
}

const  result  =  areDatesEqual(props.report.lastReadTime, props.report.lastVisibleActionCreated);

3- Add to shouldShowNotificationPreference those 2 checks to make sure we can display the notifications setting.

const shouldShowNotificationPreference = !_.isEmpty(props.report) && props.report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;

Explaining:

The bug reported here is for the 1st time conversation, but I noticed if there's an old conversation and it's deleted, checking only if the chat is empty will not allow editing notifications settings.
And I think if someone receive a lot of messages (with lots of notifications) then those messages got deleted by the sender, I think the receiver still get the right to mute (or edit) notification.

I am not sure what's the righ way to do this (checking if there's an old deleted conversation) but I noticed there's a difference between lastReadTime and lastVisibleActionCreated in report details. I will try to ask the team on Slack about this.

Video of how deleted messages can lead to empty chat:

14.mp4

What alternative solutions did you explore? (Optional)

Add an utility on ReportUtils to handle this case.

@Victor-Nyagudi
Copy link
Contributor

I'm a little confused about the expected result here.

Could someone kindly explain how showing the notification preference when no messages have been sent is a bad thing? Does someone have to chat first before you can adjust the preference?

@dragnoir
Copy link
Contributor

@Victor-Nyagudi check #33387

@paultsimura
Copy link
Contributor

And I think if someone receive a lot of messages (with lots of notifications) then those messages got deleted by the sender, I think the receiver still get the right to mute (or edit) notification.

At first, I was thinking about this scenario as well, but it looks super unlikely considering the sender will have to remove each message manually. Moreover, if the chat report is empty, it disappears from LHN in both "Last seen" and "Focus" modes, so in such a case the recipient will have to go to the search, type in the sender's details, and mute them.
Therefore, making such a calculation for a super edge case each time a profile page is opened looked like an overkill for me.

@dragnoir
Copy link
Contributor

@paultsimura Let's agree to disagree :)

I was thinking about this scenario as well

It's not mentioned in your proposal even in the alternative solution

it looks super unlikely considering the sender will have to remove each message manually

it can be just one msg, mistake, wrong file..

it disappears from LHN

You can see on the video I attached, it doesn't disappear. The chat is open, msg removed and user (receiver) is not able to mute cayse msg deleted.

such a calculation

I don't see any calculation, it's just a condition.

super edge case

This is how great apps are built. Most of the issues areb super edge case but we enroll to make the app perfect.

Thanks for the details, I have confidance that the C+ will take the right decision.

@melvin-bot melvin-bot bot added the Overdue label Jan 12, 2024
@sonialiap
Copy link
Contributor

@akinwale what do you think of the above proposals?

@melvin-bot melvin-bot bot removed the Overdue label Jan 15, 2024
Copy link

melvin-bot bot commented Jan 16, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@akinwale
Copy link
Contributor

@dragnoir I reviewed both proposals, and the expected behaviour here is that there shouldn't be a notification preference displayed whenever the report is empty, so it doesn't matter if there were previous chats that have been deleted. As long as the report is empty, the preference should not be displayed.

After reviewing the proposals, we can move forward with @paultsimura's proposal.

🎀👀🎀 C+ reviewed.

Copy link

melvin-bot bot commented Jan 17, 2024

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

@Beamanator
Copy link
Contributor

Hmm @srikarparsi do you mind taking over this one since it has a lot to do with https://github.com/Expensify/Expensify/issues/330506, and specifically your changes in these two PRs?

@dragnoir
Copy link
Contributor

@akinwale I don't agree with you. For an app like expensify, perfection and focus on details is very important. The video I posted show the UX issue when someone is spamming then removing messages. Even when the app and the chat is open.

I totally repect you decision but I don't agree with you. It will be another issue opened later for sure.

@melvin-bot melvin-bot bot added the Overdue label Jan 19, 2024
@srikarparsi
Copy link
Contributor

Hey! I don't believe this is reproducible anymore since the Auth PR hit production yesterday. This makes sure that new DMs are set to hidden by default and the App PR ensures we don't show the hidden notification preference in the settings pane.

image

I believe we should be able to close this out?

@paultsimura
Copy link
Contributor

That's sad but seems like you're right @srikarparsi, I cannot reproduce either 🙂

@Beamanator
Copy link
Contributor

That's great! Happy to close this out

@melvin-bot melvin-bot bot removed the Overdue label Jan 22, 2024
@dragnoir
Copy link
Contributor

@paultsimura that was a nice debate, thx for the spirit :)

@paultsimura
Copy link
Contributor

@paultsimura that was a nice debate, thx for the spirit :)

You too, man 💪

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

8 participants