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
Answer accepted
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 - 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:

It looks like the referer header does include the number:

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 Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


242 views 0 6
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