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:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user