-
Notifications
You must be signed in to change notification settings - Fork 287
[meta] Latest Event API, the missing one #4112
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
Comments
Regarding product/design questions. As we were tackling this in a slightly more specific context with @americanrefugee (which was to show local echos and the fact if the room has any pending or failed messages), our guiding principle was consistency between the timeline of the room and the room list - whatever is the latest event in the room, should be also shown in the room list. I think for most scenarios this works well+ from user perspective and its additional benefit is that it saves us from potentially long conversations discussing what a good alternative logic is. Or from explaining this to users if they do not follow that logic. About the specific questions, then:
Yes (I guess), although I would specify this as: if it edited the last message in the room timeline.
Message has been redacted. If this not helpful, we better offer an option to hide redacted messages at all.
I can't any imagine any useful scenario. Showing reactions on the latest message of the timeline, but that is probably also quite far fetched.
By the guideline, it is the local echo (as it should be the one that appears at the bottom of the timeline). Additionally, we would also indicate that the room has pending messages. Also, I do not think it is a very frequent scenario when you have a pending message for several hours but then you get new messages - unless you upload a gigabyte-size video, or?
As the point of the Thread is not to "pollute" the main timeline, I think its messages should also not appear in the room list. |
… timeline As per the plan defined in #4718: ``` the room_list_service::room::RoomInner shouldn't make use of its inner timeline; it's only used in a direct getter, or to compute the latest room event, but it's not working as intended, since local echoes aren't properly displayed in the room list. This non-working feature can be removed, in favor of #4112 ```
… timeline As per the plan defined in #4718: ``` the room_list_service::room::RoomInner shouldn't make use of its inner timeline; it's only used in a direct getter, or to compute the latest room event, but it's not working as intended, since local echoes aren't properly displayed in the room list. This non-working feature can be removed, in favor of #4112 ```
… timeline As per the plan defined in #4718: ``` the room_list_service::room::RoomInner shouldn't make use of its inner timeline; it's only used in a direct getter, or to compute the latest room event, but it's not working as intended, since local echoes aren't properly displayed in the room list. This non-working feature can be removed, in favor of #4112 ```
The Latest Event represents the event that is displayed in the Room List under each room item, or displayed as a Thread Summary. It is important, and must be reactive. It follows several constraints, such as:
The Latest Event API in its current form was added a bit in an ad-hoc way, since we needed the feature but lacked the proper storage layer for events, and the proper send queue. What we can re-use though is all the logic to find a suitable event, which was not trivial to write in an efficient way knowing we have to deal with encrypted event and so on.
Today is different: We have the Event Cache API, and we have the Send Queue API. Those are the two components we need to write a proper Latest Event API! I love it when a plan comes together.
The Latest Event API in its current form is scattered in multiple crates. It's going to be hard to “migrate”, or move things together. The plan we came up with the team is to write a new API from scratch, and then migrate the components using a Latest Event one by one.
Important
Storage
A note about the storage. The Event Cache API has its own storage. The Send Queue API has its own storage. The Latest Event API will be computation only, no storage is required, and that will solve multiple problems. Right now, the Latest Event is stored in
RoomInfo
, which is not a good place.Important
Thread
Another note about threads. The Latest Event API in its current form is only used by the Rooms. But we need it to work with Threads too, as it is required for Thread Summary.
Product decisions/questions
Plan
Create the Latest Event API
matrix_sdk::latest_events::LatestEvents
LatestEvents
is lazy, it computes and keeps only requestedLatestEvent
s in memoryLatestEvents
does not run one task per room or thread; ideally we want one or two tasks to handle all our needs, so that it reduces the pressure on the systemLatestEvent
typeLatestEventSubscriber
typeStream<Item = LatestEvent>
LatestEventSubscriber
, lets' drop it fromLatestEvents
LatestEvents
listens to the Event Cache for remote eventsLatestEvents::subscribe_to_room(&self, &RoomId) -> (Option<LatestEvent>, LatestEventSubscriber)
(note:Option<LatestEvent>
to handle the case where there is no suitableLatestEvent
)LatestEvents::subscribe_to_thread(&self, &RoomId, &EventId) -> (Option<LatestEvent>, LatestEventSubscriber)
LatestEvents
uses the Event Cache to find a suitable eventLatestEvents
listens to the Send Queue for local eventsLatestEvent
Use the Latest Event API
matrix_sdk_ui::room_list_service
usesLatestEvents
room_list_service::Room::latest_event()
usesLatestEvents
to retrieve a singleLatestEvent
Timeline
to fetch theLatestEvent
!room_list_service::RoomList::entries_with_dynamic_adapter()
should not need any modification (see next section)Notify
matrix_sdk::Room
when theLatestEvent
changesmatrix_sdk::Room
when theLatestEvent
changesRoomInfoNotableUpdate
toRoomNotableUpdate
RoomInfoNotableUpdateReasons
toRoomNotableUpdateReasons
LatestEvents
is able to send aRoomNotableUpdate
by itself, with the reasonRoomNotableUpdateReasons::LATEST_EVENT
Clean up
LatestEvent
API wherever it livesSee also
matrix_sdk_ui::timeline
, but it should move inside the Event Cache soon. How it will interact with the Latest Event API is still unclear but ultimately should be transparent (theRoomEventCache
stream of updates should notify that a new event has been updated, and the machine should handle that seamlessly).Part of #3058.
David (Bernini)
The text was updated successfully, but these errors were encountered: