From 52b8a2a78e62dfdcdd2313e8c7e81a7b07f383e2 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Fri, 30 Dec 2022 16:16:22 +0100 Subject: [PATCH] textStorage: rip out client instance We don't need the client, so there's no need to accept it. --- server/client.ts | 2 +- server/plugins/messageStorage/text.ts | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/server/client.ts b/server/client.ts index cac35532..1af16751 100644 --- a/server/client.ts +++ b/server/client.ts @@ -143,7 +143,7 @@ class Client { } if (Config.values.messageStorage.includes("text")) { - client.messageStorage.push(new TextFileMessageStorage(client)); + client.messageStorage.push(new TextFileMessageStorage(client.name)); } for (const messageStorage of client.messageStorage) { diff --git a/server/plugins/messageStorage/text.ts b/server/plugins/messageStorage/text.ts index 3190890c..51214347 100644 --- a/server/plugins/messageStorage/text.ts +++ b/server/plugins/messageStorage/text.ts @@ -5,17 +5,16 @@ import filenamify from "filenamify"; import Config from "../../config"; import {MessageStorage} from "./types"; -import Client from "../../client"; import Channel from "../../models/chan"; import {Message, MessageType} from "../../models/msg"; import Network from "../../models/network"; class TextFileMessageStorage implements MessageStorage { - client: Client; isEnabled: boolean; + username: string; - constructor(client: Client) { - this.client = client; + constructor(username: string) { + this.username = username; this.isEnabled = false; } @@ -36,7 +35,7 @@ class TextFileMessageStorage implements MessageStorage { const logPath = path.join( Config.getUserLogsPath(), - this.client.name, + this.username, TextFileMessageStorage.getNetworkFolderName(network) );