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

Merge branch 'develop' into 'master'

Mattermost/Slack send a JSON payload for a Slash command

See merge request !2
parents 7cd46891 9232bad6
No related branches found
No related tags found
1 merge request!2Mattermost/Slack send a JSON payload for a Slash command
......@@ -7,7 +7,7 @@ var WPAPI = require( 'wpapi' );
var striptags = require( 'striptags' );
var app = express();
app.use( bodyParser.text() );
app.use( bodyParser.json() );
app.use( bodyParser.urlencoded( { extended: true } ) );
// Config
......@@ -27,12 +27,12 @@ app.get( '/', function( req, res ) {
// Parse POST body to create WP post
app.post( '/log', function( req, res ) {
// 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 );
}
// Massage the title
var title = req.body;
var title = req.body.text;
title = striptags( title, [] );
if ( title.length > 30 ) {
......@@ -43,7 +43,7 @@ app.post( '/log', function( req, res ) {
}
// Decorate the content
var content = req.body;
var content = req.body.text;
content = striptags( content, [ 'a', 'code', 'strong', 'em' ] );
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