This commit is contained in:
Tom Moor
2018-08-05 00:51:47 -07:00
parent fc7373a6f5
commit 61b6b18148
3 changed files with 37 additions and 6 deletions

View File

@ -71,7 +71,16 @@ router.post('hooks.slack', async ctx => {
if (results.length) {
const attachments = [];
for (const result of results) {
attachments.push(presentSlackAttachment(result.document, result.context));
const queryIsInTitle = !!result.document.title
.toLowerCase()
.match(text.toLowerCase());
attachments.push(
presentSlackAttachment(
result.document,
queryIsInTitle ? undefined : result.context
)
);
}
ctx.body = {