1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-19 16:42:09 +03:00
Commit Graph

25 Commits

Author SHA1 Message Date
Kegan Dougal
d16dfdaee3 Also emit a 'RoomState.members' event for m.room.power_levels 2015-12-04 16:11:13 +00:00
Kegan Dougal
02b836698c More clarity on cache updating 2015-10-21 14:07:14 +01:00
Kegan Dougal
5888c8a56c Commenting on splice 2015-10-21 13:47:23 +01:00
Kegan Dougal
1cee7bf397 JSDoc 2015-10-21 13:30:32 +01:00
Kegan Dougal
cab7a71a94 Change calculating display names from O(n^2) to O(n)
Reduces initial sync times from ~30s to ~1s on accounts with heavily
populated rooms.

The problem was that f.e. RoomMember it would try to calculate the
display name, which involved looping each RoomMember to get their
display name to check for disambiguation. We now cache display names
to user IDs so we don't need to loop every member when disambiguating.
2015-10-21 13:25:23 +01:00
Kegan Dougal
cde948814a Linting (jsdoc) 2015-10-13 10:20:38 +01:00
Kegan Dougal
2bb65fe644 Add RoomState.getLastModifiedTime() and JSDoc 2015-10-13 10:18:01 +01:00
Kegan Dougal
c289c70f27 SYJS-17: Update the core event dict completely before members.
The RoomState needs to be current before higher-level processing as this
processing may depend on the end state rather than the progressive state
(e.g. disambiguating BOTH RoomMember's display names).
2015-07-13 10:53:07 +01:00
Kegan Dougal
1b665c176a Add RoomState UTs 2015-06-24 14:57:04 +01:00
Kegan Dougal
94931cdc07 Remove broken function; add RoomMember.events.member property. 2015-06-15 09:49:54 +01:00
Kegan Dougal
7a02c5d167 Add concept of 'sentinel' RoomMembers which watch state at a particular point in time.
New sentinels are only created when the RoomMember state changes, so we don't
needlessly deep copy RoomMembers f.e. MatrixEvent. Sentinels co-exist with
RoomState.members which are single instances to which listeners can be attached.
This gets the best of both worlds (don't have to keep re-attaching listeners on
member changes, don't have needless memory consumption).
2015-06-12 15:38:02 +01:00
Kegan Dougal
8a844d59ec Get historical display names working on messages.
Accessed via MatrixEvent.sender property. Deep copy the list of state events
from initial sync for old/current RoomState so updating the .sender property
doesn't affect both of them. Reverse the insertion of initial sync MatrixEvents
so state diverges to *earlier* points in time. Add a 'forwardLooking' property
to MatrixEvent to determine which out of 'content' and 'prev_content' entities
should take into account e.g. when determining display names. Finally, always
create new RoomMembers when they are updated in order to prevent corrupting
(read: sharing the same member object) the MatrixEvent.sender property of
existing events in the timeline.
2015-06-12 14:21:24 +01:00
Kegan Dougal
71dacb14b1 Add MatrixEvent.sender and .target to pull the right name per message. 2015-06-12 11:05:57 +01:00
Kegan Dougal
8e45d6b625 Bug fixes on initialSync and RoomMember.userId.
Don't assume that .state and .messages exist in /initialSync results.
Use state_key and not user_id when setting the userId of a RoomMember.
2015-06-11 16:29:36 +01:00
Kegan Dougal
19a5b99dea Add RoomMember and RoomState event emissions with UTs. Hook everything up.
Distinguish between inserts and updates to the members dictionary to allow
listeners to add more hooks to the member before it has been given state.
2015-06-11 14:29:32 +01:00
Kegan Dougal
07f77c495b Move event jsdoc to respective classes. Document which functions fire.
This tends to boil down into a setXEvent method which can fire if it updates
the model.
2015-06-11 10:54:25 +01:00
Kegan Dougal
5cf29ae1b1 Make RoomMember set its own properties, not RoomState.
Also make it clear which methods may fire events off using @fires. This
shifts a lot of RoomState logic to RoomMember.
2015-06-10 17:06:28 +01:00
Kegan Dougal
583e71180b Add JSDoc for all the events which the SDK will emit. 2015-06-10 14:42:40 +01:00
Kegan Dougal
a0bd25a6d2 Handle power levels and update RoomMember properties.
Add unit tests for RoomState.
2015-06-09 15:23:04 +01:00
Kegan Dougal
2fb68cfed2 Handle m.typing events. 2015-06-09 10:27:37 +01:00
Kegan Dougal
a43447b00e Add tests to exercise room name / timeline logic; fix some bugs as a result. 2015-06-08 17:27:10 +01:00
Kegan Dougal
2d00998b61 Move getFriendlyRoomName to Room. Add recalculate() function to cache info. 2015-06-08 16:10:23 +01:00
Kegan Dougal
9fa7fa0487 Shuffle around how events are stored.
Rather than having MatrixInMemoryStore do it all, we make the right object do
the right thing, and keep the store for storing said objects.
2015-06-08 15:43:18 +01:00
Kegan Dougal
a2257aeb0b Move getFriendlyDisplayName to RoomMember class. Add more utlity functions. 2015-06-08 12:21:23 +01:00
Kegan Dougal
7ce3a781f3 Add Room, RoomState and RoomMember classes. 2015-06-08 11:47:15 +01:00