Github integration (#6414)
Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@@ -57,10 +57,25 @@ export class CacheHelper {
|
||||
/**
|
||||
* Gets key against which unfurl response for the given url is stored
|
||||
*
|
||||
* @param url The url to generate a key for
|
||||
* @param teamId The team ID to generate a key for
|
||||
* @param url The url to generate a key for
|
||||
*/
|
||||
public static getUnfurlKey(url: string, teamId: string) {
|
||||
public static getUnfurlKey(teamId: string, url = "") {
|
||||
return `unfurl:${teamId}:${url}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all cache data with the given prefix
|
||||
*
|
||||
* @param prefix Prefix to clear cache data
|
||||
*/
|
||||
public static async clearData(prefix: string) {
|
||||
const keys = await Redis.defaultClient.keys(`${prefix}*`);
|
||||
|
||||
await Promise.all(
|
||||
keys.map(async (key) => {
|
||||
await Redis.defaultClient.del(key);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { glob } from "glob";
|
||||
import type Router from "koa-router";
|
||||
import isArray from "lodash/isArray";
|
||||
import sortBy from "lodash/sortBy";
|
||||
import { UnfurlSignature } from "@shared/types";
|
||||
import { UnfurlSignature, UninstallSignature } from "@shared/types";
|
||||
import type BaseEmail from "@server/emails/templates/BaseEmail";
|
||||
import env from "@server/env";
|
||||
import Logger from "@server/logging/Logger";
|
||||
@@ -28,6 +28,7 @@ export enum Hook {
|
||||
Processor = "processor",
|
||||
Task = "task",
|
||||
UnfurlProvider = "unfurl",
|
||||
Uninstall = "uninstall",
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,6 +41,7 @@ type PluginValueMap = {
|
||||
[Hook.EmailTemplate]: typeof BaseEmail;
|
||||
[Hook.Processor]: typeof BaseProcessor;
|
||||
[Hook.Task]: typeof BaseTask<any>;
|
||||
[Hook.Uninstall]: UninstallSignature;
|
||||
[Hook.UnfurlProvider]: { unfurl: UnfurlSignature; cacheExpiry: number };
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user