Treat sessions that are there when we log in as old

Use the bulk 'review' toast for sessions that existed at the time
of login, rather than considering them all to be new.

Also cheeky unrelated proptypes fix.

Fixes https://github.com/vector-im/riot-web/issues/13443
Requires https://github.com/matrix-org/matrix-js-sdk/pull/1360
This commit is contained in:
David Baker 2020-04-29 17:16:04 +01:00
parent de9c8b0537
commit 19170945b1
2 changed files with 11 additions and 4 deletions

View file

@ -107,7 +107,12 @@ export default class DeviceListener {
} }
} }
_onWillUpdateDevices = async (users) => { _onWillUpdateDevices = async (users, initialFetch) => {
// We we didn't know about *any* devices before (ie. it's fresh login),
// then they are all pre-existing devices, so ignore this and set the
// devicesAtStart list to the devices that we see after the fetch.
if (initialFetch) return;
const myUserId = MatrixClientPeg.get().getUserId(); const myUserId = MatrixClientPeg.get().getUserId();
if (users.includes(myUserId)) this._ensureDeviceIdsAtStartPopulated(); if (users.includes(myUserId)) this._ensureDeviceIdsAtStartPopulated();
@ -179,8 +184,6 @@ export default class DeviceListener {
const crossSigningReady = await cli.isCrossSigningReady(); const crossSigningReady = await cli.isCrossSigningReady();
this._ensureDeviceIdsAtStartPopulated();
if (this._dismissedThisDeviceToast) { if (this._dismissedThisDeviceToast) {
ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY); ToastStore.sharedInstance().dismissToast(THIS_DEVICE_TOAST_KEY);
} else { } else {
@ -235,6 +238,10 @@ export default class DeviceListener {
} }
} }
// This needs to be done after awaiting on downloadKeys() above, so
// we make sure we get the devices after the fetch is done.
this._ensureDeviceIdsAtStartPopulated();
// Unverified devices that were there last time the app ran // Unverified devices that were there last time the app ran
// (technically could just be a boolean: we don't actually // (technically could just be a boolean: we don't actually
// need to remember the device IDs, but for the sake of // need to remember the device IDs, but for the sake of

View file

@ -27,7 +27,7 @@ import { replaceableComponent } from '../../../utils/replaceableComponent';
@replaceableComponent("views.toasts.UnverifiedSessionToast") @replaceableComponent("views.toasts.UnverifiedSessionToast")
export default class UnverifiedSessionToast extends React.PureComponent { export default class UnverifiedSessionToast extends React.PureComponent {
static propTypes = { static propTypes = {
deviceId: PropTypes.object, deviceId: PropTypes.string,
} }
_onLaterClick = () => { _onLaterClick = () => {