Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can't comment on Jira issues using Mylyn | Comment validator script

slothstronaut February 1, 2016

I am validating if the user commented on transition with scriptrunner. Its working fine until Mylyn enters the game. 

It seems the validation script is running after Mylyn commited the issues field changes, but before the comment is attached to the issue. Therefore the script checks, if there was a comment on the particular issue in the last 1500ms:

diff = currentTime - lastCommentTime;
 
if (( diff > 1500 ) && ( transientVars.get("comment") == null )){

	throw new InvalidInputException("Please leave a comment");
}

Unfortunately this workaround is only working, when additionally (editing and) submitting any other fields value through Mylyn, inversely it is not working, when someone only wants to comment an issue through Mylyn, which is the desired behaviour here.

 

So is it possible to run the validation script after Mylyns submit has been fully completed (Script(-Runner) or Mylyn modification considerated)?

Maybe someone has any idea how to make sure theres a comment on transition using Mylyn (or another IDE connector) ?

 

Thanks, 

Marius

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 1, 2016

Can you try to trace the REST requests that Mylyn is making, eg by configuring it to use a debugging proxy like Fiddler.

Perhaps Mylyn is doing the transition and then in a separate call adding a comment, which to me seems like an issue with Mylyn.

0 votes
slothstronaut February 2, 2016

Thanks for your answer Jamie, thats what i thought. Access.log approved this:

 

Exception is thrown:

GET + "/rest/api/latest/issue/*PROJECTNAME*/transitions?expand=transitions.fields" 
GET + "/rest/api/latest/issue/*ISSUENAME*?expand=schema,names,transitions,editmeta,schema" 
POST - "/rest/api/latest/issue/*ISSUEID*/transitions?expand=transitions.fields"


Exception is not thrown:

GET "/rest/api/latest/issue/*ISSUENAME*?expand=schema,names,transitions,editmeta,schema" 
PUT "/rest/api/latest/issue/*ISSUEID*"
GET "/rest/api/latest/issue/*ISSUENAME*?expand=schema,names,transitions,editmeta,schema"
POST "/rest/api/latest/issue/*ISSUEID*/comment" //here
GET "/rest/api/latest/issue/*ISSUENAME*/transitions?expand=transitions.fields"
GET "/rest/api/latest/issue/*ISSUENAME*?expand=schema,names,transitions,editmeta,schema"
POST "/rest/api/latest/issue/*ISSUEID*/transitions?expand=transitions.fields" "Jakarta Commons-HttpClient/3.1"
GET "/rest/api/latest/issue/*ISSUEID*?expand=schema,names,transitions,editmeta,schema" 
GET "/rest/api/latest/issue/*ISSUENAME*/transitions?expand=transitions.fields"


In my opinion it is an issue with Mylyn, but at the same time I thought a different approach of validating and/or an adaption of my script maybe could do the trick. Thats why i got the adaptavist-tag on board.

If anyone here has an idea how to validate comment made on transition with any IDE Connector or has experience with modifying Mylyn, feel free to comment below wink 

Thanks, 

Marius

 

TAGS
AUG Leaders

Atlassian Community Events