* Update Jest to more recent release
I want to use things like `jest.advanceTimersByTimeAsync`
* more jest updates
* add dep on types/prettier
* fix LegacyRoomHeader-test
* fix MatrixChat-test
* fix RoomView-test
* fix PollHistory-test
* update SidebarUserSettingsTab-test
* fix PipContainer-test
* fix UserOnboardingPage-test
* fix WidgetContextMenu-test.tsx
* Avoid `mockImplementation` for mock `matchMedia` impl
`mockImplementation` is (now) reset by `jest.resetAllMocks` and
`jest.restoreAllMocks`, which we don't really want here.
Fixes `theme-test`
* Move `mediaDevices` mock out of `setupManualMocks`
This doesn't work well in test suites with multiple tests, because the
`mockReturnValue` is reset for subsequent tests.
In any case, having it mocked out automagically is *magical*. Let's make it
opt-in.
* fix FormattingButtons-test.tsx
* fix DeviceListenerTest
* fix RoomTile-test
* Switch to importing TypedEventEmitter from main js-sdk export
* Switch to importing js-sdk/matrix in cypress
* Remove duplicated imports
* Fix lint:js-fix to run prettier last otherwise ESLint --fix may cause a mess
* Add lint rule
* Switch to importing models/Room from main js-sdk export
* Fix cypress-axe import
* Fix more imports
* Fix cypress-axe import
* Fix duplicated lint rule
* Do not show "Forget room" button in Room View header for guest users
You can observe this problem by opening this in a new private tab:
https://app.element.io/#/room/#matrix:matrix.org
This is a public room with guest access enabled and Element will use a
guest account to display it.
Showing a "Forget room" button in the header for guest users is
pointless. Clicking on it leads to a `M_GUEST_ACCESS_FORBIDDEN` error.
Signed-off-by: Slavi Pantaleev <slavi@devture.com>
* Iterate
---------
Signed-off-by: Slavi Pantaleev <slavi@devture.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* Move Room context threadId our of RoomView state
* Allow maintaining a different right panel width for thread panels
* Fix types
* Fix types
* Add tests
* Increase coverage
* Increase coverage
* Add comments
* Update src/components/structures/MainSplit.tsx
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Use aria descriptions instead of labels for TextWithTooltip
to prevent clobbering the reading of the content
* Update snapshot
* Fix snapshots
* Iterate
* Update snapshots
* delint
* Tests for RoomNotificationStateStore emitting events
* Support dynamic room predecessors in RoomNotificationStateStore
* Remove unused arguments from emit call.
UPDATE_STATUS_INDICATOR is used in:
* SpacePanel
* MatrixChat
* RoomHeaderButtons
but these arguments are not used in any of those places. Remove them so
when I refactor I don't have to make up values for them.
* Fix broken test (wrong expected args to emit)
UPDATE_STATUS_INDICATOR is used in:
* SpacePanel
* MatrixChat
* RoomHeaderButtons
but these arguments are not used in any of those places. Remove them so
when I refactor I don't have to make up values for them.
* Update the RoomNotificationStore whenever the predecessor labs flag changes
* Fix type errors
* Fix other tests that trigger our new watcher
* super WIP POC for merging virtual room events into main timeline
* remove some debugs
* c
* add some todos
* remove hardcoded fake virtual user
* insert overlay events into main timeline without resorting main tl events
* remove more debugs
* add extra tick to roomview tests
* RoomView test case for virtual room
* test case for merged timeline
* make overlay event filter generic
* remove TODOs from LegacyCallEventGrouper
* tidy comments
* remove some newlines
* test timelinepanel room timeline event handling
* use newState.roomId
* fix strict errors in RoomView
* fix strict errors in TimelinePanel
* add type
* pr tweaks
* strict errors
* more strict fix
* strict error whackamole
* update ROomView tests to use rtl
* Add Stores and StoresContext and use it in MatrixChat and RoomView
Added a new kind of class:
- Add God object `Stores` which will hold refs to all known stores and the `MatrixClient`. This object is NOT a singleton.
- Add `StoresContext` to hold onto a ref of `Stores` for use inside components.
`StoresContext` is created via:
- Create `Stores` in `MatrixChat`, assigning the `MatrixClient` when we have one set. Currently sets the RVS to `RoomViewStore.instance`.
- Wrap `MatrixChat`s `render()` function in a `StoresContext.Provider` so it can be used anywhere.
`StoresContext` is currently only used in `RoomView` via the following changes:
- Remove the HOC, which redundantly set `mxClient` as a prop. We don't need this as `RoomView` was using the client from `this.context`.
- Change the type of context accepted from `MatrixClientContext` to `StoresContext`.
- Modify alllll the places where `this.context` is used to interact with the client and suffix `.client`.
- Modify places where we use `RoomViewStore.instance` and replace them with `this.context.roomViewStore`.
This makes `RoomView` use a non-global instance of RVS.
* Linting
* SDKContext and make client an optional constructor arg
* Move SDKContext to /src/contexts
* Inject all RVS deps
* Linting
* Remove reset calls; deep copy the INITIAL_STATE to avoid test pollution
* DI singletons used in RoomView; DI them in RoomView-test too
* Initial RoomViewStore.instance after all files are imported to avoid cyclical deps
* Lazily init stores to allow for circular dependencies
Rather than stores accepting a list of other stores in their constructors,
which doesn't work when A needs B and B needs A, make new-style stores simply
accept Stores. When a store needs another store, they access it via `Stores`
which then lazily constructs that store if it needs it. This breaks the
circular dependency at constructor time, without needing to introduce
wiring diagrams or any complex DI framework.
* Delete RoomViewStore.instance
Replaced with Stores.instance.roomViewStore
* Linting
* Move OverridableStores to test/TestStores
* Rejig how eager stores get made; don't automatically do it else tests break
* Linting
* Linting and review comments
* Fix new code to use Stores.instance
* s/Stores/SdkContextClass/g
* Update docs
* Remove unused imports
* Update src/stores/RoomViewStore.tsx
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* Remove empty c'tor to make sonar happy
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* refactor: convert RoomViewStore from flux Store to standard EventEmitter
Parts of a series of experimental changes to improve the design of stores.
* Use a gen5 store for RoomViewStore for now due to lock handling
* Revert "Use a gen5 store for RoomViewStore for now due to lock handling"
This reverts commit 1076af071d997d87b8ae0b0dcddfd1ae428665af.
* Add untilEmission and tweak untilDispatch; use it in RoomViewStore
* Add more RVS tests; remove custom room ID listener code and use EventEmitter
* Better comments
* Null guard `dis` as tests mock out `defaultDispatcher`
* Additional tests
* Show chat panel when opening a video room with unread messages
* Remove unnecessary calls to private methods in tests
* Make room ID mandatory when toggling the right panel
* Restore the isViewingRoom check
* Test RightPanelStore
* Make the constructor private again
* Add even more tests
* Fix onReady