Feature #33418
closedBulk addition of related issues
Added by Dmitry Makurin over 4 years ago. Updated 5 months ago.
0%
Description
Files
relations_bulk_create.patch (5.18 KB) relations_bulk_create.patch | Dmitry Makurin , 2020-05-08 12:17 | ||
i7kB9J3qsk2.gif (411 KB) i7kB9J3qsk2.gif | Dmitry Makurin , 2020-05-08 12:39 | ||
0001-Rework-patch-from-33418.patch (6.4 KB) 0001-Rework-patch-from-33418.patch | Marius BĂLTEANU, 2020-12-12 11:53 | ||
0002-Allow-issue-relation-autocomplete-to-select-multiple.patch (4.18 KB) 0002-Allow-issue-relation-autocomplete-to-select-multiple.patch | Marius BĂLTEANU, 2020-12-17 00:16 | ||
accept_issue_to_id_as_array.patch (822 Bytes) accept_issue_to_id_as_array.patch | Marius BĂLTEANU, 2020-12-26 14:08 |
Related issues
Updated by Go MAEDA over 4 years ago
- Target version set to Candidate for next major release
Updated by Go MAEDA over 4 years ago
- Related to Feature #29272: Create several relations at the same time via Issue Relations API added
Updated by Go MAEDA over 4 years ago
I tried out the patch and found it really nice.
The only one small issue of the patch is that issue auto-complete feature does not work. But I think we can resolve it by using Tribute.js which is used for inline auto complete feature (#31989).
Updated by Go MAEDA about 4 years ago
Go MAEDA wrote:
The only one small issue of the patch is that issue auto-complete feature does not work. But I think we can resolve it by using Tribute.js which is used for inline auto complete feature (#31989).
I realized that implementing the feature with Tribute.js is not so easy because the auto-complete should be triggered without typing a preceding "#" in the related issues section.
Now I think it is OK even if the feature does not support auto-comple for multiple issue ids because it is a trivial matter compared to the usefulness of this feature.
Updated by Marius BĂLTEANU about 4 years ago
- File 0002-Allow-issue-relation-autocomplete-to-select-multiple.patch added
- File 0001-Rework-patch-from-33418.patch 0001-Rework-patch-from-33418.patch added
Dmitry, thanks for posting the patch. I find this feature really useful.
Regarding your proposed solution, I don't think that it's a good ideea to remove the validation from the model because it will allow setting a non visible issue if you by-pass the controller (from a plugin, for example).
I'm attaching two patches:
1. 0001-Rework-patch-from-33418.patch
Based on the existing patch, but keeping the validation in the model and also fixes some edge-case bugs (for ex: no error if you press Add without typing the issue id).
2. 0002-Allow-issue-relation-autocomplete-to-select-multiple
Adds a new JS autocomplete function that allows searching for multiple values. If the solution is good enough, I'll add a system test for it.
Updated by Go MAEDA about 4 years ago
Marius, thank you for improving the patch. I tried out the patches #33418#note-8 and found they are really nice.
Marius BALTEANU wrote:
2. 0002-Allow-issue-relation-autocomplete-to-select-multiple
Adds a new JS autocomplete function that allows searching for multiple values. If the solution is good enough, I'll add a system test for it.
I didn't feel strange compared to the autocomplete in Redmine 4.1.0.
Updated by Marius BĂLTEANU about 4 years ago
- File deleted (
0002-Allow-issue-relation-autocomplete-to-select-multiple.patch)
Updated by Marius BĂLTEANU about 4 years ago
- File 0002-Allow-issue-relation-autocomplete-to-select-multiple.patch 0002-Allow-issue-relation-autocomplete-to-select-multiple.patch added
- Assignee deleted (
Marius BĂLTEANU) - Target version changed from Candidate for next major release to 4.2.0
Updated the second patch to include a test.
Let's discuss this for 4.2.0.
Updated by Go MAEDA about 4 years ago
- Tracker changed from Patch to Feature
- Subject changed from Issue relation bulk create to Bulk addition of related issues
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patch. Thank you for improving Redmine.
Updated by Go MAEDA about 4 years ago
- Related to deleted (Feature #29272: Create several relations at the same time via Issue Relations API)
Updated by Go MAEDA about 4 years ago
- Has duplicate Feature #29272: Create several relations at the same time via Issue Relations API added
Updated by Go MAEDA about 4 years ago
- Has duplicate deleted (Feature #29272: Create several relations at the same time via Issue Relations API)
Updated by Go MAEDA about 4 years ago
- Related to Feature #29272: Create several relations at the same time via Issue Relations API added
Updated by Marius BĂLTEANU about 4 years ago
- File accept_issue_to_id_as_array.patch accept_issue_to_id_as_array.patch added
- Status changed from Closed to Reopened
- Assignee deleted (
Go MAEDA)
I'm reopening this to discuss about the API part which is not implemented 100% correctly.
1. Request:
Currently, for bulk addition of related issues, the request should contains the ids as comma-delimited string, please see the below example (param issue_to_id
):
post(
'/issues/2/relations.xml',
:params => {:relation => {:issue_to_id => "7, 8", :relation_type => 'relates'}}
)
I think we should accept also an array of ids:
post(
'/issues/2/relations.xml',
:params => {:relation => {:issue_to_id => [7, 8], :relation_type => 'relates'}}
)
The attached patch allows this.
2. Response:
Currently, the response contain only the latest relation added:
{ "relation": { "id": 107, "issue_id": 2, "issue_to_id": 8, "relation_type": "relates", "delay": null } }
I think the response should contain all the created relations:
{ "relations": [ { "id": 114, "issue_id": 2, "issue_to_id": 7, "relation_type": "relates", "delay": null }, { "id": 115, "issue_id": 2, "issue_to_id": 8, "relation_type": "relates", "delay": null } ] }
but I'm not sure how to handle the case when the response contain both successfully created relations and non-successfully relations. From what I know, we don't have this kind of mixed API response in Redmine.
I see two options:
1. We change the current implementation to be transactional. In this way, we reject the entire request if an error occurs.
2. We respond with succes if at least one relation was created successfully and we append the error messages to the response:
{ "relations": [ { "id": 114, "issue_id": 2, "issue_to_id": 7, "relation_type": "relates", "delay": null }, { "id": 115, "issue_id": 2, "issue_to_id": 8, "relation_type": "relates", "delay": null } ], "errors": [ "Related issue has already been taken: #3", ] }
Any feedback is welcome!
Updated by Marius BĂLTEANU almost 4 years ago
- Status changed from Reopened to Closed
We will postpone the fixes for API to another version.
Updated by Alex Last almost 4 years ago
hi everyone! I am the owner of redmine-java-api project (https://github.com/taskadapter/redmine-java-api).
I get a server error with Redmine 4.2.0 when trying to create a relation with the request body that previously worked for Redmine 3.x:
{"relation"=>{"issue_to_id"=>576, "relation_type"=>"relates"}, "issue_id"=>"575"}
the error is:
NoMethodError (undefined method `split' for 576:Integer):
because issue_to_id is now expected to be a string with commas, instead of a number.
is this a permanent change or just an experiment? it would be too expensive to maintain compatibility for multiple redmine versions in the java library.
Updated by Alex Last almost 4 years ago
side note - if Redmine REST API supported returning some "server info", the clients could at least choose what json blob to send (for redmine 3.x, 4.x, etc). but since this is not supported, there is no good way to support several redmine REST formats in clients.
Updated by Marius BĂLTEANU almost 4 years ago
- Related to Defect #35039: API create issue relation method returns undefined method `split' when issue id is sent as integer added
Updated by Marius BĂLTEANU almost 4 years ago
Updated by Marius BĂLTEANU over 3 years ago
- Related to Defect #35655: Create duplicated follows relations fails with 500 internal error added
Updated by Mathias Walter 5 months ago
Is there an issue for creating the relationship the other way around (select multiple issues in the issue list and add the relationship via context menu or editing the issues)?