- Create a promise that will serve as a lock to be blocked on by things that need to wait for the first sync before accessing state.
- Use this promise to block `view_room` calls until a sync has occured instead of just dropping them silently if the sync hasn't happened yet.
- Store the current room ID in a localStorage item `mx_last_room_id` when `view_room` fires. This persists the last viewed room ID so that it can be restored on refresh, browser quit. This replaces the previous logic which set the room following a sync based on the most recent unread room.
Making sure that a node is intersected by the bottom of the wrapper is a bit overkill, given that we iterate from the bottom. This also prevents the scenario of having no nodes that are not precisely intersected, but possibly straddling the bottom of the wrapper.
Also get rid of the "up" arrow so as not to indiciate direction. This is important because in future the RM will not be based on what has been paginated into the client (but instead RM will be handled server-side) and thus we cannot assert any kind of direction on it relative to the events in the viewport.
The actual fix to https://github.com/vector-im/riot-web/issues/3175 is this change to `_saveScrollState`, which is to pick the trackedScrollToken based on which node is intersected by the bottom of the scroll panel. This is opposed to the previous logic that picked based on which node was the first from the bottom to be above the bottom of the viewport.
In the case where the viewport bottom does not intersect any events, the topmost event is used.
MatrixChat was trying to display an error if the session failed to
restore, but it was never actually being shown because it was just
set as a member variable and therefore never actually caused
a re-render for the error to be displayed. Almost all errors are
caught by _restoreFromLocalStorage which displays the fancy dialog
if your session can't be restored, so I'm not convinced this ever
even tried to do anything anyway. Remove it.
Specifically:
```
JS 2.1.1 (Linux 0.0.0) joining a room over federation should not get stuck at a spinner FAILED
Did not find exactly one match (found: 0) for componentType:function (props, context, updater) {
```
actually meant that the room directory wasn't displayed - probably because the dispatch `view_room_directory` ended up on another tick of the event loop, meaning that the directory wasn't displayedi. The fix attempted in ths commit is to use `this._setPage` instead to view the directory. This uses `setState` to set the screen to the directory, so I'm not entirely convinced this will solve the problem (as `setState` may also end up doing things on another tick.
and
```
JS 2.1.1 (Linux 0.0.0) loading: MatrixClient rehydrated from stored credentials: shows a room view if we followed a room link FAILED
MatrixChat still not ready after 5 tries
awaitRoomView@/home/travis/build/vector-im/riot-web/test/all-tests.js:201363:90
```
was happening probably because in the handler for the `sync` event in `MatrixChat` (around line 840), there was one case in which the `ready` state may not be true (causing all 5 attempts to fail), and this case relied on `starting_room_alias_payload`. This `starting_room_alias_payload` is now redundant because of `initialScreenAfterLogin`, which was added recently.
Only zero the local notification count when we actually send a
read receipt, otherwise we cause a re-render of the RoomList every
time the user moves the cursor in the window, basically.
Use an action and force an update when zeroing the number of notifications in a room. This is better than waiting for a `render` to happen at some point. This will hopefully fix https://github.com/vector-im/riot-web/issues/3257
Always show the entered text as an option if it's a valid address,
otherwise there's no way to invite an address that is valid and
also returns other mxids in the search results.
Fixes https://github.com/vector-im/riot-web/issues/3496
To prevent the login screen from flashing when refreshing the app, use some state to indicate that a login is in progress, and OR that with the existing `loading` boolean to show the `<Spinner>` instead of the default `<Login>`.
This might be too invasive, and a default spinner may be better.
The bound functions are only set when the Notifier is started, so
if stop() was called without start() having been called, the
listener function would be null which would throw an exception.
The fact that we showed no feedback whilst submitting the captcha
response was causing confusion on slower connections where this
took a nontrivial amount of time.
Takes a new flag from the js-sdk that indicates whether the
request being made is a background request, presenting a spinner
appropriately.
Requires https://github.com/matrix-org/matrix-js-sdk/pull/396
- Set the verb for the people section to "tag as direct chat". This requires some CSS modifications to Riot because it's a long bit of text relative to, say, "demote".
- Because it's quite useful to be able to set the DM status of a room with just a boolean, add a convenience function for guessing a DM member and setting the DM flag on that room with the resulting member.
When starting a call, several events are sent and if some devices are unverified, all three will trigger their own UnknownDeviceError. This causes three overlapping, identical UnknownDeviceDialogs.
This change effectively dedupes the dialogs so that only one is shown. This is safe to do because the UDD allows resending of _all_ events that were left unsent.
Fixes https://github.com/vector-im/riot-web/issues/3285
This does two things:
- Sets `editable` to true for the "People" `RoomSubList` so that people can be dragged to favourites. This has the downside that you can drag a "People" to "Rooms", but it won't set the direct chat flag. This is because im.vector.fake.direct != m.direct, sadly.
- Sets `alwaysShowHeader` to `true` so that the `IncomingCallDialog` can be showneven when there are no people in `sortedList`. Fixes https://github.com/vector-im/riot-web/issues/2956.
_onLoadCompleted happens straight away because Lifecycle finishes loading the session instantly when registration parameters (client_secret etc.) are set.
This fixes https://github.com/vector-im/riot-web/issues/2991 although we might need to give more feedback than just showing the login screen. Maybe a dialog that says "your account has been deactivated".
* WIP msisdn sign in
* A mostly working country picker
* Fix bug where you'dbe logged out after registering
Stop the guest sync, otherwise it gets 401ed for using a guest
access token for a non-guest, causing us to beliebe we've been
logged out.
* Use InteractiveAuth component for registration
* Fix tests
* Remove old signup code
* Signup -> Login
Now that Signup contains no code whatsoever related to signing up,
rename it to Login. Get rid of the Signup class.
* Stray newline
* Fix more merge failing
* Get phone country & number to the right place
* More-or-less working msisdn auth component
* Send the bind_msisdn param on registration
* Refinements to country dropdown
Rendering the whole lot when the component was rendered just makes
the page load really slow, so just show 2 at a time and rely on
type-to-search.
Make type-to-search always display an exact iso2 match first
* Propagate initial inputs to the phone input
* Support msisdn login
* semicolon
* Fix PropTypes
* Oops, use the 1qst element of the array
Not the array of object keys which has no particular order
* Make dropdown/countrydropdown controlled
* Unused line
* Add note on DOM layout
* onOptionChange is required
* More docs
* Add missing propTypes
* Don't resume promise on error
* Use React.Children to manipulate children
* Make catch less weird
* Fix null dereference
Assuming [0] of an empty list == undefined doesn't work if you're
then taking a property of it.
This has highlighted the fact that an unsent image looks very much like a sent image (https://github.com/vector-im/riot-web/issues/3391). Also, the "Resend" status bar doesn't appear when an image is unsent.
This follows from a small amount of refactoring done when RTS was introduced. Instead of setting the screen after sync, do it only after login.
This requires as-yet-to-be-PRd riot-web changes.
This includes:
- initialScreenAfterLogin, which can be used to set the screen after login, and represents the screen that would be viewed if the window.location at the time of initialising Riot were routed.
- guestCreds are now part of state, because otherwise they don't cause the login/registration views to update when set.
- instead of worrying about races and using this._setPage, use a dispatch.
Pass extra info from the UI auth process as a second parameter to
onAuthFinished. Allows the email sid & client secret to be used
outside of the UI auth process.
When creating a new chat with one person, show a dialog that asks the user whether they'd like to use an existing chat or actually create a new room.
Fixes https://github.com/vector-im/riot-web/issues/2760
This has the benefit of not needing a spec for custom CSS. Instead we rigourously sanitise the values for custom data attributes that are transformed to CSS equivalents. `data-mx-color` translates to CSS `color` for example.
Use the on_logged_in dispatch instead. Call setPage in one place, _onLoggedIn, when deciding which page to view on login. Change some require to import, var to const. Remove onTeamMemberRegistered and just use a nullable argument to onRegistered
* Also fix bug where you couldn't picxk a different server if
you were already registered as a guest (because it still sent
the access token which the new server rejected)
* Propagate errors from UI auth back to registration so it goes
back to the registration screen
- Shift to the left _before_ adding an avatar so that there are always `MAX_READ_AVATARS` visible, instead of there being `MAX_READ_AVATARS + 1` avatars displayed following the first "collapse".
- Use `right` instead of `left` so that double-digit remainders don't get overlapped.
- Use avatar initial instead of "R" or "?"
- Use Fuse.js to do case-insensitive fuzzy search. This allows for better sorting of results as well as search based on weighted keys (so userId has a high weight when the input starts with "@").
- Added debounce of 200ms to prevent analysis on every key stroke. Fuse seems to degrade performance vs. simple, non-fuzzy, unsorted matching, but the debounce should prevent too much computation.
- Move the selection to the top when the query is changed. There's no point in staying mid-way through the items at that point.
For E2E rooms, display "Send an encrypted message…" otherwise display "Send a plaintext message…" as the placeholder for the input box in [old] message composer.
This adds a 5 minute auth cache to speed up the process of deleting
old devices. It has the following nastinesses (mainly due to being
written on a flight whilst juggling kids):
* the auth cache is done as context attached to MatrixChat.
one could argue that it should be per-client instead, but we don't
yet have multiple clients.
* the auth cache is only maintained currently in DevicesPanelEntry
(i.e. set & invalidated). One could argue that it might be better
maintained in InteractiveAuth.js or a dedicated cache object
abstraction, but given the only use I can think of is when managing
devices, perhaps this is good enough for now.
To fix https://github.com/vector-im/riot-web/issues/2916, force the checking of scroll position by calling _onWidgetLoad (might need renaming...) when a MELS is expanded/contracted.
Also use an keying scheme for MELS that doesn't depend on the events contained, but rather a simple incrementing index based on the order of the MELS as it appears amongst all MELS.
This deletes the IndexedDB database and reloads the page.
This solely exists as a get-out clause for users in case the indexedDB instance
gets corrupted. Hopefully we won't ever need to point users to it.
For example, if someone ends up on /home somehow, just redirect to the directory instead of displaying a very awkward "File not found" plain text in the home page iFrame.
Revert the WithMatrixClient change: RoomView calls methods on
the RoomSettings component and this breaks when RoomSettings is
wrapped in a WithMatrixClient.
When registeration is complete, the RTS needs the sid, which was previously only sent to the HS. This update will also store it in the signupInstance so that it can be sent to the RTS.
Into a component that does Interactive Auth and a dialog that
wraps it, so we can do interactive auth not necessarily in a
dialog.
As a side effect:
* Put the buttons for each auth stage in the stage itself.
Some stages don't have submit buttons (and it's very possible
other stages may have other buttons entirely, like 'resend')
so it makes more sense for the buttons to live in the stage
components themselves. Plus it saves the slightly evil
calling-functions-on-react-children thing we were doing (and
indeed extending that to show the submit button at all).
* Give all BaseDialogs a cross in the top right to cancel. They
were all dismissable by clicking outside or pressing esc, so
this adds a more visually obvious way of dismissing them. Plus,
it means our InteractiveAuthDialog can have a way of canceling
the whole operation separate from buttons for the individual
stages.
This has the benefit of being possible from the _second_ riot instance, which may not actually have the email of the user registering. With these parameters, the RTS can get the email and user ID itself.
(see https://github.com/matrix-org/riot-team-server/pull/15)
Use the first path segment to key off config.teamTokenMap, which contains a mapping to teamTokens. The client then behaves as before, keeping the path in the address bar constant with no redirects required.
This means the riot-web will use the same teamToken used by sdk components. This includes cases where only the fragment query parameter has been provided.
Fixesmatrix-org/riot-web#3185
There was a bug here that meant that sometimes arguments were given in the wrong order; presumably leading to the status bar not appearing for calls etc.
This was necessary because the team token may not be known when registering, but domain is. Storing the icon under the "common" directory is the chosen solution to this.
Only claim there's nothing to display once we've failed to back
paginate, otherwise we'll show the empty message instead of the
MessagePanel and therefore never try to back-paginate.
BaseAvatar can be passed an onClick which is called when it's, er,
clicked, except when it was the default avatar in which case it
merrily ignored it. Make it not ignore it.
The velociraptor was only actioning hidden -> visible transitions
if the position had changed, so the one RR that stayed in position
but became visible... didn't become visible.
* Only render HTML tags in markdown if they're del tags
* Consider non-allowed HTML tags as plain text nodes, so
a message of just '<shrug>' doesn't need to be sent as
HTML
* Consequently rewrite isPlaintext to just look at the parse
tree rather than making and gutting a renderer to walk
the tree (now we're using a library that actually produces
a meaningfgul parse tree).
* Tweak when we put \n on text output to avoid putting \n on
the end of messages.
Fixes https://github.com/vector-im/riot-web/issues/3065
Rather than keeping one in memory, abusing it in different ways
each time and then craefully putting it back the way it was (and
in one case, failing, because we forgot to put the `out` method
back).
so they don't claim it;s a wrapper around marked when it's now
commonmark, and comment why we render markdown to plaintext which
is somewhat unintuitive.
It seems that a number of the tests had started failing when run in
Chrome. They were fine under PhantomJS, but the MegolmExport tests only work
under Chrome, and I need them to work...
Mostly the problems were timing-related, where assumptions made about how
quickly the `then` handler on a promise would be called were no longer
valid. Possibly Chrome 55 has made some changes to the relative priorities of
setTimeout and sendMessage calls.
One of the TimelinePanel tests was failing because it was expecting the contents
of a div to take up more room than they actually were. It's possible this is
something very environment-specific; hopefully the new value will work on a
wider range of machines.
Also some logging tweaks.
This allows those who have registered to referrer other students to Riot and have their referral counted for the campaign competition. Also allows the base referral URL to be configurable (i.e. for Electron app, etc.) and be default this is `window.location.origin`.
Now that the RTS contains config for teams, use GET /teams to get that information so that users will see be able to register as a team (but not yet auto-join rooms, be sent to welcome page or be tracked as a referral).
For compatibility with referral campaign flows, re-implement team registration such that the team is selected through providing an email with a known team domain. The support email is now only shown when an email that _looks_ like a UK/US university email address, but is not known.