Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[HOLD] [WIP] Introduce "Mark as unread" functionality in Expensify.cash #1774
[HOLD] [WIP] Introduce "Mark as unread" functionality in Expensify.cash #1774
Changes from all commits
1cc91b4
5ef40a4
a02bcd2
1a5705b
74daa6d
dad6a80
36eae89
4076540
814f85e
a17f189
60aa19b
9506213
939c1ea
6cebb71
0c43eb9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than add an
ignoreOrder
flag that basically says "don't run this function" would it make more sense to not call the function in the first place.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? It only skips checking the order, though. It runs the rest of the function. Basically, it prevents the function from checking that the new "latest read" is at the end of the conversation. That check is relevant when new messages come in, but not when we are manually marking messages as unread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm maybe we should remove that logic as well.. this logic is confusing and even with the added comment I'm having some trouble understanding in what other contexts this should be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm trying to think of a better suggestion for this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so here is my confusion and would like to get @tgolen's thoughts to see if I'm missing something.
I'm not sure I understand why we need to get the last action from the sorted actions here to mark everything as read...
https://github.com/Expensify/Expensify.cash/blob/c5cb5076dc092ee5246e3410e4557fc2d55b4a88/src/pages/home/report/ReportActionsView.js#L266-L278
Here we are looking at the
sequenceNumber
on the last action... but this information is already available to theactions/Report
andmaxVisibleSequenceNumber
is kind of a misnomer since it has nothing to do with visibility.We are filtering out the "loading" actions, but that too could be done in the
actions/Report
file I think.If that's true then we wouldn't need an
ignoreOrder
and could makesequenceNumber
optional and the logic for this method could then end up beingNot sure if we need to do this change right now, but it seems more intuitive to "set to the most recent
sequenceNumber
when none is passed or use the one specified".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to dig into this a little so I'm going to pull the branch down and dive into it. I want to make sure I understand everything before offering up further comments on this thread. Thanks for being patient with me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love coming at it from this angle, and I agree it is much more intuitive.
I briefly looked at this, and I am pretty concerned that changing
reportMaxSequenceNumbers
to not include loading actions has a high risk of breaking things. I would be more comfortable with keeping a separatereportMaxSequenceNumbersForNonLoadingActions
(lol at that ugly name).It makes a lot of sense to me to move this logic from the view into the action file: https://github.com/Expensify/Expensify.cash/blob/c5cb5076dc092ee5246e3410e4557fc2d55b4a88/src/pages/home/report/ReportActionsView.js#L266-L278
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid I'm the one who is lost now.
What do you mean by loading/not loading actions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the
ReportActionsView.js
, when it callsupdateLastReadActionID
, it is passing themaxVisibileSequenceNumber
. It gets that number by getting all the report actions and filtering out the ones withaction.loading
. This is what we are referring to.What I would like to see for a solution is to have
ReportActionsView.js
updated so that all it does is this:and also:
All the rest of the logic will then be encapsulated into the
actions/Report.js
file.Does that help clarify what we are asking for? It doesn't spell out the changes needed in
Report.js
, so let me know if you need help with that as well. I think this will be enough to point you in the right direction though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB, one small side effect of this change is that we are now recreating this object with each render. I don't think it will cause problems tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than recreating this object with every render, I think we should convert this to a class component, make
contextActions
a property of the class, then set it once incomponentDidMount
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or the
constructor()