Skip to content

Cannot disable notify users when updating issue with options #696

@marfgold1

Description

@marfgold1

What happened?

UpdateQueryOptions have a NotifyUsers field as a boolean. When tried to update issue with notify users set to false, it does not set it as the query parameters. Making matters worse, it will still update the issue and notify the user anyways.

What did you expect to happen?

Notify users can be set to false.

How can we reproduce it (as minimally and precisely as possible)?

func main() {
	tp := jira.BasicAuthTransport{
		Username: "<username>",
		Password: "<password>",
	}
	client, err := jira.NewClient(tp.Client(), "<jira_url>")
	_, resp, _ := client.Issue.UpdateWithOptions(&jira.Issue{Key: "<issue_key>"}, &jira.UpdateQueryOptions{
		NotifyUsers: false,
	})
	fmt.Println(resp.Request.URL.Query().Encode()) // should print `notifyUsers=false` but does not print anything.
}

Anything else we need to know?

As per Jira API docs, notifyUsers defaults to true. UpdateQueryOptions accept NotifyUsers with url's tag of omitempty, makes it impossible to set notify users to false because query parser ignores it as it considered as empty value. This technically makes NotifyUsers to be useless because it will always be true regardless of the value.

Your Environment

  • go-jira version (git tag or sha): go-jira@v1.14.0
  • Go version (go version): go1.17.13 darwin/amd64
  • Jira type (cloud or on-premise): cloud (using v2)
  • Jira version / Api version: v2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions