mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-11 04:45:02 +00:00
Temp fix for circular dependency
This commit is contained in:
parent
bed6589d48
commit
8edaa75064
2 changed files with 28 additions and 28 deletions
|
@ -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
Add a link
Reference in a new issue