Closed anmurali closed 1 month ago
@blimpich, are you already working on a solution to this issue?
Yes and no. https://github.com/Expensify/Expensify/issues/365156 has many similarities. Lets break it down into use cases:
From my understanding this issue covers use case number 1. https://github.com/Expensify/Expensify/issues/365156 covers 2, 3, and 4. They are handled differently because number 1 doesn't require a receipt because no money has been exchanged yet. 2, 3, and 4 are all cases where money moved, so we have to follow regulatory requirements and give a lot more information in the email notification.
So @marcaaron and I will probably end up making very similar looking PRs but they will probably need to be separate PRs because of the different requirements.
That being said we should definitely be consistent with the behavior of our summary emails. So to answer this question:
so we don’t care if the “unread summary” comes out of order?
I would say yes, we do care. We don't want redundant emails, and the email inbox should be chronological. The proposed solution that a few of us in #vip-split decided on was to send the current batch of unread messages before sending the custom subject email.
They are handled differently because number 1 doesn't require a receipt because no money has been exchanged yet. 2, 3, and 4 are all cases where money moved, so we have to follow regulatory requirements and give a lot more information in the email notification.
Okay, got it. That's where I thought the "custom footer" part comes into it - but the logic for when a custom subject email is sent for a request would be shared. I.e this part:
The proposed solution that a few of us in #vip-split decided on was to send the current batch of unread messages before sending the custom subject email.
Quick heads up that raising the PR for what I described in this comment could to take me some time as I'm shifting priorities to get the Group Chats project shipped ASAP. But, it sounds like that's not what we want anymore. @blimpich can you confirm?
What I've got done for this issue so far:
Result:
So - it's getting there...
send the current batch of unread messages before sending the custom subject email
This is kind of the solution that I started with - if that's how we want to handle things then I don't think we should create a new job at all. It sounds like we just need to add some behavior to "flush" the comments then immediately send another notification for the money request.
So @marcaaron and I will probably end up making very similar looking PRs but they will probably need to be separate PRs because of the different requirements.
If we can do the main logic for this in one PR that would be good. It sounds like the "flush comments and send money request notification" is the behavior that we want. So, let's set that up for everything. Then come back here after and add the finishing design touches on this one and it can be closed?
That sounds good. I have some of the logic for this figured out already in this draft PR. You can see I used some of the bits of code from your PR there, so yeah, there is definitely overlap. I made a function that flushes out the unread notifications called sendQueuedNotificationsForOfflineParticipantsImmediately
which should work for both of our cases.
The only thing is that I'm also not going to be the fastest on this since I'm working my way through the design doc process. It is my main priority but I am partly blocked until I can get the go-ahead on my detailed design. Once that's done my PR should go through pretty quickly and then resolving this issue should be a lot simpler.
So @marcaaron you'll prioritize Group Chats while I work on p2p receipts, which should save you some work when you get freed up next. Sound like a plan?
@blimpich Sounds pefect. And no worries I don't think this one is super urgent.
Lemme know if you need an extra set of eyes on the design doc front 🤙
Holding this at a lower priority for now.
Still holding - I am focused on Group Chats. I will try to hand this off.
As I might pick this up, let me understand a few things.
@trjExpensify based on your comment here: https://github.com/Expensify/App/issues/34167#issuecomment-1948268556
Is this still the behavior we want?
If it is, when are we considering that user A requested money? When the report is submitted, when user A creates a report with an expense, or every new expense created in a report should fire an email?
I don't think it is, @rlinoz. The desired behaviour is linked here.
I would say yes, we do care. We don't want redundant emails, and the email inbox should be chronological. The proposed solution that a few of us in #vip-split decided on was to send the current batch of unread messages before sending the custom subject email.
@rlinoz are you still interested? I would definitely welcome the help as I am focused on launching Group Chats atm
The mentions v2 design doc got reviewed in the meantime and I started working on those issues, sorry
I am blocking this issue here so gonna un-assign myself for now and apply the Hot Pick label. I have a large number of Group Chats issues to follow up on and won't have time to look at the changes above for a while. Sounds like we have a general plan to move forward on so happy to answer any related questions if they come up.
What remains here? Is it just implementing the part to use @blimpich's sendQueuedNotificationsForOfflineParticipantsImmediately
to send any unread comments that might be in and around the request so they’re in chronological order?
@blimpich what's the state of that PR you linked there? I see it was closed - did we/are we opening a new one?
I think this is where we're at:
Proposal: Send the current batch of unread messages before sending a separate custom email for new money requests
Background:
When a user requests money from another user we currently:
<Sender> requests <amount>
parentReportID
i.e. the “parent” workspace or DM chat of the requestProblem:
If there are already unread messages for the user we are notifying those will also display in this same email. This unnecessarily hides comments inside an email that appears to notify you of about one thing.
Solution:
Does that sound correct to everyone?
That sounds right to me! @anmurali, what about you?
@marcaaron for the solution one clarifying question: does the flushing of existing notifications and queuing of a separate notification for the request action happen immediately upon the user creating the request? It doesn't wait 10 minutes right?
Correct. It should be immediate.
@cristipaval Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
I'm ooo this week. This issue will be my top priority next week.
Making this a daily and starting on it today.
I'm still working on it. What I found so far is that when a money request is created, the NotifyOfflineUsersAboutActivity
job runs instantly for the IOU/expense report, not for the parent chat. I need to get the parent chat's reportID
and call the sendQueuedNotificationsForOfflineParticipantsImmediately
function for it before.
Right now I'm working on getting the parent chat's reportID
, but get it the right way, with no additional Auth call.
I'll do my best to spend a bit of time today on this. Currently working on a #newdot-quality issue.
^PR up that makes the pending email with the activity to be flushed before the email with the money request
I'll continue on this one after finishing my #newdot-quality issue from my plate
I'm writing the detailed section for the Instant Submit for Control plans, which has higher priority
I'm stepping back from this as I have a critical #newdot-quality issue and other wave-control stuff on my plate.
This issue has not been updated in over 15 days. eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
@cristipaval it would be helpful if you could provide a quick summary of what's left to do for this issue, now it's back in the pool. I see the Web PR is deployed: https://github.com/Expensify/Web-Expensify/pull/42416
But then, it's unclear what needs to happen next?
I'll continue on this one after finishing my #newdot-quality issue from my plate
I think this is where we're at:
Proposal: Send the current batch of unread messages before sending a separate custom email for new money requests
Background:
When a user requests money from another user we currently:
- Queue an immediate notification (i.e. NotifyOfflineUsersAboutActivity will run as soon as possible)
- The subject line will get updated to read
<Sender> requests <amount>
- The report link takes you to the
parentReportID
i.e. the “parent” workspace or DM chat of the request- The “Pay” button takes you directly to the expense report itself
Problem:
If there are already unread messages for the user we are notifying those will also display in this same email. This unnecessarily hides comments inside an email that appears to notify you of about one thing.
Solution:
- Flush any existing notifications for other report actions first (without the request action)
- Queue a separate notification for the request action with the custom subject and correct report link
Does that sound correct to everyone?
This is the PS that we all agreed on, here.
From the above, we partially implemented the Solution as follows:
- Flush any existing notifications for other report actions first (without the request action)
This was implemented in this PR
- Queue a separate notification for the request action with the custom subject and correct report link
We already have a separate email notification for the money requests. We need to audit to make sure it has the correct title and also verify where the Pay button links to: the parent report (policy chat) or the IOU/expense report.
The subject line will get updated to read
requests
Marc updated that a while back here I believe.
The “Pay” button takes you directly to the expense report itself
Vivek fixed that here.
So this is how it looks:
One caveat, it's now not sending at all because of this change, but we're talking about how to resolve this here.
Are we good to close this issue then? 🤔
If that's all you were doing as a next step, yep. Go ahead!
Context here Summarizing what we want with email notifications for money requests:
We want to continue to notify the user immediately via email when they receive a money request
We want to use a subject line for this notification, which is different from the report title so as to make it cleaner, more legitimate and more appealing to the receiver
We will update
NotifyOfflineUsersAboutActivity
to recognize when someone sends a money request -- and in that case:We want this subj line to be satisfying, i.e. it should ideally say who is asking you, and how much they are asking for. So in this case, the custom subject line will read
<Sender> requests <currency><amount>
Sender - Use first and last name if available or fall back to sender's email/ SMS login info
NOTE: Here is the last solution we agreed upon.