Adds 'post to channel' functionality. (#901)

* Adds 'post to channel' functionality. Closes #613

* Add specs
Update Slack integration marketing page

* Fix specs

* 💚
This commit is contained in:
Tom Moor
2019-02-19 22:42:13 -08:00
committed by GitHub
parent e283d15d7e
commit 19fc99944a
5 changed files with 138 additions and 9 deletions

View File

@@ -1,7 +1,19 @@
// @flow
import { Document, Team } from '../models';
function present(document: Document, team: Team, context?: string) {
type Action = {
type: string,
text: string,
name: string,
value: string,
};
function present(
document: Document,
team: Team,
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
@@ -13,8 +25,10 @@ function present(document: Document, team: Team, context?: string) {
title: document.title,
title_link: `${team.url}${document.url}`,
footer: document.collection.name,
callback_id: document.id,
text,
ts: document.getTimestamp(),
actions,
};
}