From 030311fc1ec09e2d75b5d04c0d5f86c9536ea946 Mon Sep 17 00:00:00 2001
From: Will Hunt <will@half-shot.uk>
Date: Tue, 12 Feb 2019 20:56:33 +0000
Subject: [PATCH] getEntries* should only return entries with remotes

---
 src/db/roomstore.ts | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/db/roomstore.ts b/src/db/roomstore.ts
index dd838c5..0928306 100644
--- a/src/db/roomstore.ts
+++ b/src/db/roomstore.ts
@@ -173,12 +173,14 @@ export class DbRoomStore {
                     remote = new RemoteStoreRoom(remoteId, row as any);
                 }
             }
-
-            res.push({
-                id: (entry.id as string),
-                matrix: new MatrixStoreRoom(matrixId),
-                remote,
-            });
+            if (remote) {
+                // Only push rooms with a remote
+                res.push({
+                    id: (entry.id as string),
+                    matrix: new MatrixStoreRoom(matrixId),
+                    remote,
+                });
+            }
         }
         if (res.length > 0) {
             this.entriesMatrixIdCache.set(matrixId, {e: res, ts: Date.now()});
@@ -206,13 +208,14 @@ export class DbRoomStore {
                     remote = new RemoteStoreRoom(remoteId, row as any);
                 }
             }
-
-            res.push({
-                id: (entry.id as string),
-                matrix: matrixId ? new MatrixStoreRoom(matrixId) : null,
-                // tslint:disable-next-line no-any
-                remote,
-            });
+            if (remote) {
+                // Only push rooms with a remote
+                res.push({
+                    id: (entry.id as string),
+                    matrix: new MatrixStoreRoom(matrixId) : null,
+                    remote,
+                });
+            }
         }
         return res;
     }
-- 
GitLab