1868 Commits

Author SHA1 Message Date
Kegan Dougal
0a1c462f9b Namespace users in tests to avoid clashes 2021-10-26 12:49:06 +01:00
Kegan Dougal
66659936b4 go mod tidy 2021-10-26 12:46:59 +01:00
Kegan Dougal
c12345481f Bump GMSL 2021-10-26 12:46:22 +01:00
Kegan Dougal
c91bec7b0e Add timeline integration tests 2021-10-26 10:48:37 +01:00
Kegan Dougal
eaea3402a2 Use gmsl.Timestamp in more places 2021-10-26 10:01:45 +01:00
Kegan Dougal
1510dce73a Add matchers for integration tests for easier reading 2021-10-25 18:25:38 +01:00
Kegan Dougal
6c89988e03 tests: ORDER BY when pulling out state to ensure consistent orderings 2021-10-25 18:08:39 +01:00
Kegan Dougal
91653ce3d1 Add integration test jig and a basic test
- Add sync3.Response UnmarshalJSON() so we can dynamically make the
  correct single/range op.
- Create sub-structs for sync2.Response to make inline embedding
  easier in tests.
2021-10-25 18:03:32 +01:00
Kegan Dougal
d7913c8e26 Return the most recent timeline events for each room
TODO: the global cache isn't being kept updated so live
streamed events don't load (though they sort correctly)
2021-10-22 18:18:02 +01:00
Kegan Dougal
488c638e7b Streamline how new events are pushed to ConnState
Let ConnState directly subscribe to GlobalCache rather than
the awful indirection of ConnMap -> Conn -> ConnState we had before.
We had that before because ConnMap is responsible for destroying old
connections (based on the TTL cache), so we could just subscribe once
and then look through the map to see who to notify. In the interests
of decoupling logic, we now just call ConnState.Destroy() when the
connection is removed from ConnMap which allows ConnState to subscribe
to GlobalCache on creation and remove its subscription on Destroy().

This makes it significantly clearer who and where callbacks are firing
from and to, and now means ConnMap is simply in charge of maintaining
maps of user IDs -> Conn as well as terminating them when they expire
via TTL.
2021-10-22 17:21:47 +01:00
Kegan Dougal
0a7c62defc Log valid commands for easier debugging from logs 2021-10-22 16:11:50 +01:00
Kegan Dougal
9474a723ba fix #13: rooms can be duplicated
This happens when there are >1 window and a DELETE/INSERT op do not affect the same window.
2021-10-22 16:07:04 +01:00
Kegan Dougal
42516c92cc Only display DEBUG button if the access token is set to 'debug' 2021-10-22 15:59:12 +01:00
Kegan Dougal
3564ef68f0 Add debug commands 2021-10-22 15:00:57 +01:00
Kegan Dougal
8ac446cb2f optimise the case where we don't have a from pos 2021-10-21 18:38:42 +01:00
Kegan Dougal
638e173d3b Add VisibleEventNIDsBetweenForRooms 2021-10-21 18:27:19 +01:00
Kegan Dougal
a895f64af5 Namespace user ID per test to avoid test failure 2021-10-21 18:14:31 +01:00
Kegan Dougal
7036fdd54f Add SelectEventsWithTypeStateKeyInRooms in prep for loading visible event nid ranges for a subset of rooms 2021-10-21 18:13:06 +01:00
Kegan Dougal
0ebf6b6fd0 Render m.reaction events 2021-10-21 15:57:50 +01:00
Kegan Dougal
0295e968b0 Refer to top level rooms correctly 2021-10-21 15:47:50 +01:00
Kegan Dougal
43d36efe8d Improve client logging for duplicate room indexes 2021-10-21 13:15:32 +01:00
Kegan Dougal
5cb9f707a7 Move JoinedRoomsTracker to GlobalCache 2021-10-11 18:46:17 +01:00
Kegan Dougal
c932365dc4 Rely on ConnMap to notify ConnState based on the JoinedRoomsTracker 2021-10-11 18:21:47 +01:00
Kegan Dougal
52da56c70d Remove ConnStateStore and use Global/UserCache exclusively
Add a `LoadJoinedRoomsOverride` to allow tests to override
and bypass DB checks. We need them in the cache in order to
synchronise loading connection state with live updates to
ensure we process events exactly once.
2021-10-11 18:09:29 +01:00
Kegan Dougal
ed7433691c Move LoadState out of ConnMap and into GlobalCache 2021-10-11 17:24:46 +01:00
Kegan Dougal
15214881fc Add GlobalCache and move the global room map to it
This is currently the worst of all worlds as global caches are
now spread between this and the connmap.
2021-10-11 17:12:54 +01:00
Kegan Dougal
48613956d1 Add UserCache and move unread count tracking to it
Keep it pure (not dependent on `state.Storage`) to make testing
easier. The responsibility for fanning out user cache updates
is with the Handler as it generally deals with glue code.
2021-10-11 16:22:41 +01:00
Kegan Dougal
ab359c7ff3 bugfix: #9 2021-10-11 10:37:10 +01:00
kegsay
bde9f259dd
Merge pull request #11 from Half-Shot/hs/composedPath
Use composedPath for tracing a click event path
2021-10-11 10:25:12 +01:00
kegsay
f8222162b1
Merge pull request #10 from Half-Shot/hs/dockerfile
Add Dockerfile
2021-10-11 10:22:59 +01:00
Will Hunt
839bf15b03 Use composedPath
https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath is supported cross-browser, event.path doesn't feature in the docs at all.
2021-10-10 13:12:46 +01:00
Will Hunt
d0786323fd Add dockerfile 2021-10-10 13:09:50 +01:00
Kegan Dougal
5ee1e422a1 Implement the room name calculation algorithm 2021-10-08 17:24:06 +01:00
Kegan Dougal
f9ed9ddd8c Use the placeholder image if there is no valid mxc uri 2021-10-08 16:33:25 +01:00
Kegan Dougal
e98dbccf31 Display tombstoned rooms with tomstone message 2021-10-08 14:53:23 +01:00
Kegan Dougal
3a5afb9179 Prettify unread counts 2021-10-08 14:35:14 +01:00
Kegan Dougal
5f19fccd07 Implement unread counts on the client 2021-10-08 14:15:36 +01:00
Kegan Dougal
4b377b3b6d Read unread counts on startup; cache counts when live streaming
With a few more tests
2021-10-08 13:31:30 +01:00
Kegan Dougal
c3486d7ff3 bugfix: unread table placeholder args 2021-10-08 13:10:14 +01:00
Kegan Dougal
e60f75cb01 Use grey rectangles instead of blurring placeholders
It's far more performant and gives a better scrolling UX.
2021-10-08 12:47:36 +01:00
Kegan Dougal
fb9394d73b Add UnreadTable to track per-user per-room unread counters
With tests. Add function to V2DataReceiver interface.
2021-10-08 12:31:56 +01:00
Kegan Dougal
12f9226eab Update API docs 2021-10-08 12:31:08 +01:00
Kegan Dougal
362aca5954 Show the room topic; read the right required_state field on the muxed req for the room ID in question 2021-10-07 17:43:53 +01:00
Kegan Dougal
d482ed00c0 Process room_subscriptions in the client
Also, only send the room ID in the sliding window if the room
is explicitly subscribed to (as it'll come down room_subscriptions)
2021-10-07 17:32:18 +01:00
Kegan Dougal
7b0cebe756 client: track room subscriptions 2021-10-07 17:21:25 +01:00
Kegan Dougal
eeada4f75d Load room avatars via required_state 2021-10-07 16:58:03 +01:00
Kegan Dougal
7334716646 Implement LoadState with tests 2021-10-07 15:58:14 +01:00
Kegan Dougal
e78f89fb24 Add ability to filter on event type for RoomStateAfterEventPosition
Adding this filter fundamentally changes the query to be optimised to
not pull out the entire room state. This will be used when calculating
the `required_state` response.

Also add tests for RoomStateAfterEventPosition and RoomStateBeforeEventPosition
2021-10-07 13:59:53 +01:00
Kegan Dougal
c58c8d4d9a Remove New Session button and always make a new one on sync click 2021-10-07 11:22:53 +01:00
Kegan Dougal
6c6934edf4 Factor out loading initial vs delta room data
Now we just have 2 places where we load this, which is good for
preparing to load required_state.
2021-10-07 11:19:53 +01:00