1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-09-10 17:31:53 +03:00
Commit Graph

23 Commits

Author SHA1 Message Date
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
2c213f88d9 Units! Tests! Linting! 2015-10-19 15:24:24 +01:00
Kegan Dougal
a236219111 ContentRepo unit tests 2015-10-19 15:00:06 +01:00
Kegan Dougal
2f9958cca9 JSDoc linkify 2015-10-19 14:37:17 +01:00
Kegan Dougal
f26154d0ac Add support for m.room.avatar: refactor avatar URLs
BREAKING CHANGE.

Scope each "getAvatarUrl" to be instance methods on the entity it
relates to (Room and RoomMember respectively). By doing this, we
can actually pull out specific state such as the `m.room.avatar`
event more easily rather than keeping it in the global cesspit
of `MatrixClient`.

This was complicated by `getHttpUriForMxc` and `getIdenticonUri`
which were attached to the HTTP API to pull out the `baseUrl` when
crafting the URL. Pull out this dependency out and explicitly pass
it in when crafting the URL. This is trivial to get from
`MatrixClient.getHomeserverUrl()`.
2015-10-19 14:14:34 +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
3baab40bdb Add RoomMember.getLastModifiedTime() 2015-10-13 10:09:38 +01:00
Matthew Hodgson
beb8bff084 placeholder code for defaulting displaynames to userids, except it needs disambiguation logic 2015-07-18 15:40:19 +01:00
David Baker
f29f2a8115 Move getAvatarUrl into the client because it requires an instantiated client to work. Fix bits of client to use opts rather than credentials which doesn't exist. 2015-07-02 18:22:46 +01:00
Kegan Dougal
5691865035 Linting 2015-07-02 17:23:35 +01:00
Kegan Dougal
abe00deb65 Add getAvatarUrl() to RoomMember 2015-07-02 17:22:44 +01:00
Kegan Dougal
d3377e3dea Add RoomMember UTs. Fix disambiguation bug. Add CHANGELOG. 2015-06-24 13:35:19 +01:00
Kegan Dougal
94931cdc07 Remove broken function; add RoomMember.events.member property. 2015-06-15 09:49:54 +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
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
58cbd3ab1b Move RoomMember event jsdocs to the room-member module. 2015-06-10 17:25:34 +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
327a1674aa Add missing user field to RoomMember. 2015-06-09 11:25:10 +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
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