Skip to content

Commit

Permalink
Added filtering to display info only only for unique issues from same…
Browse files Browse the repository at this point in the history
… message
  • Loading branch information
okovpashko committed Sep 22, 2015
1 parent a5c2fcb commit 7101f90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jira-bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
const Slack = require( 'slack-client' ),
EventEmitter = require( 'events' ).EventEmitter,
util = require( 'util' ),
log = require( 'winston' );
log = require( 'winston' ),
_ = require( 'lodash' );

const JiraBot = function ( config ) { // TODO: check config
let self = this;
Expand Down Expand Up @@ -51,7 +52,7 @@ JiraBot.prototype._onMessage = function ( message ) {
issueKeys = text.match( self.issueKeysRegex ) || [];

if ( issueKeys.length ) {
issueKeys.forEach( function ( issueKey ) {
_.uniq( issueKeys ).forEach( function ( issueKey ) {
log.info( `Found Jira issue key ${issueKey} in channel #${channel.name} from user @${ user.name}` );
self.emit( 'ticketKeyFound', issueKey, channel );
} );
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "ISC",
"dependencies": {
"jira": "^0.9.2",
"lodash": "^3.10.1",
"slack-client": "^1.4.1",
"winston": "^1.0.1"
}
Expand Down

0 comments on commit 7101f90

Please sign in to comment.