Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/issue 314 - Ability to add worklog during issue transition #343

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "ability to add time spent during issue transition #314"
This reverts commit 6658dc0.
AtlassianPS Automated User committed Mar 18, 2019
commit 8e1bdafa9e9e777a6cd96c63efc6d7db05da113e
15 changes: 1 addition & 14 deletions JiraPS/Public/Invoke-JiraIssueTransition.ps1
Original file line number Diff line number Diff line change
@@ -41,9 +41,6 @@ function Invoke-JiraIssueTransition {
[String]
$Comment,

[String]
$TimeSpent,

[Parameter()]
[System.Management.Automation.PSCredential]
[System.Management.Automation.Credential()]
@@ -177,17 +174,7 @@ function Invoke-JiraIssueTransition {
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Adding comment"
$requestBody.update.comment += , @{
'add' = @{
'body' = $Comment
}
}
}

if($TimeSpent){
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Adding time spent"
$requestBody.update.worklog += , @{
'add' = @{
'timeSpent' = $TimeSpent
'started' = (Get-Date -Format O) # Round-trip date/time pattern '2019-03-18T17:59:38.0788189+03:00'
'body' = $Comment
}
}
}
6 changes: 0 additions & 6 deletions Tests/Functions/Invoke-JiraIssueTransition.Unit.Tests.ps1
Original file line number Diff line number Diff line change
@@ -163,12 +163,6 @@ Describe "Invoke-JiraIssueTransition" -Tag 'Unit' {
Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Post' -and $URI -like "*/rest/api/latest/issue/$issueID/transitions" -and $Body -like '*body*test comment*' }
}

It "Adds time spent if provided to the -TimeSpent parameter" {
{ Invoke-JiraIssueTransition -Issue $issueKey -Transition 11 -TimeSpent "15m"} | Should Not Throw

Assert-MockCalled -CommandName Invoke-JiraMethod -ModuleName JiraPS -Times 1 -Scope It -ParameterFilter { $Method -eq 'Post' -and $URI -like "*/rest/api/latest/issue/$issueID/transitions" -and $Body -like '*timeSpent*15m*' }
}

It "Returns the Issue object when -Passthru is provided" {
{ $result = Invoke-JiraIssueTransition -Issue $issueKey -Transition 11 -Passthru} | Should Not Throw
$result = Invoke-JiraIssueTransition -Issue $issueKey -Transition 11 -Passthru
8 changes: 4 additions & 4 deletions docs/en-US/commands/Invoke-JiraIssueTransition.md
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ Performs an issue transition on a JIRA issue changing it's status

```powershell
Invoke-JiraIssueTransition [-Issue] <Object> [-Transition] <Object> [[-Fields] <PSCustomObject>]
[[-Assignee] <Object>] [[-Comment] <String>] [[-TimeSpent] <String>] [[-Credential] <PSCredential>] [-Passthru] [<CommonParameters>]
[[-Assignee] <Object>] [[-Comment] <String>] [[-Credential] <PSCredential>] [-Passthru] [<CommonParameters>]
```

## DESCRIPTION
@@ -48,11 +48,11 @@ Invokes transition ID 11 on issue TEST-01.
### EXAMPLE 2

```powershell
Invoke-JiraIssueTransition -Issue TEST-01 -Transition 11 -Comment 'Transition comment' -TimeSpent "15m"
Invoke-JiraIssueTransition -Issue TEST-01 -Transition 11 -Comment 'Transition comment'
```

Invokes transition ID 11 on issue TEST-01 with a comment and time spent of 15m (can be any jira supported suffix, like 'h' for hours e.g.)
Requires the comment field to be configured visible for transition and time tracking enabled in JIRA preferences.
Invokes transition ID 11 on issue TEST-01 with a comment.
Requires the comment field to be configured visible for transition.

### EXAMPLE 3