nheko
nheko copied to clipboard
Line to indicate first unread message
Closes #560.
This PR makes it so that if a room has unread messages, a line will appear to show the user the last read message/first unread message since the room was last opened. A feature that I felt was so sorely needed that I had to de-rust my Qt knowledge to implement it.
As it stands in its current state, this PR has a few problems. In no particular order:
- If the last read event was one of a handful, the line will not show up. These events are any that aren't conventionally showed as a message (most notably redactions and reactions)
- If the last "read" event was hidden through nheko's "Hidden events" room option, the line will also be hidden
- To get the ID of the last read message, it currently runs getLastFullyReadEventId twice, once directly and once indirectly
- If the line is being shown and the user sends a message, the line doesn't disappear
Handling the line disappearing on some events has been the one that's been nagging me the most so far, I still haven't found a good way of solving it.
For the invisible events stuff, check out the "cache::lastInvisibleEventAfter" function as well as the getEventIndex function. They are used in the setCurrentIndex function to calculate where to send the next read receipt. I think you can use something similar to calculate the line position, just the other way around.
With that one out of the way, the other problems mentioned shouldn't be too hard or blockers. I still want to improve on the possible performance problems we talked about.
I'll review it in ~10h, I hope. Was a bit too busy today, sorry!
So this seems to work nicely, but it is a bit confusing, that the line doesn't vanish after some time. How about running a timer if the line is visible and then moving it down to the last visible event or so?
Also do you have any other concerns or are you happy with it as is?
Happy with it as it is.
Thanks, I will merge it as is then and if people complain, we will see :3
Nheko 0.10.2 is now in Debian testing, but I do not see any line next to the first unread message in Nheko on my Pinephone... shall I activate it somehow? How is this line supposed to look?
It is not in a released version yet, 0.10.2 was just a bugfix release.
Oh, I had seen this was pulled into master and then I assumed 0.10.2 was tagged out of master... Sorry for that!
I can confirm this feature works very well on pinephone (I compiled the .deb)
Great! Does this feature make #1146 sort of unneeded ?
@tiol11
this PR just adds the line, but it doesn't jump to it
I think #1146 is a different feature request
Understood, I was just curious if the user experience has really improved after this PR, as you've built the package yourself. I mean, you have to scroll manually instead of pushing a button, but at least you know where to stop scrolling and start reading without reading every message you're scrolling... :)