3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-18 07:35:02 +00:00

Allow making archives permanent. Make archives permanent when attached to a case. Add log file metadata dynamically when served (instead of in the body directly). Add missing index on archives.expires_at.

This commit is contained in:
Dragory 2019-01-13 17:29:26 +02:00
parent 6ea6b892df
commit 1ddbb379c5
5 changed files with 59 additions and 13 deletions

View file

@ -6,12 +6,14 @@ import moment from "moment-timezone";
import { CaseTypeColors } from "../data/CaseTypeColors";
import { ZeppelinPlugin } from "./ZeppelinPlugin";
import { GuildActions } from "../data/GuildActions";
import { GuildArchives } from "../data/GuildArchives";
export class CasesPlugin extends ZeppelinPlugin {
public static pluginName = 'cases';
public static pluginName = "cases";
protected actions: GuildActions;
protected cases: GuildCases;
protected archives: GuildArchives;
getDefaultOptions() {
return {
@ -25,6 +27,7 @@ export class CasesPlugin extends ZeppelinPlugin {
onLoad() {
this.actions = GuildActions.getInstance(this.guildId);
this.cases = GuildCases.getInstance(this.guildId);
this.archives = GuildArchives.getInstance(this.guildId);
this.actions.register("createCase", args => {
return this.createCase(
@ -135,6 +138,12 @@ export class CasesPlugin extends ZeppelinPlugin {
});
}
const archiveLinkMatch = body && body.match(/\/archives\/([a-zA-Z0-9\-]+)/);
if (archiveLinkMatch) {
const archiveId = archiveLinkMatch[1];
this.archives.makePermanent(archiveId);
}
if ((!automatic || this.configValue("log_automatic_actions")) && postInCaseLogOverride !== false) {
try {
await this.postCaseToCaseLogChannel(theCase.id);