-
Notifications
You must be signed in to change notification settings - Fork 25
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
channels: more accurate unread counts #3119
Conversation
Instead of re-deriving recency based on the unread threads. That re-deriving was causing inaccurate results for whatever reason, and was 100% going to be slower than just reading the recency. Fixes LAND-1393.
In addition to providing a total "count", we now also provide an individual count for top-level "unread", as well as each "threads" entry. This way, clients may display accurate unread counts for each context. Partially fixes LAND-1394, frontend changes still pending.
Otherwise we run a small risk of ordering shenanigans.
be58f62 updated the unread types for channels to provide per-context counts. Here, we do the same for chats.
We now have access to per-context unread counts. We make sure to include those in the DateDividers.
After review, we have concluded one of these functions can go entirely (it is unused), and the TODO for the other is invalid: the response still depends on ordering of the respective unreads.
…the main chat, not just the oldest one
…s rather than relying on derrived values
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.
LGTM
(lot:on-v-replies:c replies.u.u.parent `last-read.remark.channel ~) | ||
|= [tim=time reply=(unit v-reply:c)] | ||
?& ?=(^ reply) | ||
!=(author.u.reply our.bowl) | ||
== | ||
:- (add sum (lent unreads)) | ||
=/ count=@ud (lent unreads) |
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.
NB: I don't like reusing the name here but it was already doing that for unreads
.
Actually the top-level count (not the total) provided by this is inaccurate for cases where both a top-level message with replies is below the top-level marker: in that case the replies should be included in the top-level count, but aren't. Fixing... Edit: Apparently the current behavior is desired. Not fixing! |
…, rename unread method to make its purpose clearer and handle empty unreads properly without relying on separate checks at callee site
…when the component unmounts instead of any time the dependencies update
… an instance of simplified code we may want to revisit
Label |
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.
lgtm lets test on binnec
// TODO: chesterton's fence, but why execute a read here? | ||
useChatStore.getState().read(whom); |
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.
holdover from bad behavior during rewrite
The improvement here is two-fold:
First, we no longer recalculate the "most recent content" timestamp when marking a channel as read. Instead, we simply reuse the
.recency
which we were already tracking anyway. I don't remember why we thought we had to re-derive that on the spot. (2928b4b)Second, we update the
$unread
type to provide, in addition to the total unread count, sub-counts for each context in which unreads may exist: top-level and within reply threads. (be58f62)Draft because this does not yet include the frontend updates required for the latter change. cc @patosullivan
For LAND-1393 and LAND-1394.
Fixes LAND-1412