From 89a72b768556a94b4a175e701015c4be0d01b70d Mon Sep 17 00:00:00 2001
From: David Baker <dave@matrix.org>
Date: Tue, 16 Jun 2020 14:53:13 +0100
Subject: [PATCH] Take the last request (ie. the most recent)

---
 src/stores/SetupEncryptionStore.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/stores/SetupEncryptionStore.js b/src/stores/SetupEncryptionStore.js
index a9a0ad4aa2..4cdc845419 100644
--- a/src/stores/SetupEncryptionStore.js
+++ b/src/stores/SetupEncryptionStore.js
@@ -52,10 +52,10 @@ export class SetupEncryptionStore extends EventEmitter {
         const cli = MatrixClientPeg.get();
         const requestsInProgress = cli.getVerificationRequestsToDeviceInProgress(cli.getUserId());
         if (requestsInProgress.length) {
-            // If there are multiple, we take the first. Equally if the user sends another request from
+            // If there are multiple, we take the most recent. Equally if the user sends another request from
             // another device after this screen has been shown, we'll switch to the new one, so this
             // generally doesn't support multiple requests.
-            this._setActiveVerificationRequest(requestsInProgress[0]);
+            this._setActiveVerificationRequest(requestsInProgress[requestsInProgress.length - 1]);
         }
 
         this.fetchKeyInfo();