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

allow to unset assigned_to_id of issues #306

Closed
akohlbecker opened this issue Feb 20, 2018 · 4 comments
Closed

allow to unset assigned_to_id of issues #306

akohlbecker opened this issue Feb 20, 2018 · 4 comments

Comments

@akohlbecker
Copy link

The assigned_to_id of an existing issue can not be unset:

issue.setAssigneeId(null);

will cause the Transport to send a null value to the REST API:

{
  "issue":
  {
   "assigned_to_id": null
   }
}

but Redmine (v.3.3.6) ignores this. The only value which causes the issue service to reset the assigned_to_id is an empty string:

{
  "issue":
  {
   "assigned_to_id": ""
   }
}
@alexeyOnGitHub
Copy link
Member

@akohlbecker thank you for reporting this. I do not actively work on this project anymore. if you can submit a PR with a fix that would be in line with the current architecture, I can review & merge.

@alexeyOnGitHub
Copy link
Member

closing since no one volunteered to work on this issue.
in general, the API was not intended to erase fields (historical reasons). this can be implemented, but needs to be done in a backward-compatible manner , as a general solution for all fields, not just one

@eticco
Copy link

eticco commented Jul 23, 2019

We have found today the same problem when I migrated from Redmine v3.1.2 (unset assignee_to_id from Redmine Java API worked fine) to v3.4.11 (assigned_to_id can't be unset by API). Our workaround has been to change the addIfSet method in the RedmineJSONBuilder class of the Redmine Java API. I share it for if this may help someone


private static void addIfSet(JSONWriter writer, String jsonKeyName, PropertyStorage storage, Property<?> property) throws JSONException {
	if (storage.isPropertySet(property)) {
		writer.key(jsonKeyName);
		writer.value(storage.get(property) != null ? storage.get(property) : "");
	}
}

@Glideh
Copy link

Glideh commented Apr 15, 2021

This seems to work now on Redmine 4.1.0 with "assigned_to_id": ""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants