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

Cannot disable notify users when updating issue with options #696

Open
marfgold1 opened this issue Jan 2, 2025 · 0 comments
Open

Cannot disable notify users when updating issue with options #696

marfgold1 opened this issue Jan 2, 2025 · 0 comments

Comments

@marfgold1
Copy link

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): [email protected]
  • Go version (go version): go1.17.13 darwin/amd64
  • Jira type (cloud or on-premise): cloud (using v2)
  • Jira version / Api version: v2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant