#104 Add comment when attempting to transition to CUSTOM_STATE
Merged 4 years ago by sidpremkumar. Opened 4 years ago by sidpremkumar.
sidpremkumar/sync-to-jira auto-transition-comment  into  develop

file modified
+5 -2
@@ -740,10 +740,13 @@ 

      except ValueError:

          # for python 2.7

          closed_status = (filter(lambda d: "transition" in d, issue.downstream.get('updates', {})))[0]['transition']

- 

      if closed_status is not True and issue.status == 'Closed' \

              and existing.fields.status.name.upper() != closed_status.upper():

-         # Now we need to update the status of the JIRA issue\

+         # Now we need to update the status of the JIRA issue

+         # First add a comment indicating the change (in case it doesn't go through)

+         hyperlink = f"[Upstream issue|{issue.url}]"

+         comment_body = f"{hyperlink} closed. Attempting transition to {closed_status}."

+         client.add_comment(existing, comment_body)

          # Ensure that closed_status is a valid choice

          # Find all possible transactions (i.e. change states) we could `do

          _change_status(client, existing, closed_status, issue)

Any chance we could add a hyperlink to the upstream issue here? In the case of someone getting this notification in their email it would prevent them from clicking through to jira first to find the upstream link. In my case I'm not syncing all comments, just the closed state transition so if someone is interested in why it was closed they have to click through to the upstream issue.

rebased onto 3d27bebf0ac64bf7f8b05062c742391eceb07227

4 years ago

@dustymabe could you take a look again? I added the hyperlink feature.

rebased onto 48e0cbc

4 years ago

LGTM assuming that's the right syntax for a URL in JIRA. Thanks @sidpremkumar!

Pull-Request has been merged by sidpremkumar

4 years ago
Metadata