Add bulk notes/comments for issues [API + UI]

Proposal

It seems that at moment there's no way for user to make a note for several issues. That feature can be done. I'll try to explain my thoughts about possible implementation. It seems that JIRA has that feature in their bulk editor.

On API level can be introduced POST-endpoint: api/v4/projects/:project_id/issues/bulk_notes

That endpoint should receive an array of issues inside project and body of note for bulk creation. If user is able to create notes in project's namespace, then in background a worker should populate these issues.

Endpoint should return to user an id of that bulk operation. With separate query user'd be able to get a status of that operation.

On the UI side:

At the moment user can make a Bulk edit for issues for several attributes or move several issues to another namespace:

image.png

The idea is to add a possibility to create a comment/note for several issues. The form can be placed in the same sidebar and look something like that:

image.png

____

Above are my initial thoughts about implementation. I'll just leave them here.

The implementation can be a bit sophisticated on the backend-side. There can be several ways to implement that stuff:

  1. [Bad] Create a single note for many issues and join them via has-many relation on the database-level. I don't like that option since it will require a lot of changes in codebase, breaks simple one-to-one relation between the note and it's container (issue/epis/merge request, etc.) and can lead to tons of bugs.
  2. [Good?] Create multiple identical notes to several issues.

Second option seems to be an appropriate way for dealing with that bulk adding, imho. But since in that operation app should create several notes than it seems creation of all comments should be:

a) Transactional - on DB-level (?).

b) Made in the background jobs - in some kind of worker (WorkItems::BulkNotesCreateWorker?). And there should be some mechanism to guarantee that that worker is idempotent: probably it can get some hash-based id using the note-author id + issues ids + note content (trimmed) + date of the note (or hour) [the last point is to allow making the same comment for same issues but in different dates].... [On the second thought it can be generated on the side of api-method or controller's action based on timestamp + current_user.id].


winotes feature

Edited by Alex Kozenko