Appease the linter

This commit is contained in:
Travis Ralston 2020-12-24 11:58:40 -07:00
parent 90640b6714
commit f616ecccb3
2 changed files with 8 additions and 7 deletions

View File

@ -70,11 +70,11 @@ if (config.health.healthz.enabled) {
} }
// Switch to using the rule server if we need to // Switch to using the rule server if we need to
const banLists: BanList[] = [];
if (config.ruleServer?.enabled) { if (config.ruleServer?.enabled) {
await logMessage(LogLevel.INFO, "index", "Rule server is starting up."); await logMessage(LogLevel.INFO, "index", "Rule server is starting up.");
// Resolve all the rule server's watched rooms // Resolve all the rule server's watched rooms
const banLists: BanList[] = [];
for (const roomRef of config.ruleServer.listRooms) { for (const roomRef of config.ruleServer.listRooms) {
const permalink = Permalinks.parseUrl(roomRef); const permalink = Permalinks.parseUrl(roomRef);
if (!permalink.roomIdOrAlias) continue; if (!permalink.roomIdOrAlias) continue;
@ -121,7 +121,6 @@ if (config.health.healthz.enabled) {
return client.joinRoom(roomId); return client.joinRoom(roomId);
}); });
const banLists: BanList[] = [];
const protectedRooms: { [roomId: string]: string } = {}; const protectedRooms: { [roomId: string]: string } = {};
// Ensure we're also joined to the rooms we're protecting // Ensure we're also joined to the rooms we're protecting

View File

@ -72,11 +72,13 @@ export class RuleServer {
} }
private async rebuildRules() { private async rebuildRules() {
const userRules = this.banLists.map(b => b.userRules).reduce((a, c) => {a.push(...c); return a;}, []); const doReduce = (a, c) => {
const roomRules = this.banLists.map(b => b.roomRules).reduce((a, c) => {a.push(...c); return a;}, []); a.push(...c);
const serverRules = this.banLists.map(b => b.serverRules).reduce((a, c) => {a.push(...c); return a;}, []); return a;
};
console.log({userRules, roomRules, serverRules}); const userRules = this.banLists.map(b => b.userRules).reduce(doReduce, []);
const roomRules = this.banLists.map(b => b.roomRules).reduce(doReduce, []);
const serverRules = this.banLists.map(b => b.serverRules).reduce(doReduce, []);
this.pyRules = { this.pyRules = {
checks: { checks: {