How can I find the Crucible review ID from a GutterRenderer plugin?

I'm trying to write my first Atlassian plugin, and I found it pretty easy to get started, but now I'm stuck. I suspect someone with more experience can quickly point me in the right direction.

I'm writing a GutterRenderer plugin for Crucible. I want to display information in the diff gutter which I've stored in a database elsewhere, and which is keyed on the review ID. The GutterRenderer interface allows me to find the repository, the file paths, and the file revisions, but it doesn't provide any information about the review. (We use pre-push reviews, so I can't rely on all files having meaningful revisions).

How can I determine that my renderer is being invoked in the context of a code review, and not just a diff, and how can I discover details about the review?

1 answer

1 accepted

0 votes
Accepted answer
Lukasz Pater Atlassian Team Jun 23, 2014

Hi Peter,

it seems that there's a long standing issue to provide some context (including the review id) to gutter renderers - https://jira.atlassian.com/browse/FE-1363. Please vote for it and add a comment abou the features you'd like to see.

Without the context, I think your best bet is using com.atlassian.sal.api.web.context.HttpContext to retrieve the current request, and determine the current review based on the requests's url. Reviews urls will generally have /cru/REVIEW-PERM-ID in their url.

Thanks for the suggestion. I figured out how to wire an HttpContext into my plugin, but sadly the requesteURL() doesn't include the CR identifier:

http://crucible34.example.com:3990/fecru/WEB-INF/jsp/crucible/review/monolithic/displayFrxInnerDiv.jsp

It looks like the referer header does include the number:

http://crucible34.example.com:3990/fecru/cru/CR-2

I'm going to use this for now, but I'm reluctant to rely on referer URLs, as there's little guarantee that the referer header will be accurate.

Crucible must be communicating this information to the child page somehow, but I don't yet see how. Perhaps it's stashed away in an Atlassian session object somewhere.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,373 views 0 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you