Temp fix for circular dependency
This commit is contained in:
parent
bed6589d48
commit
8edaa75064
2 changed files with 28 additions and 28 deletions
|
@ -7,7 +7,6 @@ import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
|||
import { LogType } from "../../data/LogType";
|
||||
import { logger } from "../../logger";
|
||||
import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners";
|
||||
import { CasesPlugin } from "../Cases/CasesPlugin";
|
||||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { LogsChannelCreateEvt, LogsChannelDeleteEvt, LogsChannelUpdateEvt } from "./events/LogsChannelModifyEvts";
|
||||
|
@ -140,7 +139,7 @@ export const LogsPlugin = zeppelinGuildPlugin<LogsPluginType>()({
|
|||
prettyName: "Logs",
|
||||
},
|
||||
|
||||
dependencies: [TimeAndDatePlugin, CasesPlugin],
|
||||
dependencies: [TimeAndDatePlugin],
|
||||
configSchema: ConfigSchema,
|
||||
defaultOptions,
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ import humanizeDuration from "humanize-duration";
|
|||
import moment from "moment-timezone";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { memberToTemplateSafeMember } from "../../../utils/templateSafeObjects";
|
||||
import { CasesPlugin } from "../../Cases/CasesPlugin";
|
||||
import { logsEvt } from "../types";
|
||||
import { logMemberJoin } from "../logFunctions/logMemberJoin";
|
||||
import { logMemberJoinWithPriorRecords } from "../logFunctions/logMemberJoinWithPriorRecords";
|
||||
|
@ -18,31 +17,33 @@ export const LogsGuildMemberAddEvt = logsEvt({
|
|||
member,
|
||||
});
|
||||
|
||||
const cases = (await pluginData.state.cases.with("notes").getByUserId(member.id)).filter(c => !c.is_hidden);
|
||||
cases.sort((a, b) => (a.created_at > b.created_at ? -1 : 1));
|
||||
// TODO: Uncomment below once circular dependencies in Knub have been fixed
|
||||
|
||||
if (cases.length) {
|
||||
const recentCaseLines: string[] = [];
|
||||
const recentCases = cases.slice(0, 2);
|
||||
const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
||||
for (const theCase of recentCases) {
|
||||
recentCaseLines.push((await casesPlugin.getCaseSummary(theCase))!);
|
||||
}
|
||||
|
||||
let recentCaseSummary = recentCaseLines.join("\n");
|
||||
if (recentCases.length < cases.length) {
|
||||
const remaining = cases.length - recentCases.length;
|
||||
if (remaining === 1) {
|
||||
recentCaseSummary += `\n*+${remaining} case*`;
|
||||
} else {
|
||||
recentCaseSummary += `\n*+${remaining} cases*`;
|
||||
}
|
||||
}
|
||||
|
||||
logMemberJoinWithPriorRecords(pluginData, {
|
||||
member,
|
||||
recentCaseSummary,
|
||||
});
|
||||
}
|
||||
// const cases = (await pluginData.state.cases.with("notes").getByUserId(member.id)).filter(c => !c.is_hidden);
|
||||
// cases.sort((a, b) => (a.created_at > b.created_at ? -1 : 1));
|
||||
//
|
||||
// if (cases.length) {
|
||||
// const recentCaseLines: string[] = [];
|
||||
// const recentCases = cases.slice(0, 2);
|
||||
// const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
||||
// for (const theCase of recentCases) {
|
||||
// recentCaseLines.push((await casesPlugin.getCaseSummary(theCase))!);
|
||||
// }
|
||||
//
|
||||
// let recentCaseSummary = recentCaseLines.join("\n");
|
||||
// if (recentCases.length < cases.length) {
|
||||
// const remaining = cases.length - recentCases.length;
|
||||
// if (remaining === 1) {
|
||||
// recentCaseSummary += `\n*+${remaining} case*`;
|
||||
// } else {
|
||||
// recentCaseSummary += `\n*+${remaining} cases*`;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// logMemberJoinWithPriorRecords(pluginData, {
|
||||
// member,
|
||||
// recentCaseSummary,
|
||||
// });
|
||||
// }
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue