gsingers / slack-jira-plugin

A Slack plugin that watches channels for messages about JIRA and acts accordingly
MIT License
252 stars 85 forks source link

Issue details as Slack attachments #4

Closed ivanblagdan closed 8 years ago

ivanblagdan commented 9 years ago

I've did a quick and dirty implementation of attachments for more detailed issues inside slack. Should be self explanatory, here are some more details on the Slack API for this https://api.slack.com/docs/attachments

timfallmk commented 9 years ago

:+1:

timfallmk commented 9 years ago

@ivanblagdan I get the following error from testing your branch:

/root/slack-jira-plugin/config.js:32
  error_channel: '' //the id of the channel to send low level log errors.  If 
  ^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3
ivanblagdan commented 9 years ago

Looks like a issue with your config. Want to share it?

timfallmk commented 9 years ago

@ivanblagdan Ack! I was missing a comma after the previous entry! Now I feel like an idiot.... :frowning: :100:

ivanblagdan commented 9 years ago

I presume its working out for you now? :)

timfallmk commented 9 years ago

@ivanblagdan I can't test due to #5 , but I don't think that has anything to do with your branch.

timfallmk commented 9 years ago

@ivanblagdan Do you have the output of a running example? I got past #5 (and #6 for now) but I still only get the url for the issue.

ivanblagdan commented 9 years ago

Did you enable the details setting in your config? showIssueDetails: true, showDetailsByDefault: true,

timfallmk commented 9 years ago

I did, and I don't seem to get any details (even author or issue title). I'm still working on it, but my config is pretty much the same as in #5

ivanblagdan commented 9 years ago

Any news here? The code that handles what you are reporting is pretty simple.

if (self.config.showIssueDetails && expandInfo) {
                      attachments.push(generateAttachement(configUrl, issue));
                      var req = {"channel": message.channel, "attachments": attachments, "text": " "};
                    }else{
                      var req = {"channel": message.channel, "text": msg};
                    }
timfallmk commented 9 years ago

Sorry @ivanblagdan I haven't had time to follow up on it, but I'll try and track it down shortly.

gsingers commented 9 years ago

Just seeing this now, if you get a chance @ivanblagdan please update.

ivanblagdan commented 9 years ago

@gsingers there you go.

coagulant commented 9 years ago
Cannot read property 'displayName' of null

TypeError: Cannot read property 'displayName' of null
    at generateAttachement (/home/coagulant/slack-jira-plugin/lib/bot.js:63:37)
    at /home/coagulant/slack-jira-plugin/lib/bot.js:240:40
    at Request._callback (/home/coagulant/slack-jira-plugin/node_modules/jira/lib/jira.js:236:13)
    at Request.self.callback (/home/coagulant/slack-jira-plugin/node_modules/jira/node_modules/request/main.js:127:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request.<anonymous> (/home/coagulant/slack-jira-plugin/node_modules/jira/node_modules/request/main.js:767:16)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/home/coagulant/slack-jira-plugin/node_modules/jira/node_modules/request/main.js:729:14)
    at IncomingMessage.EventEmitter

If assignee is not set.

Colors are kinda strange (danger for all statues except closed).

Thnx for this PR, a good base for further improvement and customization!

gsingers commented 9 years ago

Finally a chance to review, @coagulant. Sorry for the delay. Can you make this optional by adding it as a flag to the config? My team prefers the more succinct format that is currently in play, although I am amenable to committing it.

coagulant commented 9 years ago

@gsingers That's not my code, I'm just using @ivanblagdan code from this pull request ;) :+1: for making attachments configurable

ivanblagdan commented 9 years ago

Here's a screenshot of how the attachments look like in Slack for anyone looking. slack-jira-bot

gsingers commented 9 years ago

@ivanblagdan See above. Can you make it optional and update it?

ivanblagdan commented 9 years ago

Sure I could do that. Its low on my list though so it might take a while, if anyone wants to jump in go ahead.

gsingers commented 8 years ago

I think this is replaced by some of the other updates, so closing out.