Plugin architecture (#4861)
* wip * Refactor, tasks, processors, routes loading * Move Slack settings config to plugin * Fix translations in plugins * Move Slack auth to plugin * test * Move other slack-related files into plugin * Forgot to save * refactor
This commit is contained in:
@@ -18,7 +18,6 @@ import presentProviderConfig from "./providerConfig";
|
||||
import presentRevision from "./revision";
|
||||
import presentSearchQuery from "./searchQuery";
|
||||
import presentShare from "./share";
|
||||
import presentSlackAttachment from "./slackAttachment";
|
||||
import presentStar from "./star";
|
||||
import presentSubscription from "./subscription";
|
||||
import presentTeam from "./team";
|
||||
@@ -48,7 +47,6 @@ export {
|
||||
presentRevision,
|
||||
presentSearchQuery,
|
||||
presentShare,
|
||||
presentSlackAttachment,
|
||||
presentStar,
|
||||
presentSubscription,
|
||||
presentTeam,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { signin } from "@shared/utils/urlHelpers";
|
||||
import { signin } from "@shared/utils/routeHelpers";
|
||||
import { AuthenticationProviderConfig } from "@server/routes/auth/providers";
|
||||
|
||||
export default function presentProviderConfig(
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
import { traceFunction } from "@server/logging/tracing";
|
||||
import { Document, Collection, Team } from "@server/models";
|
||||
|
||||
type Action = {
|
||||
type: string;
|
||||
text: string;
|
||||
name: string;
|
||||
value: string;
|
||||
};
|
||||
|
||||
function presentSlackAttachment(
|
||||
document: Document,
|
||||
team: Team,
|
||||
collection?: Collection | null,
|
||||
context?: string,
|
||||
actions?: Action[]
|
||||
) {
|
||||
// the context contains <b> tags around search terms, we convert them here
|
||||
// to the markdown format that slack expects to receive.
|
||||
const text = context
|
||||
? context.replace(/<\/?b>/g, "*").replace(/\n/g, "")
|
||||
: document.getSummary();
|
||||
|
||||
return {
|
||||
color: collection?.color,
|
||||
title: document.title,
|
||||
title_link: `${team.url}${document.url}`,
|
||||
footer: collection?.name,
|
||||
callback_id: document.id,
|
||||
text,
|
||||
ts: document.getTimestamp(),
|
||||
actions,
|
||||
};
|
||||
}
|
||||
|
||||
export default traceFunction({
|
||||
spanName: "presenters",
|
||||
})(presentSlackAttachment);
|
||||
Reference in New Issue
Block a user