Jira Onebox Plugin

(Jake Shadle) #1

I’ve made a simple Onebox plugin for JIRA issues.

It is very simple, and just shows the link similarly to how it is shown in Confluence.

Please visit our Discourse Forum! (Directory)
(Jake Shadle) #2

Now that I have the simple, static case, I would like to do the more complicated case of dynamically updating the link based upon the current status of the issue.


Which means I periodically need to update the HTML for the links to reflect what they are pointing to…the problem is that I have no idea how this can be done in Discourse.

I used the Onebox stuff for convenience since it is built in quite nicely, but it seems it is geared towards completely static generation? If that could be overriden to allow dynamic fetching of that would be great, but if that is not possible or would be really hacky, what other options would I have?

When I was creating the plugin I noticed the calls that were actually triggering the resolution of links

Started GET "/onebox?url=...&refresh=false"

If passing refresh=true would cause the onebox plugin to rerun and get the current data instead of retrieving the cached HTML that would probably solve the problem, but I’m unsure how I could influence that parameter for only specific links (or at all).

Any help would be appreciated!

(Jeff Atwood) #3

You could trigger a rebake of the post. This would cause the onebox to update to reflect the current state of the URL.

Oneboxes are biased towards static content, but a rebake should be something a plugin can trigger.

(Jake Shadle) #4

Ahh ok, that would work nicely since they don’t need to be updated continuously, and I know our JIRA server already has enough problems as it is without getting hit with API requests…

Thanks, I’ll take a look at that this weekend!

(Michael Downey) #5

Sounds nice. Hope to try this out. Is there any configuration required on either app?

(Jake Shadle) #6

Right now it doesn’t have any configuration on either side, which worked for the main JIRA server that my team uses, but there could be problems related to authentication, I just didn’t encounter any during my testing.

Also the url regex depends on it being of the form https?://<host>/browse/<issueId>, but I don’t know if that is a standard url format for all JIRA versions, or if can be configured, but if that is the case I could add some plugin settings that allow you to add/modify the regex match (I hope that would work).

This is very much an alpha version just to get my feet wet with Discourse plugins, definitely looking at moving this forward since JIRA is an important thing for my team.

(Michael Downey) #7

I haven’t seen any other URL formats in all of the JIRA installations I’ve seen, so I wouldn’t panic too much.

(Jake Shadle) #8

Awesome, I figured that was the case, thanks for confirming. :slight_smile:

(Kane York) #9

BTW, you should definitely upstream this into the discourse/onebox repository once you think it’s stable so that everyone can use it.

(Michael Downey) #10

Just installed this and it worked flawlessly & instantly once installed.

The only thing I can think of is that the image seems to be a bit slow loading because it’s from the remote server. It’d be nice if it could be cached locally.

(Jake Shadle) #11

Awesome, glad it worked for you!

Yah, it would be easy enough to just copy the common images for the issue types and status types as assets, I know I don’t trust JIRA servers nearly as much as Discourse servers. :smile:

One thing I will also try this weekend is to enable the plugin to (optionally) add remote links to JIRA just like Confluence does, eg

So we’ll see how it goes. :slight_smile:

(Michael Downey) #12

Remote links would be nice!

I wonder about pre-downloading the images, though. Many projects can use a wide variety of different issue types, and I don’t know for sure, but I think there can be custom issue type icons. In oneboxes, I think the icons are copied locally on the server just after they’re rendered. Maybe there’s a way to do the same thing here?

(Jake Shadle) #13

Yes, it will need to handle custom icon types, but should be easy enough to only grab them once and cache them on the Discourse server. That is to say, easy if I knew both Ruby and how Discourse fits together. :wink:

(Michael Downey) #14

Also – and this is nearly offtopic – not sure if you also use the Confluence wiki product but we’ve been wondering about how to get its pages to generate valid/useful Oneboxes too. Perhaps the same code could work for both; not sure.

(Jake Shadle) #15

I was actually going to do a Onebox for Confluence also, but unfortunately the REST API is only in versions 5.5+, and the Confluence version I have to test against is 5.4. :frowning: I could do HTML scraping, but that would be way more likely to run into problems…

(Jake Shadle) #16

Actually, it appears they have an older JSON-RPC API that I can use, I’ll support that one for now since it should still be available in newer Confluence versions.

(Kriti Sen Sharma) #17


I am working on migrating our company’s phpBB forum to Discourse.

Simultaneously, other folks in our company are migrating our internal bug-tracking to Jira from Atlassian, and wiki to Confluence. Some points about this:

  • Atlassian also has some forum product (Questions for Confluence) – but that is way pricey and we will definitely not be purchasing that.
  • Also Jira / Confluence will be used internally by ~20 employees, but the forum has 4k users

So here’s a desire that came up in our company meetings – can Discourse have some kind of link to Jira (and possibly vice versa). The closest solution I found on the web is this post. But the GitHub plugin mentioned at this page seems to be last updated in May. Has there been any other activity on this front?

Also, anything linking Discourse and Confluence?



I am in the same case as you: not migrating but creating a brand new forum with Discourse for my company, where Jira and Confluence wiki are already deployed. Each platform will have different uses and end-users but some kind of interaction between Confluence, Jira and Discourse is desired.

For the moment, I am working on a comparison between Confluence and Discourse, for internal promotion of the forum… :smile:

(Jake Shadle) #19

I have not had any time or incentive to work on this stuff further unfortunately, this plugin turned out to be more of a one-off than a proper plugin for JIRA/Confluence should be, particularly JIRA due to the need to have dynamic updates of links in posts, which OneBox can’t do.

I think the best bet would be someone else making a proper plugin.

(Michael Downey) #20

I don’t know, it works fine for us. :slight_smile:

I don’t think that people necessary expect the link to always have the correct state/title/type. Just what was there when the author added it. :+1: