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?
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:
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.
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...
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG