Skip to content

Cannot unassign issues #355

@oogali

Description

@oogali

go-atlassian v2.2.0

go-atlassian component

  • Jira Software Cloud
  • Jira Agile Cloud
  • Jira Service Management Cloud
  • Confluence Cloud
  • Atlassian Admin Cloud

Describe the bug 🐛
Cannot unassign an issue from a user.

To Reproduce 🚧
Steps to reproduce the behavior:

  • Attempt to unassign any issue (assuming you have permissions to Assign Issues).

Expected behavior
I expect my issue to now be unassigned.

Screenshots 📄
(not applicable)

Additional context
This seems to be caused by the inability of assignIssue within jira/internal/issue_impl.go to set an accountId of nil.

The validation prevents you from passing an empty string, and the docstring misleads one into thinking "null" is a valid value.

Without an ability to set a null value (nil), you are unable to unassign an issue using the .Issue.Assign method.

Code snippet

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	jiraCloud, err := jira.New(nil, host)
	if err != nil {
		return
	}

	jiraCloud.Auth.SetBasicAuth(mail, token)
	jiraCloud.Auth.SetUserAgent("curl/7.54.0")

	// Steps to reproduce
        if _, err := jiraCloud.Issue.Assign(context.Background, "TEST-123", ""); err != nil {
                // Error returned will be model.ErrNoAccountID ("jira: no account id set")
                // This error comes locally from the library performing input validation
                fmt.Printf("could not unassign issue using empty accountId: %s\n", err.Error())
        }

        if _, err := jiraCloud.Issue.Assign(context.Background, "TEST-123", "null"); err != nil {
                // Error returned will be model.ErrNotFound ("client: no atlassian resource found")
                // This error comes from the remote instance because there is no user with an account ID of "null"
                fmt.Printf("could not unassign issue using supposed null string: %s\n", err.Error())
        }
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions