Skip to content
Snippets Groups Projects
Commit 26c35a9d authored by Erick Hitter's avatar Erick Hitter
Browse files

Mattermost/Slack send a JSON payload for a Slash command

parent f8032929
No related branches found
No related tags found
1 merge request!2Mattermost/Slack send a JSON payload for a Slash command
...@@ -27,12 +27,12 @@ app.get( '/', function( req, res ) { ...@@ -27,12 +27,12 @@ app.get( '/', function( req, res ) {
// Parse POST body to create WP post // Parse POST body to create WP post
app.post( '/log', function( req, res ) { app.post( '/log', function( req, res ) {
// Don't bother if there's nothing to record // Don't bother if there's nothing to record
if ( 'undefined' === typeof req.body || ! req.body.length ) { if ( 'undefined' === typeof req.body || 'undefined' === typeof req.body.text || ! req.body.text.length ) {
return res.sendStatus( 400 ); return res.sendStatus( 400 );
} }
// Massage the title // Massage the title
var title = req.body; var title = req.body.text;
title = striptags( title, [] ); title = striptags( title, [] );
if ( title.length > 30 ) { if ( title.length > 30 ) {
...@@ -43,7 +43,7 @@ app.post( '/log', function( req, res ) { ...@@ -43,7 +43,7 @@ app.post( '/log', function( req, res ) {
} }
// Decorate the content // Decorate the content
var content = req.body; var content = req.body.text;
content = striptags( content, [ 'a', 'code', 'strong', 'em' ] ); content = striptags( content, [ 'a', 'code', 'strong', 'em' ] );
content = '<blockquote>' + content + "</blockquote>\n\n#slash-done"; content = '<blockquote>' + content + "</blockquote>\n\n#slash-done";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment