1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

🐛 fix member sidebar

This commit is contained in:
Flam3rboy 2021-05-22 17:40:59 +02:00
parent e434334a21
commit 2c5959874e
2 changed files with 3 additions and 2 deletions

View File

@ -30,7 +30,7 @@ export class Server {
async setupSchema() {
// TODO: adjust expireAfterSeconds -> lower
await db.collection("events").createIndex({ created_at: 1 }, { expireAfterSeconds: 60 });
await Promise.all([db.collection("events").createIndex({ created_at: 1 }, { expireAfterSeconds: 60 })]);
}
async listen(): Promise<void> {

View File

@ -14,6 +14,7 @@ import { Send } from "../util/Send";
import WebSocket from "../util/WebSocket";
import { check } from "./instanceOf";
// TODO: check permission and only show roles/members that have access to this channel
// TODO: config: if want to list all members (even those who are offline) sorted by role, or just those who are online
export async function onLazyRequest(this: WebSocket, { d }: Payload) {
@ -41,7 +42,7 @@ export async function onLazyRequest(this: WebSocket, { d }: Payload) {
let: { id: "$id" },
pipeline: [
{ $match: { $expr: { $in: ["$$id", "$roles"] } } },
{ $limit: 1 },
{ $limit: 100 },
{
$lookup: {
from: "users",